Failure to run detox tests due to timeout during the application installation

1.1k views Asked by At

When trying to run tests on a machine configured in the cloud (AWS), I am getting a timeout error during application installation.

The output with --loglevel trace shows the following:

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' }

However, when I run the installation command manually it succeeds. The time command shows that the installation takes 1m51s to install:

$ 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

Is there a way to configure and increase the timeout for this step or globally?

1

There are 1 answers

0
dchrome On BEST ANSWER

It seems that I've found the place. Apparently, there's a file to configure timeout constants e2e/consts.js.

The following place looks relevant:

exports.wait = 2000;
exports.timeout = 30000;
exports.jestTimeout = 120000;

I updated the exports.jestTimeout value to a higher value and the test was able to pass the problematic step.