Detox: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected
Describe the bug We’re unable to run detox tests on android. We have detox building and running successfully on iOS. On android detox builds successfully, installs on the emulator, launches on the emulator, the app then closes, and the tests eventually times out with the below logs. We’ve tried debug and release mode.
We’ve tried all workarounds on the following threads:
- https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#problem-the-app-loads-but-tests-fail-to-start-in-sdk--28
- https://github.com/wix/Detox/issues/1716
- https://github.com/facebook/react-native/issues/27010
- https://github.com/wix/Detox/issues/1743
- https://github.com/wix/Detox/blob/master/docs/Introduction.AndroidEmulatorsBestPractices.md#setting-up-android-emulators-best-practices
To Reproduce
- I have tested this issue on the latest Detox release and it still reproduces
Steps to reproduce:
Run the following command: yarn run detox test -c android.emu.debug --loglevel trace
Run the following command: yarn run detox test -c android.emu.release --loglevel trace
Expected behavior The test should kick off after the app launches
Device and Verbose Detox Logs logs attached detox_pid_6340.json.log detox_pid_6340.log emulator-5554 2020-03-12 12-18-05Z.startup.log
Environment (please complete the following information):
- Detox: 15.5.0
- React Native: 0.61.5
- Node: 8.16.0
- Device: Pixel_API_27, Pixel_2_API_28, Pixel_3_API_29 emulators
- OS: MacOS 10.14.6
- Test-runner (select one): Jest
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 19
Just an update on my project (with reference to @d4vidi answer above) that I was successfully able to detect the call made to the backend and was essentially holding the unit tests. Resolving the fetch (either manual timeout or promise race) fixes the issue. I am using waitFor(…) function in unit tests.
Thanks again for the library !
I had an issue with the same symptoms. Detox: 16.2.0 React Native: 0.62.2
Like @amirmatin, I tried commenting stuff in
App.js
and got it to work eventually. Then I put the stuff back until it no longer worked.For me it was calling
AppState.addEventListener('change', ...)
directly incomponentDidMount
. When wrapped in a 1mssetTimout
it works as expected.