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:

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

Most upvoted comments

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 in componentDidMount. When wrapped in a 1ms setTimout it works as expected.