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

时间:2020-07-14 22:45:40

标签: react-native react-native-ios detox

当我尝试运行<a class="typeform-share common-btn" target="_blank" data-mode="2" href="form_link"><span>Apply now</span></a> 时,模拟器似乎没有打开,并且测试只是超时了。

我确认设置正确,并尝试this以确保可以从终端启动模拟器,并且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.

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

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

我该如何调试呢?

2 个答案:

答案 0 :(得分:1)

我发现从Xcode 9 detox开始,在无头模式下运行iOS模拟器。如果您正在运行测试,然后使用Spotlight拉起模拟器并按下Enter键,那么它将detox打开的所有模拟器都放在最前面。

enter image description here

我从这个comment发现了这一点。

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

答案 1 :(得分:0)

好像您没有将detox .init方法挂接到测试中。 确保您拥有 e2e / init.js ,并且需要在其中添加

render

还请确保您在 config.json 中调用此文件(这里可能是错误的,我在使用Mocha和mocha.opts代替)