tldr;我有一个React Native应用程序,我正在使用工作空间。我已经浏览了这个detox getting started文档,现在我有一个e2 e文件夹,其中有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设备。
我如何配置detox来启动iPhone模拟器?
4条答案
按热度按时间xpcnnkqh1#
Tim Rijavec建议的
brew update && brew upgrade applesimutils
和detox clean-framework-cache && detox build-framework-cache
在我的情况下很有帮助!隐藏在评论中,似乎没有解决这个问题的办法。beq87vna2#
对我来说,在终端中运行这两个命令
和
然后我重新运行我的排毒构建和排毒测试命令,它仍然不起作用。所以我就跑了。
在我的mac上,这启动了几个ios模拟器的示例,这些模拟器是备份的,所以看起来像是发生了一些奇怪的事情,导致模拟器实际上没有启动。之后,运行排毒测试开始启动模拟器正确。
k7fdbhmy3#
将detox升级到19.7.1版对我很有效(reference)。
9rbhqvlz4#
我在升级到Xcode 15后遇到了这个问题。Detox无法在模拟器上发射目标:
升级AppleSimUtils后问题得到解决
并更新了最新的排毒版本在我的开发依赖