detox test fails to install apk
See original GitHub issueWhat happened?
- I’ve setup Github Action to run detox tests.
- sdk manager
- platform tools
- emulator
- butler
- adb
- …
- Running
detox test
fails to install an apk. Thepm install
command fails every time after 45 seconds. Local tests are working.
13:14:19.683 detox[4431] DEBUG: [SPAWN_CMD, #25, cpid=4643] /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk
13:15:04.686 detox[4431] DEBUG: [SPAWN_END, #25, cpid=4643] /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk terminated with SIGTERM
13:15:04.818 detox[4431] TRACE: [SPAWN_TRY_FAIL, #25]
13:15:04.828 detox[4431] DEBUG: [SPAWN_CMD, #25, cpid=4677] (Retry #1) /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk
13:15:49.975 detox[4431] DEBUG: [SPAWN_END, #25, cpid=4677] /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk terminated with SIGTERM
13:15:50.213 detox[4431] TRACE: [SPAWN_TRY_FAIL, #25]
13:15:50.225 detox[4431] DEBUG: [SPAWN_CMD, #25, cpid=4[774](https://github.com/houserion/universage/runs/7212318253?check_suite_focus=true#step:21:778)] (Retry #2) /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk
13:16:35.268 detox[4431] DEBUG: [SPAWN_END, #25, cpid=4774] /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk terminated with SIGTERM
13:16:35.570 detox[4431] TRACE: [SPAWN_TRY_FAIL, #25]
13:16:35.578 detox[4431] DEBUG: [SPAWN_CMD, #25, cpid=4904] (Retry #3) /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk
13:17:20.699 detox[4431] DEBUG: [SPAWN_END, #25, cpid=4904] /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk terminated with SIGTERM
13:17:20.706 detox[4431] ERROR: ChildProcessError: `/Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk` failed with code null
at ChildProcess.<anonymous> (/Users/runner/work/universage/universage/node_modules/child-process-promise/lib/index.js:132:23)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Socket.<anonymous> (node:internal/child_process:450:11)
at Socket.emit (node:events:390:28)
at Pipe.<anonymous> (node:net:687:12)
What was the expected behaviour?
I expect detox test
to install Application.apk
and launch tests.
Was it tested on latest Detox?
- I have tested this issue on the latest Detox release and it still reproduces.
Did your test throw out a timeout?
- I have followed the instructions under Identifying which synchronization mechanism causes us to wait too much.
Help us reproduce this issue!
No response
In what environment did this happen?
Detox version: 19.7.1 React Native version: 0.64.3 Node version: 16.13.1 Device model: Pixel XL Android version: 12 Test-runner (select one): jest-circus
Detox logs
Detox logs
/bin/sh -c npx detox test --configuration houserion.android.e2e --loglevel trace --record-logs failing --record-videos failing
INFO | boot completed
INFO | boot time 25248 ms
INFO | Increasing screen off timeout, logcat buffer size to 2M.
INFO | Revoking microphone permissions for Google App.
13:13:01.583 detox[4428] INFO: [test.js] DETOX_CONFIGURATION="houserion.android.e2e" DETOX_LOGLEVEL="trace" DETOX_RECORD_LOGS="failing" DETOX_RECORD_VIDEOS="failing" DETOX_REPORT_SPECS=true DETOX_START_TIMESTAMP=1657102381569 DETOX_USE_CUSTOM_LOGGER=true jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' e2e
13:13:05.524 detox[4431] TRACE: [DETOX_CREATE] created a Detox instance with config:
{
appsConfig: {
default: {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/houserion/e2e/app-houserion-e2e.apk',
build: 'cd ./android && RN_SRC_EXT=e2e.js,e2e.ts,e2e.tsx APP=houserion BUILD_TYPE=e2e GENERATE_SOURCEMAP=false ./gradlew assembleHouserionE2e assembleHouserionE2eAndroidTest -DtestBuildType=e2e && cd ..'
}
},
artifactsConfig: {
rootDir: '.artifacts/houserion.android.e2e.2022-07-06 10-13-01Z',
plugins: {
log: {
enabled: true,
keepOnlyFailedTestsArtifacts: true
},
screenshot: {
enabled: true,
● Deep Link, Guest › should work
Environment setup failed. See the detailed error below.
● Deep Link, Guest › should work
Environment setup failed. See the detailed error below.
● Deep Link, Authorized › should onboard
Environment setup failed. See the detailed error below.
● Deep Link, Authorized › should work
Environment setup failed. See the detailed error below.
● Deep Link, Broken › should work
Environment setup failed. See the detailed error below.
● Test suite failed to run
ChildProcessError: `/Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk` failed with code null
at ChildProcess.<anonymous> (../node_modules/child-process-promise/lib/index.js:[132](https://github.com/houserion/universage/runs/7212318253?check_suite_focus=true#step:21:136):23)
13:17:49.456 detox[4431] TRACE: [SESSION_TORN] tester exited session 695db362-0f12-2db8-f69f-fe39da698771
13:17:49.961 detox[4428] ERROR: [cli.js] Command failed: jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' e2e
Device logs
Device logs
paste logs here!
More data, please!
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:24 (3 by maintainers)
Top Results From Across the Web
android - Detox Test - Can't install generated apk in emulator
Run tests (VM Ubuntu 22.04 + commandlinetools). It seems the script fails at installing the app in the emulator in the VM (See...
Read more >Dealing With Problems With Running Tests | Detox
This page is about issues related to executing your Detox tests, typically triggered when running detox test (and not detox build, for example)....
Read more >Detox - NativeScript Docs
Easily add Detox end-to-end testing to your NativeScript apps! ... Installation; Global Setup; Project Setup; Usage; Running Tests; Troubleshooting ...
Read more >Running Detox tests on Bitrise
If you have a React Native app on Bitrise, you can run Detox tests. ... You will need to install Homebrew, Node.js and...
Read more >Running E2E tests on EAS Build - Expo Documentation
jest (or mocha ) is required because detox does not have its own test-runner. Terminal. # Install jest & detox. - npm install...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the exactly same issue, but using Bitrise CI.
I can find the device via
adb -s emulator-5554 emu avd name
But when running the
I have the issue:
Everyone facing this issue - please follow the suggestion of bundling the installation of the apk (or any other APK) in your buildscripts, prior to Detox, and see whether that works.
@RohovDmytro since in your case the command terminates with a
SIGTERM
, I postulate that github-actions doesn’t approve of something happening in your environment, and therefore terminates the command prematurely. Since you mentioned 45 seconds, I would guess an enforcement of a timeout of some sort.