tldr;我有一个React Native应用,正在使用工作区。我已经遍历了detox getting started文档,现在有了一个e3e文件夹,其中包含3个文件(默认),并在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
或detox build
或detox build --reuse
时,它将启动Apple TV模拟器并引发此错误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设备。如何配置排毒以启动iPhone模拟器?
最佳答案
Tim Rijavec建议的brew update && brew upgrade applesimutils
和detox clean-framework-cache && detox build-framework-cache
对我的情况有帮助!隐藏在评论中似乎无法解决此问题。