Detox: Detox timeout of 120000ms exceeded. at before all hook

Description

I know this issue is out there asked at several pages, but still I am unable to resolve it Detox timeout of 120000ms exceeded. at before all hook, I already asked for the same in stack-overflow here which after an initial comment was never responded back again.

Steps to Reproduce

Created a sample react-native project using expo create-react-native-app awesome(which can be anything) placed the latest expo.app in bin as my iOS config is:

“detox”: { “configurations”: { “ios.sim”: { “binaryPath”: “bin/Exponent.app”, “type”: “ios.simulator”, “name”: “iPhone 7” } }, “test-runner”: “mocha” },

running with the script

"e2e": "detox test --loglevel verbose --configuration ios.sim  --debug-synchronization 1000"

my test.js has:

const { reloadApp } = require('detox-expo-helpers');
  describe('Mobile Test', () => {
  before(async () => {
    await reloadApp();
  });
  it('should have welcome screen', async () => {
    await waitFor(element(by.id('welcome'))).toBeVisible().withTimeout(1000);
    await expect(element(by.id('welcome'))).toBeVisible();
  });

Also, placed the testID in app.js (tried attaching the testID to both parent view and child text which did not help)

<View style={styles.container} testID='welcome'>
       <Text >Open up App.js to start working on your app!</Text>
</View>

I am using the following environment libraries:

DevDependencies:

* "@babel/core": "^7.0.0-beta.54",
* "detox": "^8.0.0",
* "detox-expo-helpers": "^0.2.0",
* "jest-expo": "~27.0.0",
* "mocha": "^5.2.0",
* "react-native-scripts": "^1.14.1",
* "react-test-renderer": "16.3.1"

Dependencies:

*Expo: "^28.0.0",
*React: "16.3.1",
*React-Native: "^0.55.4"
* Node: 8.11.3
* Device: iphone 7 vs 11.2
* Xcode: 9.2
* macOS: macOS Sierra vs 10.12.6. 

I wasn’t even able to find the element i.e the test fails/timeouts on the before all hook,

though I am able to see the simulator show the welcome message

But the same works in a lower versions of detox, expo, react-native

i.e. if using Detox: 7.2.0, expo: 25.0.0, react-native:0.52.0 it works perfectly and am able to write different test cases. So,

  1. I wish to know is there any compatibility matrix of the version dependencies of Detox with expo, react-native. If not, could you please upload/update it somewhere in documentation.
  2. Is there something I am missing in setup of detox with expo other than as stated in here(P.S: I know it was an outdated repo, but I can’t figure out something working other than using it as a base project for setup along with detox-expo-helpers repo)
  3. Also, the latest documentation doesn’t have anything related to Detox Expo setup for android, is it down the line or should we figure it out with few attempts of our own

Device and verbose Detox logs

The verbose detox logs along with debug-synchronization logs are in this doc: (P.S: I didn’t find any synchronization log entries though) DetoxVerboselogs.docx

The device logs are in this text file: debug.txt and console log entries are here: consoleEntries.docx

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 31 (4 by maintainers)

Most upvoted comments

I am seeing the same issue, I have been using detox for a year now, I upgraded from 7.4.0 to 8.2.3 and when I run tests, detox starts the simulator and opens the app but does not run any tests and after a while the tests are terminated with the “Timeout of 520000ms exceeded” error. below are full logs

RN: 0.56.0 node: v8.8.1 detox: 8.2.3

junaid (feature/e2e-upgrade-detox *) mobile $ yarn e2e --loglevel verbose
yarn run v1.5.1
$ detox test --configuration ios.sim.debug --loglevel verbose
node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration ios.sim.debug --loglevel verbose     --grep :android: --invert     --artifacts-location "artifacts/ios.sim.debug.2018-08-30 04-30-33Z"


detox[62213] INFO:  [DetoxServer.js] server listening on localhost:55584...
detox[62213] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:55584
detox[62213] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=19bcd4d2-18c7-f9ad-8c5d-4f9217c8da07
detox[62213] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=19bcd4d2-18c7-f9ad-8c5d-4f9217c8da07
detox[62213] DEBUG: [exec.js/EXEC_CMD, #0] /usr/bin/xcrun simctl list -j
detox[62213] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byType "iPhone X" --byOS "11.4"
detox[62213] DEBUG: [exec.js/EXEC_TRY, #1] Searching for device matching iPhone X...
detox[62213] DEBUG: [exec.js/EXEC_CMD, #2] applesimutils --list --byId "E1C13550-7FFD-46AB-ACEF-9F9DAB9A7D8F"
detox[62213] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl uninstall E1C13550-7FFD-46AB-ACEF-9F9DAB9A7D8F com.homepass.consumer
detox[62213] DEBUG: [exec.js/EXEC_TRY, #3] Uninstalling com.homepass.consumer...
detox[62213] DEBUG: [exec.js/EXEC_SUCCESS, #3] com.homepass.consumer uninstalled
detox[62213] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl install E1C13550-7FFD-46AB-ACEF-9F9DAB9A7D8F "/Users/junaid/homepass-nxt/mobile/ios/build/Build/Products/Debug-iphonesimulator/Homepass.app"
detox[62213] DEBUG: [exec.js/EXEC_TRY, #4] Installing /Users/junaid/homepass-nxt/mobile/ios/build/Build/Products/Debug-iphonesimulator/Homepass.app...
detox[62213] DEBUG: [exec.js/EXEC_SUCCESS, #4] /Users/junaid/homepass-nxt/mobile/ios/build/Build/Products/Debug-iphonesimulator/Homepass.app installed
detox[62213] DEBUG: [exec.js/EXEC_CMD, #5] applesimutils --simulator E1C13550-7FFD-46AB-ACEF-9F9DAB9A7D8F --bundle com.homepass.consumer --setPermissions notifications=YES,location=always
detox[62213] DEBUG: [exec.js/EXEC_TRY, #5] Trying to set permissions...
detox[62213] DEBUG: [exec.js/EXEC_SUCCESS, #5] Permissions are set
detox[62213] DEBUG: [exec.js/EXEC_CMD, #6] /bin/cat /dev/null >/Users/junaid/Library/Developer/CoreSimulator/Devices/E1C13550-7FFD-46AB-ACEF-9F9DAB9A7D8F/data/tmp/detox.last_launch_app_log.out 2>/Users/junaid/Library/Developer/CoreSimulator/Devices/E1C13550-7FFD-46AB-ACEF-9F9DAB9A7D8F/data/tmp/detox.last_launch_app_log.err && SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/junaid/Library/Detox/ios/9b1cf119d6b7b0d2bb09a9e8c56ad526925d9c30/Detox.framework/Detox" /usr/bin/xcrun simctl launch --stdout=/tmp/detox.last_launch_app_log.out --stderr=/tmp/detox.last_launch_app_log.err E1C13550-7FFD-46AB-ACEF-9F9DAB9A7D8F com.homepass.consumer --args -detoxServer ws://localhost:55584 -detoxSessionId 19bcd4d2-18c7-f9ad-8c5d-4f9217c8da07
detox[62213] DEBUG: [exec.js/EXEC_TRY, #6] Launching com.homepass.consumer...
detox[62213] DEBUG: [exec.js/EXEC_SUCCESS, #6] com.homepass.consumer launched. The stdout and stderr logs were recreated, you can watch them with:
        tail -F /Users/junaid/Library/Developer/CoreSimulator/Devices/E1C13550-7FFD-46AB-ACEF-9F9DAB9A7D8F/data/tmp/detox.last_launch_app_log.{out,err}
detox[62213] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=19bcd4d2-18c7-f9ad-8c5d-4f9217c8da07)
detox[62213] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=19bcd4d2-18c7-f9ad-8c5d-4f9217c8da07
detox[62213] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=19bcd4d2-18c7-f9ad-8c5d-4f9217c8da07
  1) "before all" hook
Physical footprint (peak) 418.5M


  0 passing (9m)
  1 failing

  1) "before all" hook:
     Error: Timeout of 520000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.




child_process.js:641
    throw err;
    ^

Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration ios.sim.debug --loglevel verbose     --grep :android: --invert     --artifacts-location "artifacts/ios.sim.debug.2018-08-30 04-30-33Z"
    at checkExecSyncError (child_process.js:598:13)
    at Object.execSync (child_process.js:638:13)
    at runMocha (/Users/junaid/homepass-nxt/mobile/node_modules/detox/local-cli/detox-test.js:129:6)
    at run (/Users/junaid/homepass-nxt/mobile/node_modules/detox/local-cli/detox-test.js:82:7)
    at Object.<anonymous> (/Users/junaid/homepass-nxt/mobile/node_modules/detox/local-cli/detox-test.js:217:1)
    at Module._compile (module.js:612:30)
    at Object.Module._extensions..js (module.js:623:10)
    at Module.load (module.js:531:32)
    at tryModuleLoad (module.js:494:12)
    at Function.Module._load (module.js:486:3)
error An unexpected error occurred: "Command failed.

Expo support is and will only be supported by the community. Compatibility matrix can be accepted as an addition to docs if someone can research submits a PR. This however will only be can only be supported by the community as we are not using Expo internally.

If you have issues with a project that you want help with please submit verbose log, and device logs. We will never be able to guess the problem. If the issue arises on a new project from template this is great news, create a demo project with a simple, compilable abd repeoducable bug, and link it in the issue.

Remember, https://twitter.com/mweststrate/status/1012405297795813376?s=09