由于在应用程序安装期间超时而无法运行排毒测试
Posted
技术标签:
【中文标题】由于在应用程序安装期间超时而无法运行排毒测试【英文标题】:Failure to run detox tests due to timeout during the application installation 【发布时间】:2021-01-19 17:42:40 【问题描述】:尝试在云 (AWS) 中配置的机器上运行测试时,我在应用程序安装期间遇到超时错误。
--loglevel trace
的输出显示如下:
detox[7183] DEBUG: [exec.js/EXEC_CMD, #16] "/opt/android-sdk/platform-tools/adb" -s emulator-5554 shell "pm install -r -g -t /data/local/tmp/detox/Application.apk"
detox[7183] WARN: at e2e/utils/testRail.js:49:25
Creating a new Run in TestRail has failed with the following error
detox[7183] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
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
at Detox.[_assertNoPendingInit] (/home/fundbox/mobileNative/node_modules/detox/src/Detox.js:204:9)
at Detox.beforeEach (/home/fundbox/mobileNative/node_modules/detox/src/Detox.js:111:37)
at DetoxExportWrapper.(anonymous function).args [as beforeEach] (/home/fundbox/mobileNative/node_modules/detox/src/DetoxExportWrapper.js:87:32)
at DetoxAdapterImpl.beforeEach (/home/fundbox/mobileNative/node_modules/detox/runners/jest/DetoxAdapterImpl.js:28:22)
at process._tickCallback (internal/process/next_tick.js:68:7) name: 'DetoxRuntimeError'
但是,当我手动运行安装命令时,它会成功。 time
命令显示安装耗时1m51s:
$ time /opt/android-sdk/platform-tools/adb -s emulator-5554 shell "pm install -r -g -t /data/local/tmp/detox/Application.apk"
Success
real 1m51.100s
user 0m0.000s
sys 0m0.000s
有没有办法为此步骤或全局配置和增加超时?
【问题讨论】:
【参考方案1】:我好像找到了那个地方。显然,有一个文件可以配置超时常量e2e/consts.js
。
以下地点看起来相关:
exports.wait = 2000;
exports.timeout = 30000;
exports.jestTimeout = 120000;
我将exports.jestTimeout
的值更新为更高的值,并且测试能够通过有问题的步骤。
【讨论】:
以上是关于由于在应用程序安装期间超时而无法运行排毒测试的主要内容,如果未能解决你的问题,请参考以下文章
在使用 Detox 运行测试期间,Android 模拟器无法启动应用程序
排毒测试 + React Native + PouchDB 应用程序:由于一些 PouchDB 同步,我们的登录测试一直失败并超时?