wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.14k stars 1.92k forks source link

iOS simulator app doesn't launch when 'detox test' command executed #2305

Closed bryanboyko closed 3 years ago

bryanboyko commented 4 years ago

Description

iOS simulator app doesn't launch when 'detox test' command executed

Detox --loglevel verbose output shows [DetoxServer.js/CANNOT_FORWARD]

Reproduction

Detox tests were last running in April with the following setup

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "jest"
  },
  "dependencies": {
    "expo": "^37.0.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz",
  },
  "devDependencies": {
    "detox": "^15.3.0",
    "detox-expo-helpers": "^0.6.0",
    "expo-detox-hook": "^1.0.10",
    "jest-expo": "^37.0.0",
    "metro-react-native-babel-preset": "^0.53.1",
    "react-native-testing-library": "^1.12.0",
    "react-test-renderer": "^16.12.0",
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|@sentry/.*|sentry-expo|native-base|react-native-multi-slider|@ptomasroos/.*)"
    ],
    "setupFilesAfterEnv": [
      "<rootDir>/unit_tests/setupTests.js"
    ],
    "testMatch": [
      "<rootDir>/unit_tests/**/*.test.js?(x)"
    ]
  },
  "detox": {
    "test-runner": "jest",
    "configurations": {
      "ios.sim": {
        "binaryPath": "<app_name>.app",
        "type": "ios.simulator",
        "name": "iPhone 11 Pro Max"
      }
    }
  }
}

They are now failing as described above with the following package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "jest"
  },
  "dependencies": {
    "expo": "^37.0.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz",
  },
  "devDependencies": {
    "detox": "^17.4.5",
    "detox-expo-helpers": "^0.6.0",
    "expo-detox-hook": "^1.0.10",
    "jest-expo": "^37.0.0",
"metro-react-native-babel-preset": "^0.53.1",
    "react-native-testing-library": "^1.12.0",
    "react-test-renderer": "^16.12.0",
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community/async-storage/.*|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|@sentry/.*|sentry-expo|native-base|react-native-multi-slider|@ptomasroos/.*)"
    ],
    "setupFilesAfterEnv": [
      "<rootDir>/unit_tests/setupTests.js"
    ],
    "testMatch": [
      "<rootDir>/unit_tests/**/*.test.js?(x)"
    ]
  },
  "detox": {
    "test-runner": "jest",
    "configurations": {
      "ios.sim": {
        "binaryPath": "<app_name>.app",
        "type": "ios.simulator",
        "name": "iPhone 11 Pro Max"
      }
    }
  }
}

Expected behavior

Running detox test should open the app in the simulator and execute tests.

Environment (please complete the following information):

Logs

If you are experiencing a timeout in your test

Tried running detox test --debug-synchronization 200

the terminal hangs with the following output

detox[16107] INFO:  [test.js] debugSynchronization=200 reportSpecs=true useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1599257790958 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 e2e
detox[16109] INFO:  at e2e/tests/Auth/login.spec.js:11:11 
 describe(Auth)
detox[16109] INFO:  at e2e/init.js:21:19 
 beforeAll
detox[16109] INFO:  [DetoxServer.js] server listening on localhost:62081...
detox[16109] INFO:  at e2e/init.js:28:19 
 initialized

 RUNS  e2e/tests/Auth/login.spec.js

Tried adding ‘detoxPrintBusyIdleResources’

terminal hangs with output ‘Filtering the log data using "category == "EarlGreyStatistics””’

Try adding ‘disableSynchroniztion’.

After running detox test, the test code seems to stall at ‘await device.disableSynchronization’ (a console log is never called on the next line of code)

Device and verbose Detox logs

detox[15678] INFO:  [test.js] configuration="ios.sim" loglevel="verbose" cleanup=true reportSpecs=true useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1599256657224 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 e2e
detox[15680] INFO:  at e2e/tests/Auth/login.spec.js:11:11 
 describe(Auth)
detox[15680] INFO:  at e2e/init.js:21:19 
 beforeAll
detox[15680] INFO:  [DetoxServer.js] server listening on localhost:61596...
detox[15680] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:61596
detox[15680] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [exec.js/EXEC_CMD, #0] applesimutils --list --byType "iPhone 11 Pro Max"
detox[15680] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byId 0BABC374-4903-4E95-A1CB-C265C656F1D6 --maxResults 1
detox[15680] DEBUG: [exec.js/EXEC_CMD, #2] /usr/bin/xcrun simctl uninstall 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID]
detox[15680] DEBUG: [exec.js/EXEC_TRY, #2] Uninstalling [BUNDLE_ID]...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS, #2] [BUNDLE_ID] uninstalled
detox[15680] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl install 0BABC374-4903-4E95-A1CB-C265C656F1D6 "/Users/bryanboyko/XCode/<app_name>.app"
detox[15680] DEBUG: [exec.js/EXEC_TRY, #3] Installing /Users/bryanboyko/XCode/<app_name>.app...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS, #3] /Users/bryanboyko/XCode/<app_name>.app installed
detox[15680] INFO:  at e2e/init.js:28:19 
 initialized
detox[15680] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773)
detox[15680] INFO:  Auth: should show main feed after manual login
detox[15680] INFO:  at e2e/init.js:57:19 
 before each
detox[15680] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl terminate 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID]
detox[15680] DEBUG: [exec.js/EXEC_TRY, #4] Terminating [BUNDLE_ID]...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS, #4] [BUNDLE_ID] terminated
detox[15680] DEBUG: [exec.js/EXEC_CMD, #5] applesimutils --byId 0BABC374-4903-4E95-A1CB-C265C656F1D6 --bundle [BUNDLE_ID] --restartSB --setPermissions location=inuse,notifications=YES
detox[15680] DEBUG: [exec.js/EXEC_TRY, #5] Trying to set permissions...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS, #5] Permissions are set
detox[15680] DEBUG: [exec.js/EXEC_CMD, #6] SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/bryanboyko/Library/ExpoDetoxHook/ios/58b2f26a0f87b2136ea15b6c467bcf04a21fd6e7/ExpoDetoxHook.framework/ExpoDetoxHook:/Users/bryanboyko/Library/Detox/ios/26afbf8d93760131ef9f1ae830bc7169ba83b8b0/Detox.framework/Detox" /usr/bin/xcrun simctl launch 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID] --args -detoxServer "ws://localhost:61596" -detoxSessionId "25a0b4f5-f767-48a9-1a95-ca18b51c4773" -EXKernelDisableNuxDefaultsKey "true" -detoxURLBlacklistRegex "\("http://192.168.1.19:19001/onchange","https://e.crashlytics.com/spi/v2/events"\)" -detoxURLOverride "exp://192.168.1.19:19000" -detoxSourceAppOverride "host.exp.exponent"
detox[15680] DEBUG: [exec.js/EXEC_TRY, #6] Launching [BUNDLE_ID]...
detox[15680] DEBUG: [exec.js/EXEC_CMD, #7] /usr/bin/xcrun simctl get_app_container 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID]
detox[15680] INFO:  [AppleSimUtils.js] [BUNDLE_ID] launched. To watch simulator logs, run:
        /usr/bin/xcrun simctl spawn 0BABC374-4903-4E95-A1CB-C265C656F1D6 log stream --level debug --style compact --predicate 'process == "[BUNDLE_ID]"'
detox[15680] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773)
detox[15680] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] INFO:  at e2e/tests/Auth/login.spec.js:37:21 
 1st test
detox[15680] INFO:  Auth: should show main feed after manual login [FAIL]

detox[15680] INFO:  at e2e/init.js:73:19 
 after all
detox[15680] WARN:  [Client.js/PENDING_REQUESTS] App has not responded to the network requests below:
  (id = 1) setSyncSettings: {"enabled":false}
  (id = 2) invoke: {"type":"expectation","predicate":{"type":"id","value":"LOGIN_VIEW"},"expectation":"toBeVisible"}
  (id = -1000) isReady: {}

That might be the reason why the test "Auth should show main feed after manual login" has timed out.

detox[15680] DEBUG: [exec.js/EXEC_CMD, #8] /usr/bin/xcrun simctl shutdown 0BABC374-4903-4E95-A1CB-C265C656F1D6
detox[15680] DEBUG: [exec.js/EXEC_TRY, #8] Shutting down 0BABC374-4903-4E95-A1CB-C265C656F1D6...
detox[15680] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [DetoxServer.js/DISCONNECT] role=testee, sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=tester not connected, cannot fw action (sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773)
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS, #8] 0BABC374-4903-4E95-A1CB-C265C656F1D6 shut down
detox[15680] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
 FAIL  e2e/tests/Auth/login.spec.js (547.778s)
  Auth
    ✕ should show main feed after manual login (240426ms)

  ● Auth › should show main feed after manual login

    Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.

      at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:25:45)

  ● Auth › should show main feed after manual login

    Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.

      at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:25:45)

  ● Auth › should show main feed after manual login

    : Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.

      30 | 
[private login info]
      34 | 
      35 |     // DOUBLE TAP LOGIN BUTTON

      at new Spec (../node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
      at Suite.<anonymous> (tests/Auth/login.spec.js:32:3)
      at Object.<anonymous> (tests/Auth/login.spec.js:10:1)

detox[15680] INFO:  at e2e/init.js:21:19 
 beforeAll
detox[15680] INFO:  [DetoxServer.js] server listening on localhost:61703...
detox[15680] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:61703
detox[15680] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=d7d6ad2d-d095-81b0-7955-6b83885362a3
detox[15680] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=d7d6ad2d-d095-81b0-7955-6b83885362a3
detox[15680] DEBUG: [exec.js/EXEC_CMD, #0] applesimutils --list --byType "iPhone 11 Pro Max"
detox[15680] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byId 0BABC374-4903-4E95-A1CB-C265C656F1D6 --maxResults 1
detox[15680] DEBUG: [exec.js/EXEC_CMD, #2] /usr/bin/xcrun simctl boot 0BABC374-4903-4E95-A1CB-C265C656F1D6 
detox[15680] DEBUG: [exec.js/EXEC_TRY, #2] Booting device 0BABC374-4903-4E95-A1CB-C265C656F1D6...
detox[15680] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl bootstatus 0BABC374-4903-4E95-A1CB-C265C656F1D6
detox[15680] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl io 0BABC374-4903-4E95-A1CB-C265C656F1D6 screenshot "/dev/null"
detox[15680] DEBUG: [exec.js/EXEC_CMD, #5] /usr/bin/xcrun simctl uninstall 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID]
detox[15680] DEBUG: [exec.js/EXEC_TRY, #5] Uninstalling [BUNDLE_ID]...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS, #5] [BUNDLE_ID] uninstalled
detox[15680] DEBUG: [exec.js/EXEC_CMD, #6] /usr/bin/xcrun simctl install 0BABC374-4903-4E95-A1CB-C265C656F1D6 "/Users/bryanboyko/XCode/<app_name>.app"
detox[15680] DEBUG: [exec.js/EXEC_TRY, #6] Installing /Users/bryanboyko/XCode/<app_name>.app...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS, #6] /Users/bryanboyko/XCode/<app_name>.app installed
detox[15680] INFO:  at e2e/init.js:28:19 
 initialized
detox[15680] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=d7d6ad2d-d095-81b0-7955-6b83885362a3)

 RUNS  e2e/tests/Auth/registration.spec.js
LeoNatan commented 4 years ago

Manually launch the Simulator app from Xcode and see what happens on screen.

bryanboyko commented 4 years ago

We're using expo, so our app isn't launched from XCode. We get a .app and then install on a sim from command line. Like so:

xcrun simctl install booted <APP_NAME> xcrun simctl launch booted <BUNDLE_ID>

Running xcrun simctl launch booted <BUNDLE_ID> from terminal launches the app on the simulator as expected

LeoNatan commented 4 years ago

I didn't say "launch your app from Xcode", I said launch the Simulator app from Xcode. Your first line of the issue says "iOS simulator app doesn't launch when 'detox test' command executed". When Detox boots a simulator runtime without the Simulator app running, you won't see what's going on. So launch the Simulator app, then start your test from Detox and see what happens.

Expo has had many issues with Detox in the past. I fear we can't assist if this is an Expo issue.

bryanboyko commented 4 years ago

Sorry my mistake. I meant that when the simulator app is open, running detox test installs our app successfully onto the simulator, but then doesn't launch our app in the simulator.

Starting a simulator from XCode and then running detox test has the same result. Our app installs on the simulator app but fails to launch.

In this case it may not be an expo issue because we create a complete build of our app for the simulator, .app, as opposed to using the Exponent.app machanism, and then manually install it on a simulator.

This method for getting a .app and then running detox tests with it was working a number of months ago.

LeoNatan commented 4 years ago

So, just to make sure, the doesn’t launch at all? Or does it launch and then closes right away? After the app installs and tests fail, does the app launch correctly when you tap the icon in the simulator?

bryanboyko commented 4 years ago

The app doesn't launch at all.

If I run detox test with the simulator open and our app not open, wait 10-20 while the test is hanging, and then click to open our app, our app opens normally.

If I run `detox test with the simulator open and our app not open, and wait 6 minutes (not sure if this consistently takes so long, but I waited it out a couple times), the app launches and then the tests timeout after another few minutes.

detox[20460] INFO:  [test.js] configuration="ios.sim" loglevel="verbose" cleanup=true reportSpecs=true useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1599366363582 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 e2e
detox[20463] INFO:  at e2e/init.js:21:19 
 beforeAll
detox[20463] INFO:  [DetoxServer.js] server listening on localhost:63789...
detox[20463] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:63789
detox[20463] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=1c32ee9a-9894-9909-9124-afa74eab1a14
detox[20463] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=1c32ee9a-9894-9909-9124-afa74eab1a14
detox[20463] DEBUG: [exec.js/EXEC_CMD, #0] applesimutils --list --byType "iPhone 11 Pro Max"
detox[20463] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byId 0BABC374-4903-4E95-A1CB-C265C656F1D6 --maxResults 1
detox[20463] DEBUG: [exec.js/EXEC_CMD, #2] /usr/bin/xcrun simctl uninstall 0BABC374-4903-4E95-A1CB-C265C656F1D6 com.p9alabs.redpoint
detox[20463] DEBUG: [exec.js/EXEC_TRY, #2] Uninstalling com.p9alabs.redpoint...
detox[20463] DEBUG: [exec.js/EXEC_SUCCESS, #2] com.p9alabs.redpoint uninstalled
detox[20463] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl install 0BABC374-4903-4E95-A1CB-C265C656F1D6 "/Users/bryanboyko/XCode/Project9A/redpoint_client/redpoint.app"
detox[20463] DEBUG: [exec.js/EXEC_TRY, #3] Installing /Users/bryanboyko/XCode/Project9A/redpoint_client/redpoint.app...
detox[20463] DEBUG: [exec.js/EXEC_SUCCESS, #3] /Users/bryanboyko/XCode/Project9A/redpoint_client/redpoint.app installed
detox[20463] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=1c32ee9a-9894-9909-9124-afa74eab1a14)
detox[20463] INFO:  Auth: should show register view when sign up button pressed
detox[20463] INFO:  at e2e/init.js:61:19 
 before each
detox[20463] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl terminate 0BABC374-4903-4E95-A1CB-C265C656F1D6 com.p9alabs.redpoint
detox[20463] DEBUG: [exec.js/EXEC_TRY, #4] Terminating com.p9alabs.redpoint...
detox[20463] DEBUG: [exec.js/EXEC_SUCCESS, #4] com.p9alabs.redpoint terminated
detox[20463] DEBUG: [exec.js/EXEC_CMD, #5] applesimutils --byId 0BABC374-4903-4E95-A1CB-C265C656F1D6 --bundle com.p9alabs.redpoint --restartSB --setPermissions location=inuse,notifications=YES
detox[20463] DEBUG: [exec.js/EXEC_TRY, #5] Trying to set permissions...
detox[20463] DEBUG: [exec.js/EXEC_SUCCESS, #5] Permissions are set
detox[20463] DEBUG: [exec.js/EXEC_CMD, #6] SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/bryanboyko/Library/ExpoDetoxHook/ios/58b2f26a0f87b2136ea15b6c467bcf04a21fd6e7/ExpoDetoxHook.framework/ExpoDetoxHook:/Users/bryanboyko/Library/Detox/ios/26afbf8d93760131ef9f1ae830bc7169ba83b8b0/Detox.framework/Detox" /usr/bin/xcrun simctl launch 0BABC374-4903-4E95-A1CB-C265C656F1D6 com.p9alabs.redpoint --args -detoxServer "ws://localhost:63789" -detoxSessionId "1c32ee9a-9894-9909-9124-afa74eab1a14" -EXKernelDisableNuxDefaultsKey "true" -detoxURLBlacklistRegex "\("http://192.168.0.186:19001/onchange","https://e.crashlytics.com/spi/v2/events"\)" -detoxURLOverride "exp://192.168.0.186:19000" -detoxSourceAppOverride "host.exp.exponent"
detox[20463] DEBUG: [exec.js/EXEC_TRY, #6] Launching com.p9alabs.redpoint...
detox[20463] DEBUG: [exec.js/EXEC_CMD, #7] /usr/bin/xcrun simctl get_app_container 0BABC374-4903-4E95-A1CB-C265C656F1D6 com.p9alabs.redpoint
detox[20463] INFO:  [AppleSimUtils.js] com.p9alabs.redpoint launched. To watch simulator logs, run:
        /usr/bin/xcrun simctl spawn 0BABC374-4903-4E95-A1CB-C265C656F1D6 log stream --level debug --style compact --predicate 'process == "ComP9alabsRedpoint"'
detox[20463] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=1c32ee9a-9894-9909-9124-afa74eab1a14)
detox[20463] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=1c32ee9a-9894-9909-9124-afa74eab1a14
detox[20463] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=1c32ee9a-9894-9909-9124-afa74eab1a14
detox[20463] INFO:  Auth: should show register view when sign up button pressed [FAIL]

detox[20463] INFO:  at e2e/init.js:77:19 
 after all
detox[20463] WARN:  [Client.js/PENDING_REQUESTS] App has not responded to the network requests below:
  (id = 1) invoke: {"type":"expectation","predicate":{"type":"id","value":"LOGIN_VIEW"},"expectation":"toBeVisible"}
  (id = -1000) isReady: {}

That might be the reason why the test "Auth should show register view when sign up button pressed" has timed out.

detox[20463] DEBUG: [exec.js/EXEC_CMD, #8] /usr/bin/xcrun simctl shutdown 0BABC374-4903-4E95-A1CB-C265C656F1D6
detox[20463] DEBUG: [exec.js/EXEC_TRY, #8] Shutting down 0BABC374-4903-4E95-A1CB-C265C656F1D6...
detox[20463] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=1c32ee9a-9894-9909-9124-afa74eab1a14
detox[20463] DEBUG: [DetoxServer.js/DISCONNECT] role=testee, sessionId=1c32ee9a-9894-9909-9124-afa74eab1a14
detox[20463] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=tester not connected, cannot fw action (sessionId=1c32ee9a-9894-9909-9124-afa74eab1a14)
detox[20463] DEBUG: [exec.js/EXEC_SUCCESS, #8] 0BABC374-4903-4E95-A1CB-C265C656F1D6 shut down
detox[20463] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
 FAIL  e2e/tests/Auth/registration.spec.js (547.636s)
  Auth
    ✕ should show register view when sign up button pressed (240271ms)

  ● Auth › should show register view when sign up button pressed

    Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.

      at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:25:45)

  ● Auth › should show register view when sign up button pressed

    Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.

      at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:25:45)

  ● Auth › should show register view when sign up button pressed

    : Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.

If I open our app on the sim and then run detox rest, a black screen shows up.

LeoNatan commented 4 years ago

Is there any way you can obtain an Xcode project? We have a guide you can then follow to try to debug.

bryanboyko commented 4 years ago

It may be possible if we eject, but we are trying to avoid that in order to keep the advantages Expo offers in streamlining the development process.

Is there any documentation for debugging detox tests when run directly on a .app?

LeoNatan commented 4 years ago

Can you just temporarily eject so you can debug? If something is crashing very early on, it won't be possible to debug with a precompiled product.

jarnove commented 3 years ago

I have the same problem with a Debug configuration on iOS. I'm not using Expo and a test release build works.

detox[38024] ERROR: [cli.js] Error: Command failed: jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 2 e2e

App has not responded to the network requests below: (id = -1000) isReady: {}

Similar issue on StackOverflow: https://stackoverflow.com/questions/63289061/detox-app-stuck-in-launch-screen-on-ios/64030402#64030402

rossjohnsonMP commented 3 years ago

Same issue also here, release builds work fine but make it very tedious to write tests.

debug builds seem to get stuck synchronising

17.5.3 seems to have broken debug-synchronization, prior to that I got this log:

detox[30240] INFO:  [actions.js] Sync App State: Waiting for network requests to finish: (
    "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false"
)

but I can see from my js server that the request has completed

as a work around I've tried to blacklist localhost but that also doesnt seem to work

  async initDetox() {
    const getDetoxURLBlacklistRegexFromDomains = domains =>
      `(${domains.map(domain => `\\".*${domain}.*\\"`).join(',')})`;

    const detoxURLBlacklistRegex = getDetoxURLBlacklistRegexFromDomains(['localhost']);
    const instance = await this.detox.init(null, { launchApp: false, detoxURLBlacklistRegex });

    await instance.device.launchApp({ detoxEnableSynchronization: 0, detoxURLBlacklistRegex });

    return instance;
  }

launchApp just hangs.

If I then kill the test and launch the app manually it launches fine

treymcmeans commented 3 years ago

+1. I am experiencing the same issue and have tried similar workarounds.

LeoNatan commented 3 years ago

Guys, please follow the “debugging in Xcode” guide to see what’s going on. If you are using Expo and are willing to do this step, we will close the issue. We explicitly do not support Expo because of issues like these.

treymcmeans commented 3 years ago

I will go over the guide now and report back. I'm not using Expo

LeoNatan commented 3 years ago

Thanks

treymcmeans commented 3 years ago

Thanks for pointing me to the Debugging in Xcode article @LeoNatan. After setting a few breakpoints, I was able to find the function that was hanging up the startup process.

Appears that the EarlGrey functions and that one would not cooperate, creating the hang. Ended up creating a new target with a preprocessor macro to skip that part of the startup code. All working now

LeoNatan commented 3 years ago

Can you go into more details please? Was it Earl Grey swizzling? We intend to remove EG completely soon, want to make sure what we use instead has as little swizzling conflicts as possible.

LeoNatan commented 3 years ago

@treymcmeans Your issue is probably not the same issue @bryanboyko has.

"Stuck on launch" is a generic symptom of all issues that cause a start up crash and hang. So anyone having "this" issue, please follow the guide and provide the information.

HackingGate commented 3 years ago

@LeoNatan I ran into the issue "Stuck on launch" after upgrade from v16 to v17.

I followed the “debugging in Xcode” guide. With Detox.framework linked. I can reproduce the issue with a Xcode run.

Here's the log from Xcode console after func webSocket(_ webSocket: WebSocket, didReceiveAction type: String, params: [String : Any], messageId: NSNumber) received "loginSuccess".

2020-10-02 17:36:51.151078+0900 AppSchemeName[40414:654578] [DetoxManager] Successfully logged in
2020-10-02 17:36:52.657521+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.SourceCodeQueue>
2020-10-02 17:36:52.676739+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.BlobModuleQueue>
2020-10-02 17:36:52.682408+0900 AppSchemeName[40414:655204] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.NetworkingQueue>
2020-10-02 17:36:52.732995+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.I18nManagerQueue>
2020-10-02 17:36:52.826523+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.AsyncLocalStorageQueue>
2020-10-02 17:36:52.838085+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.RNDeviceInfoQueue>
2020-10-02 17:36:52.842891+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: RNFetchBlob.queue>
2020-10-02 17:36:52.974540+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.RNFaceDetectorQueue>
2020-10-02 17:36:52.986656+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: pe.lum.rnfs>
2020-10-02 17:36:53.140875+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 2 failure reason: "duration==0"
2020-10-02 17:36:53.156286+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 4 failure reason: "duration>1.5"
2020-10-02 17:36:53.181296+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 9 failure reason: "duration==0"
2020-10-02 17:36:53.181495+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 10 failure reason: "duration==0"
2020-10-02 17:36:53.214837+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.RNCookieManagerIOSQueue>
2020-10-02 17:36:53.271399+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 53 failure reason: "duration>1.5"
2020-10-02 17:36:53.272708+0900 AppSchemeName[40414:655336] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.ImageLoaderQueue>
2020-10-02 17:36:53.272920+0900 AppSchemeName[40414:655336] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.ImageStoreManagerQueue>
2020-10-02 17:36:53.273194+0900 AppSchemeName[40414:655336] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.DataRequestHandlerQueue>
2020-10-02 17:36:53.273406+0900 AppSchemeName[40414:655336] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.FileRequestHandlerQueue>
2020-10-02 17:36:53.273702+0900 AppSchemeName[40414:655336] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.HTTPRequestHandlerQueue>
2020-10-02 17:36:53.274287+0900 AppSchemeName[40414:655336] [ReactNativeSupport] Adding idling resource for network queue: <OS_dispatch_queue_serial: com.apple.NSURLSession-work>
2020-10-02 17:36:53.278011+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 54 failure reason: "duration==0"
2020-10-02 17:36:53.279052+0900 AppSchemeName[40414:654578] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.LocalAssetImageLoaderQueue>
2020-10-02 17:36:53.289167+0900 AppSchemeName[40414:655127] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.GIFImageDecoderQueue>
2020-10-02 17:36:53.371990+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 59 failure reason: "duration==0"
2020-10-02 17:36:53.373182+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 60 failure reason: "duration==0"
2020-10-02 17:36:53.398301+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 61 failure reason: "duration==0"
2020-10-02 17:36:53.399586+0900 AppSchemeName[40414:655198] [ReactNativeSupport] Adding idling resource for queue: <OS_dispatch_queue_serial: com.facebook.react.FileReaderModuleQueue>
2020-10-02 17:36:53.401331+0900 AppSchemeName[40414:655198] [WXJSTimerObservationIdlingResource] Ignoring timer: 72 failure reason: "duration==0"
no-response[bot] commented 3 years ago

This issue has been automatically closed because there has been no response to our request for more information from the original author.

For more information on bots in this reporsitory, read this discussion.

MoeMamdouh commented 3 years ago

I had the same issue in iOS release build event it was working in debug build my current react native version "react-native": "0.61.5"

i fix it by add in info.plist file

<key>NSAllowsArbitraryLoads</key>
<true/>

which is added by default since react-native version 0.64

wamry commented 1 year ago

I recently installed xcode 14, and detox wasn't able to recognize any device with iOS 16, maybe i need to update detox? not sure

anyway, i made it work by adding additional simulator device => iPhone 13, with iOS 15.2 and then specify that iOS version in detoxrc config file, because when you add iPhone 13, with iOS 15.2, xcode 14 will force add another simulator with iOS 16, so now you also have to specify the iOS version in the detoxrc config file, to avoid pointing at iOS 16

in detoxrc config, in devices section

    "simulator": {
      "device": {
        "type": "iPhone 13",
        "os": "iOS 15.2"   <==== this line 
      },
      "type": "ios.simulator"
    }