tldr; 我有一个 React Native 应用程序,我正在使用工作区。我已经阅读了这个排毒入门文档,现在我有一个包含 3 个文件(默认)的 e2e 文件夹,以及 package.json 中的配置。
配置看起来像
"detox": {
"test-runner": "mocha",
"specs": "e2e",
"runner-config": "e2e/mocha.opts",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/MyApp.app",
"build": "xcodebuild -workspace ios/MyApp.xcworkspace -scheme Staging -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 6"
}
}
}
当我运行时,xcrun simctl list
我得到以下列表,其中列出并启动了 iPhone 6。
== Devices ==
-- iOS 11.4 --
iPhone 5s (E9D0264C-9257-4BE4-8693-4B7AE6AAE97A) (Shutdown)
iPhone 6 (099D481A-6F6D-4DC9-A379-16DFAE617CA0) (Booted)
iPhone 6 Plus (7556F239-06F0-421D-A294-AE15BCF6D64D) (Shutdown)
iPhone 6s (FB65410A-4654-40BB-88B0-234DF3C191DE) (Shutdown)
...
-- tvOS 11.4 --
Apple TV (9875527D-A6FC-4BD8-965E-255C910E3ABA) (Shutdown)
Apple TV 4K (0BF2198F-04AF-49CC-B05C-540BB2FB53AF) (Shutdown)
Apple TV 4K (at 1080p) (8F14FC95-685B-481C-860F-384CBD880D2B) (Shutdown)
...
detox build --configuration ios.sim.debug
运行良好,但是当我运行或detox test --configuration ios.sim.debug
启动Apple TV 模拟器并抛出此错误detox build
detox build --reuse
detox info 11:47:49: server listening on localhost:51379...
detox info 2: Searching for device matching iPhone 6...
detox info 5: Booting device 9875527D-A6FC-4BD8-965E-255C910E3ABA
detox info 7: Terminating com.local.MyApp...
detox ERR! 7: An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=164):
Unable to lookup in current state: Shutting Down, exited with code 164
1) "before all" hook
0 passing (9s)
1 failing
1) "before all" hook:
Error: 7: running "/usr/bin/xcrun simctl terminate 9875527D-A6FC-4BD8-965E-255C910E3ABA com.local.MyApp" returned undefined
at Object.execWithRetriesAndLogs (node_modules/detox/src/utils/exec.js:36:11)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
child_process.js:615
throw err;
^
Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration ios.sim.debug --reuse --grep :android: --invert
at checkExecSyncError (child_process.js:575:11)
at Object.execSync (child_process.js:612:13)
at runMocha (/Users/me/code/node_modules/detox/local-cli/detox-test.js:114:6)
at run (/Users/me/code/node_modules/detox/local-cli/detox-test.js:75:7)
at Object.<anonymous> (/Users/me/code/node_modules/detox/local-cli/detox-test.js:181:1)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
你可以看到它下面detox info 5:
开始启动9875527D-A6FC-4BD8-965E-255C910E3ABA
,也就是Apple TV Device。
如何配置 detox 来启动 iPhone 模拟器?