Detox: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected

Describe the bug I have Detox tests successfully being built and running on an iOS Simulator. I have Detox successfully building for Android, but when attempting to run the tests, I see the app launch and then error because the DetoxServer is unable to forward. The test shows it is unassigned.

To Reproduce

  • [ X] I have tested this issue on the latest Detox release and it still reproduces

Running the following command: yarn run detox test -c android.emu.release --loglevel trace

Environment (please complete the following information):

  • Detox: ^14.5.1
  • React Native: 0.60.5
  • Node: ^8.3 || >=10.*
  • Device: emulator-15018 device
  • OS: API 28

Device and Verbose Detox Logs

detox[70981] DEBUG: [exec.js/EXEC_CMD, #17] /Users/mvd/Library/Android/sdk/platform-tools/adb -s emulator-15018 shell "ps | grep \"com\.app_name\.app$\""
detox[70981] TRACE: [exec.js/EXEC_SUCCESS, #17] u0_a106      29575  1934 1452728 123920 0                   0 S com.app_name.app

detox[29575] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onLaunchApp({ deviceId: 'emulator-15018',
  bundleId: 'com.app_name.app',
  launchArgs:
   { detoxServer: 'ws://localhost:50780',
     detoxSessionId: 'beebae37-5672-7400-eb92-e9f14ad9b594' },
  pid: 29575 })
detox[70981] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"isReady","params":{},"messageId":-1000}
detox[70981] TRACE: [DetoxServer.js/MESSAGE] role=tester action=isReady (sessionId=beebae37-5672-7400-eb92-e9f14ad9b594)
detox[70981] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=beebae37-5672-7400-eb92-e9f14ad9b594)
A test to validate the Login page assigned to undefined

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 12
  • Comments: 19 (1 by maintainers)

Most upvoted comments

@fancychimp I tried a lot of things, but I think what fixed it for me was setting android/build.gradle with this:

buildscript {
    ext {
        targetSdkVersion = 27
    }
}

and then using an emulator on sdk/api 27.

The solution mentioned here: https://github.com/wix/Detox/issues/1743#issuecomment-573647070 solved the issue for me.

I’m experiencing the same issue in debug mode. targetSdkVersion = 27 does not work for me. App launches but never kicks off the tests. I have a whole suite running for iOS without any issues.

detox[33244] TRACE: [DetoxServer.js/MESSAGE] role=tester action=isReady (sessionId=8dbde982-d961-7cb0-4ee8-fcb5ee9c3b46)
detox[33244] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=8dbde982-d961-7cb0-4ee8-fcb5ee9c3b46)
detox[33244] TRACE: [exec.js/SPAWN_STDOUT, #16] INSTRUMENTATION_STATUS: class=za.co.yoco.DetoxTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner

detox[33244] TRACE: [exec.js/SPAWN_STDOUT, #16] INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stack=java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=za.co.yoco/.MainActivity (has extras) } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1574780302720 and now the last time the queue went idle was: 1574780302720. If these numbers are the same your activity might be hogging the event queue.
	at androidx.test.runner.MonitoringInstrumentation.startActivitySync(MonitoringInstrumentation.java:481)
	at androidx.test.rule.ActivityTestRule.launchActivity(ActivityTestRule.java:358)
	at com.wix.detox.Detox.runTests(Detox.java:117)
	at com.wix.detox.Detox.runTests(Detox.java:93)
	at za.co.yoco.DetoxTest.runDetoxTests(DetoxTest.java:22)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at androidx.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:531)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:104)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
	at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:392)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2075)```

any ideas what's going on here?