无法使用排毒运行测试用例

时间:2019-01-31 12:18:05

标签: react-native detox

enter image description here

使用排毒运行测试用例时,我面临以下错误。 我已经安装了所有依赖项。

Can't find a simulator to match with " iPhone 6 ", run 'xcrun simctl list' to list your supported devices.

configuration="ios.sim.debug" artifactsLocation="artifacts/ios.sim.debug.2019-01-31 12-14-41Z" node_modules/.bin/jest "e2e" --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)*$' 
detox[5864] INFO:  [DetoxServer.js] server listening on localhost:57598...
detox[5864] ERROR: [index.js/DETOX_INIT_ERROR] 
 Error: Can't find a simulator to match with " iPhone 6 ", run 'xcrun simctl list' to list your supported devices.
      It is advised to only state a device type, and not to state iOS version, e.g. "iPhone 7"
    at AppleSimUtils.findDevicesUDID (/Users/alok/Desktop/malliswari/accordion/node_modules/detox/src/devices/ios/AppleSimUtils.js:46:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)

2 个答案:

答案 0 :(得分:0)

这是由于将detox的{​​{1}}配置中的模拟器设置为系统上没有的模拟器

package.json

您应该在终端中运行"detox": { "configurations": { "ios.sim.debug": { "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/myapp.app", "build": "RN_SRC_EXT=e2e.js xcodebuild -workspace ios/myapp.xcworkspace -scheme myapp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", "type": "ios.simulator", "name": "iPhone 7" // <- this is where you define your simulator } }, ,以查看可用的模拟器。然后,在xcrun simctl list配置中使用可用的配置之一。您应该可以将其更改为detox"iPhone 7"

答案 1 :(得分:0)

另一个可能的解决方案在这里

https://github.com/wix/Detox/issues/1103

我们需要升级 AppleSimUtils 。如果您在升级check out here

时遇到问题