Detox: Detox Hangs on launchApp Command

Describe the bug I call detox.init() without launching the app: await detox.init(detoxConfig, {launchApp: false}); and then launch the app afterwards using await device.launchApp({permissions: {location: 'always'}});. The tests are now hanging between the init and launchApp functions, and no tests are ever executed. I am seeing this locally and in all of my CI builds on Bitrise after updating Detox to version 13.1.0. I tested this on the latest version and I see the same thing. If I revert my detox version to 13.0.1, the tests run as expected.

To Reproduce

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

Provide the steps necessary to reproduce the issue. If you are seeing a regression, try to provide the last known version where the issue did not reproduce.

With Detox 13.1.1

  1. Run the following code at the start of a test run:
    console.log('Before Init');
    await detox.init(detoxConfig, {launchApp: false});
    console.log('After Init');
    await device.launchApp({permissions: {location: 'always'}});
    console.log('After launch');
  1. View output:
Before Init
After Init
detox[59313] INFO:  [AppleSimUtils.js] <appName>.debug launched. To watch simulator logs, run:
        /usr/bin/xcrun simctl spawn D22384F5-F2F5-4916-8E21-DADBFD78D646 log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/user/Library/Developer/CoreSimulator/Devices/D22384F5-F2F5-4916-8E21-DADBFD78D646/data/Containers/Bundle/Application/0156DD65-D7A1-4F32-858B-2BCFB365D75D/<appName>"'
VError: a BeforeAll hook errored, process exiting: e2e/features/support/hooks.js:31: function timed out, ensure the promise resolves within 90000 milliseconds

With Detox 13.0.1

  1. Run the following code at the start of a test run:
    console.log('Before Init');
    await detox.init(detoxConfig, {launchApp: false});
    console.log('After Init');
    await device.launchApp({permissions: {location: 'always'}});
    console.log('After launch');
  1. View output:
Before Init
After Init
detox[60103] INFO:  [AppleSimUtils.js] <appName> launched. To watch simulator logs, run:
        /usr/bin/xcrun simctl spawn 4ACAE51B-FD28-404C-BA18-767B5919879E log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/user/Library/Developer/CoreSimulator/Devices/4ACAE51B-FD28-404C-BA18-767B5919879E/data/Containers/Bundle/Application/7EA51E4E-4AD7-4DD3-A384-4E84B0281FF9/<appName>"'
After launch
..............

1 scenario (1 passed)
4 steps (4 passed)
0m27.588s

Expected behavior App should launch and test execution should begin.

Screenshots The app goes to the background and is never launched. Screenshot would be the home screen of an iOS Simulator.

Environment (please complete the following information):

  • Detox: 13.1.1
  • React Native: 0.59.10
  • Node: 8.11.1
  • Device: iOS Simulator (iPhone X)
  • Xcode: 10.1
  • iOS: 12.1
  • macOS: 10.13.6

Device and Verbose Detox Logs - 13.1.1

detox-server info 13:38:36: server listening on localhost:8099...
detox-server wss 13:40:12: role=tester login (sessionId=testing)
detox-server wss 13:40:12: role=tester action=loginSuccess (sessionId=testing)
detox-server wss 13:41:06: role=tester action=isReady (sessionId=testing)
detox-server wss 13:41:06: role=testee not connected, cannot fw action (sessionId=testing)
detox-server wss 13:41:07: role=testee login (sessionId=testing)
detox-server wss 13:41:07: role=testee action=loginSuccess (sessionId=testing)
detox-server wss 13:41:08: role=testee disconnect (sessionId=testing)
detox-server wss 13:41:42: role=tester disconnect (sessionId=testing)

Device and Verbose Detox Logs - 13.0.1

detox-server info 13:47:08: server listening on localhost:8099...
detox-server wss 13:47:08: role=testee login (sessionId=testing)
detox-server wss 13:47:08: role=testee action=loginSuccess (sessionId=testing)
detox-server wss 13:47:12: role=tester login (sessionId=testing)
detox-server wss 13:47:12: role=tester action=loginSuccess (sessionId=testing)
detox-server wss 13:47:13: role=testee disconnect (sessionId=testing)
detox-server wss 13:47:32: role=tester action=isReady (sessionId=testing)
detox-server wss 13:47:32: role=testee not connected, cannot fw action (sessionId=testing)
detox-server wss 13:47:32: role=testee login (sessionId=testing)
detox-server wss 13:47:32: role=testee action=loginSuccess (sessionId=testing)
detox-server wss 13:47:35: role=testee action=ready (sessionId=testing)
detox-server wss 13:47:35: role=tester action=waitForActive (sessionId=testing)
detox-server wss 13:47:35: role=testee action=waitForActiveDone (sessionId=testing)
detox-server wss 13:47:36: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:37: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:37: role=tester action=reactNativeReload (sessionId=testing)
detox-server wss 13:47:43: role=testee action=ready (sessionId=testing)
detox-server wss 13:47:45: role=tester action=reactNativeReload (sessionId=testing)
detox-server wss 13:47:50: role=testee action=ready (sessionId=testing)
detox-server wss 13:47:50: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:50: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:50: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:50: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:50: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:52: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:52: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:54: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:54: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:54: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:54: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:54: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:54: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:54: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:54: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:54: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:54: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:54: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:54: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:54: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:54: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:54: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:54: role=tester action=invoke (sessionId=testing)
detox-server wss 13:47:54: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:47:55: role=tester action=reactNativeReload (sessionId=testing)
detox-server wss 13:48:00: role=testee action=ready (sessionId=testing)
detox-server wss 13:48:00: role=tester action=invoke (sessionId=testing)
detox-server wss 13:48:01: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:48:01: role=tester action=invoke (sessionId=testing)
detox-server wss 13:48:02: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:48:02: role=tester action=invoke (sessionId=testing)
detox-server wss 13:48:02: role=testee action=invokeResult (sessionId=testing)
detox-server wss 13:48:02: role=tester action=cleanup (sessionId=testing)
detox-server wss 13:48:02: role=testee action=cleanupDone (sessionId=testing)
detox-server wss 13:48:02: role=tester disconnect (sessionId=testing)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 25 (16 by maintainers)

Most upvoted comments

It does. I can reproduce it each time. I spent some time this morning testing the versions between 13.0.1 and 13.1.0. The breaking change appears between versions 13.0.2 (working) and 13.0.3 (does not work, fails to launch app).

@elyalvarado This problem specifically, if it happens, it happens every time. Otherwise, it’s something else.

Please recursively clone the AppDelegateSwizzleWoes branch like so:

git clone --single-branch --branch AppDelegateSwizzleWoes --recursive https://github.com/wix/Detox.git

Then follow the above linked guide, only dragging the newly cloned project from detox/ios rather than from node_modules.

Before building and running in Xcode, open a new terminal window and run the following command:

xcrun simctl spawn booted log stream --level debug --style compact --predicate "category == 'AppDelegateProxy'"

Now run in Xcode and let it hang. Copy the output from Terminal and paste here. Thanks!

Yes, that means it’s a crash. Please follow the guide I posted. Thanks

I’m alive. I just haven’t had a chance to follow the instructions in an attempt to get more details about a possible crash yet. I do believe that is what may be happening. What I see when I try to execute launchApp() is Splash Screen -> Sudden Black Screen -> Simulator stops on iOS home screen and then the tests time out. I should have time to get more info out here in the next day or two.