我按照nativescript-dev-appium
说明(https://github.com/NativeScript/nativescript-dev-appium)进行了appium测试,并且这些测试在Android模拟器上运行良好。
我的问题是在iOS上。我无法使它们工作,before
和after
方法失败,并显示错误Cannot read property 'statBarHeight' of undefined
。这是我的日志:
➜ npm run e2e -- --runType sim.iPhone11Pro --reuseDevice
> my-project@1.0.0 e2e /Users/fleebzz/workspaces/xxx/my-project
> node ./node_modules/nativescript-dev-appium/check-dev-deps.js && mocha --opts ./e2e/config/mocha.opts "--runType" "sim.iPhone11Pro" "--reuseDevice"
Parsed args: {"port":4723,"projectDir":"/Users/fleebzz/workspaces/xxx/my-project","projectBinary":"/Users/fleebzz/workspaces/xxx/my-project/node_modules/.bin","pluginRoot":"/Users/fleebzz/workspaces/xxx/my-project/node_modules/nativescript-dev-appium","pluginBinary":"/Users/fleebzz/workspaces/xxx/my-project/node_modules/nativescript-dev-appium/node_modules/.bin","wdaLocalPort":8410,"testFolder":"e2e","runType":"sim.iPhone11Pro","appiumCapsLocation":"/Users/fleebzz/workspaces/xxx/my-project/e2e/config/appium.capabilities.json","verbose":false,"cleanApp":false,"path":"/Users/fleebzz/workspaces/xxx/my-project","capabilitiesName":"appium.capabilities.json","driverConfig":{"host":"localhost","port":4723},"logImageTypes":[]}
/Users/fleebzz/workspaces/xxx/my-project/e2e/config/appium.capabilities.json
Capabilities found at: /Users/fleebzz/workspaces/xxx/my-project/e2e/config/appium.capabilities.json
Automation name set to: XCUITest
To change automation name, you need to set it in appium capabilities!
Application full path: /Users/fleebzz/workspaces/xxx/my-project/platforms/ios/build/Debug-iphoneos/myproject.ipa
The started device will be killed after the session quits!
To avoid it, set 'fullReset: false' in appium capabilities.
Is process Simulator.app alive: true
xcrun simctl create "iPhone-11-Pro" "iPhone 11 Pro" "com.apple.CoreSimulator.SimRuntime.iOS-13-5"
Remove: 76B308BE-409C-4A0A-8679-36F670F59118
Check if simulator is booted!
Simulator is booted!
Launched simulator with name: iPhone-11-Pro; udid: 7056B721-AFCA-465F-A65B-E301E21B6DDE; status: booted
Started device: {"token":"7056B721-AFCA-465F-A65B-E301E21B6DDE","name":"iPhone-11-Pro","status":"booted","type":"simulator","apiLevel":"13.5","platform":"ios","createDeviceOptions":{"type":"iPhone-11-Pro"},"pid":75610,"startedAt":1593415466101}
Default device: {
token: '7056B721-AFCA-465F-A65B-E301E21B6DDE',
name: 'iPhone-11-Pro',
status: 'booted',
type: 'simulator',
apiLevel: '13.5',
platform: 'ios',
createDeviceOptions: { type: 'iPhone-11-Pro' },
pid: 75610,
startedAt: 1593415466101
}
Trying to resolve automatically bundleId!
unzip -o /Users/fleebzz/workspaces/xxx/my-project/platforms/ios/build/Debug-iphoneos/myproject.ipa -d /Users/fleebzz/workspaces/xxx/my-project/platforms/ios/build/Debug-iphoneos/myproject
Setting capabilities sim.iPhone11Pro{ "bundleId" : "com.xxx.my-project" }!
Setting application name as my-project
Check and uninstall application from device.
Server args: ["-p","4723","--log-level","info"]
sample scenario
args.appiumCaps['wdaLocalPort']: 8410
Session info:
undefined
Appium settings:
Current version of appium doesn't support appium settings!
Could not resolve device density. Please provide offset in appium config
Appium driver has started successfully!
1) "before all" hook
2) "after all" hook
Killing simulator with udid 7056B721-AFCA-465F-A65B-E301E21B6DDE
Executing "/bin/ps aux | grep -ie '7056B721-AFCA-465F-A65B-E301E21B6DDE' | grep -v grep | xargs kill -9"
No matching processes to kill!
Stopping server...
Shut down!!!
About to exit with code: exit
unzip -o /Users/fleebzz/workspaces/xxx/my-project/platforms/ios/build/Debug-iphoneos/myproject.ipa -d /Users/fleebzz/workspaces/xxx/my-project/platforms/ios/build/Debug-iphoneos/myproject
Appium terminated due signal: null and code: 1
unzip -o /Users/fleebzz/workspaces/xxx/my-project/platforms/ios/build/Debug-iphoneos/myproject.ipa -d /Users/fleebzz/workspaces/xxx/my-project/platforms/ios/build/Debug-iphoneos/myproject
Application from device is uninstalled.
Application from device is uninstalled.
Exited from appium
0 passing (1m)
2 failing
1) sample scenario
"before all" hook:
TypeError: Cannot read property 'statBarHeight' of undefined
at Function.<anonymous> (node_modules/nativescript-dev-appium/lib/appium-driver.js:260:37)
at Generator.next (<anonymous>)
at fulfilled (node_modules/nativescript-dev-appium/lib/appium-driver.js:4:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
2) sample scenario
"after all" hook:
TypeError: Cannot read property 'quit' of undefined
at Context.<anonymous> (e2e/sample.e2e-spec.js:14:22)
at processImmediate (internal/timers.js:456:21)
at process.topLevelDomainCallback (domain.js:137:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! my-project@1.0.0 e2e: `node ./node_modules/nativescript-dev-appium/check-dev-deps.js && mocha --opts ./e2e/config/mocha.opts "--runType" "sim.iPhone11Pro" "--reuseDevice"`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the my-project@1.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/fleebzz/.npm/_logs/2020-06-29T07_24_52_063Z-debug.log
有人已经存在此问题或对解决此问题有任何线索吗?