在 iOS 上运行排毒测试时模拟器无法打开

Jes*_*ill 1 react-native react-native-ios detox

当我尝试运行detox test模拟器时,模拟器似乎没有打开,并且测试只是超时。

我确认我的设置是正确的,并尝试这样做以确保我的模拟器可以从终端启动,并且我的detox配置中的设备类型是正确的。

我收到的错误如下。

Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.
Error: Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.
Run Code Online (Sandbox Code Playgroud)

DetoxRuntimeError: Detox instance has not been initialized

HINT: There was an error on attempt to call detox.init()

DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

HINT: Most likely, your test runner is tearing down the suite due to the timeout error
Run Code Online (Sandbox Code Playgroud)

这是我的配置,出于隐私原因删除了应用程序名称。

"ios.sim.debug": {
    "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
    "build": "xcodebuild -workspace ios/example.xcworkspace -scheme example -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
    "type": "ios.simulator",
    "device": {
        "type": "iPhone 11 Pro"
    }
},
Run Code Online (Sandbox Code Playgroud)

我该如何调试这个?

Jes*_*ill 6

我发现从 Xcode 9 开始,detoxiOS 模拟器会以无头模式运行。如果您正在运行测试,然后使用 Spotlight 拉出模拟器并按 Enter 键,那么它将把所有已detox打开的模拟器带到前面。

在此输入图像描述

我从这个评论中发现了这一点。

我还发现我的测试超时的原因是用户需要做出响应的提示阻碍了测试的detox进行。