Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

[TRACKING] Tests #68

Open
crutchcorn opened this issue Jan 20, 2021 · 5 comments
Open

[TRACKING] Tests #68

crutchcorn opened this issue Jan 20, 2021 · 5 comments

Comments

@crutchcorn
Copy link
Member

https://cavy.app/

(this issue is intentionally left sparse - will revisit soon with much more details)

@crutchcorn
Copy link
Member Author

@crutchcorn
Copy link
Member Author

@crutchcorn
Copy link
Member Author

I realize I haven't updated this issue much, even though I've had a great deal of work poured into this.

We have a basis in the e2e branch setup for Detox. However, despite following the guide as closely as I can, we seem to continue hitting errors

However, I've been invited to the private Wix OSS Slack. The following is initial discussions:

Me:

I'm running into issues getting Detox running in debug mode.
I have the following command to build:
cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..
Then trying to run detox test --configuration android.emu.debug, I get the "cannot connect" screen from React Native
If I try to solve this using yarn start in a different terminal tab, the tests simply don't run and continually wait eternally

Me:

detox[3124] DEBUG: [exec.js/SPAWN_CMD, #27] [pid=20728] C:\Users\crutchcorn\AppData\Local\Android\Sdk\platform-tools\adb.EXE -s emulator-10142 shell am instrument -w -r -e detoxServer ws://localhost:64255 -e detoxSessionId e9b56b59-fa29-86eb-9333-25216c952305 -e debug false dev.oceanbit.gitshark.test/androidx.test.runner.AndroidJUnitRunner
detox[3124] DEBUG: [exec.js/EXEC_CMD, #28] "C:\Users\crutchcorn\AppData\Local\Android\Sdk\platform-tools\adb.EXE" -s emulator-10142 shell "ps | grep \"dev\.oceanbit\.gitshark$\""
detox[3124] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=app not connected, cannot fw action (sessionId=e9b56b59-fa29-86eb-9333-25216c952305)
detox[3124] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=app not connected, cannot fw action (sessionId=e9b56b59-fa29-86eb-9333-25216c952305)
detox[3124] INFO:  Example: should have welcome screen
detox[3124] INFO:  Example: should have welcome screen [FAIL]
detox[3124] INFO:  Example: should show hello screen after tap
detox[3124] INFO:  Example: should show hello screen after tap [FAIL]
detox[3124] INFO:  Example: should show world screen after tap
detox[3124] INFO:  Example: should show world screen after tap [FAIL]
detox[3124] WARN:  [Client.js/PENDING_REQUESTS] App has not responded to the network requests below:
  (id = -1000) isReady: {}
Unresponded network requests might result in timeout errors in Detox tests.
detox[3124] DEBUG: [exec.js/KILL] sending SIGINT to [pid = 20728]: C:\Users\crutchcorn\AppData\Local\Android\Sdk\platform-tools\adb.EXE -s emulator-10142 shell am instrument -w -r -e detoxServer ws://localhost:64255 -e detoxSessionId e9b56b59-fa29-86eb-9333-25216c952305 -e debug false dev.oceanbit.gitshark.test/androidx.test.runner.AndroidJUnitRunner
detox[3124] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=e9b56b59-fa29-86eb-9333-25216c952305
detox[3124] DEBUG: [exec.js/KILL] sending SIGINT to [pid = 20728]: C:\Users\crutchcorn\AppData\Local\Android\Sdk\platform-tools\adb.EXE -s emulator-10142 shell am instrument -w -r -e detoxServer ws://localhost:64255 -e detoxSessionId e9b56b59-fa29-86eb-9333-25216c952305 -e debug false dev.oceanbit.gitshark.test/androidx.test.runner.AndroidJUnitRunner
detox[3124] DEBUG: [exec.js/EXEC_CMD, #29] "C:\Users\crutchcorn\AppData\Local\Android\Sdk\platform-tools\adb.EXE" -s emulator-10142 reverse --remove tcp:64255
detox[3124] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
 FAIL  e2e/firstTest.e2e.js (146.801 s)
  Example
    × should have welcome screen (1 ms)
    × should show hello screen after tap (1 ms)
    × should show world screen after tap
  ● Example › should have welcome screen
    thrown: "Exceeded timeout of 120000 ms for a hook.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
      1 | describe('Example', () => {
    > 2 |   beforeAll(async () => {
        |   ^
      3 |     await device.launchApp();
      4 |   });
      5 |
      at firstTest.e2e.js:2:3
      at Object.<anonymous> (firstTest.e2e.js:1:1)

This is the output that logging had

Me:

https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#problem-the-app-loads-but-tests-fail-to-start-in-sdk--28
This seems like it's being discussed here, but I've already applied the fix here:

d4vidi:

could you try to double check that you’re using that latest Detox version? If so, please first try to increase the timeout: there are a few ways to do that, the easiest would be using jest.setTimeout()(ref). Then, run detox test alongside the --debug-synchronization 3000 arg

Then, later, d4vidi again:

I’m inclined to say that what you’re lacking is the famous RN port reversal trick

In a top-level beforeAll (namely, before the app is launched), try to add this:
device.reverseTcpPort(8081);
Ref: https://github.com/wix/Detox/blob/master/docs/APIRef.DeviceObjectAPI.md#devicereversetcpport-android-only

Unfortunately, my desktop broke for the better part of a month before I had the opportunity to test d4vidi's suggestions

@crutchcorn
Copy link
Member Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant