Detox hangs on "Trying permissions" on CircleCI

Created on 17 Jun 2019  Â·  5Comments  Â·  Source: wix/Detox

Describe the bug
Attempting to run tests on CircleCI results in a timeout in the beforeAll hook. Logs reveal the last successful entry is "Trying permissions".

I set the following in my init.js:

before(async () => {
  await detox.init(config, { launchApp: false })
  await device.launchApp({
    permissions: {
      notifications: 'YES',
    },
  })
})

Works perfectly locally with the same environment settings.

To Reproduce

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

Environment (please complete the following information):

  • Detox: 12.11.0
  • React Native: 0.59.5
  • Node: 11.13.0
  • Device: iPhone X
  • Xcode: 10.2.0
  • iOS: 11.4
  • macOS: 10.14.4

Device and Verbose Detox Logs
Provide the device and "trace" Detox logs so we can understand what happened. You can obtain them by passing the loglevel param: detox test --loglevel trace

```â–¸ Build Succeeded
info Installing build/xxx/Build/Products/Debug-iphonesimulator/xxx.app
info Launching org.reactjs.native.example.xxx
org.reactjs.native.example.xxx: 34512
detox[34513] INFO: [test.js] node_modules/.bin/mocha --opts e2e/mocha.opts --configuration ios.sim.debug --loglevel trace --debug-synchronization 100 --grep :android: --invert --artifacts-location "artifacts/ios.sim.debug.2019-06-17 20-23-39Z" "e2e"

detox[34516] INFO: [DetoxServer.js] server listening on localhost:49358...
detox[34516] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:49358
detox[34516] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"b0b44eb6-5691-d7a6-e3a3-325fe65d48ff","role":"tester"},"messageId":0}
detox[34516] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=b0b44eb6-5691-d7a6-e3a3-325fe65d48ff
detox[34516] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=b0b44eb6-5691-d7a6-e3a3-325fe65d48ff
detox[34516] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"b0b44eb6-5691-d7a6-e3a3-325fe65d48ff","role":"tester"},"messageId":0}

detox[34516] DEBUG: [exec.js/EXEC_CMD, #0] applesimutils --list --byType "iPhone X" --byOS "iOS 11.4"
detox[34516] DEBUG: [exec.js/EXEC_TRY, #0] Searching for device matching iPhone X, iOS 11.4...
detox[34516] TRACE: [exec.js/EXEC_SUCCESS, #0] [
{
"availabilityError" : "",
"os" : {
"bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 11.4.simruntime",
"availabilityError" : "",
"buildversion" : "15F79",
"availability" : "(available)",
"isAvailable" : true,
"identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-4",
"version" : "11.4",
"name" : "iOS 11.4"
},
"availability" : "(available)",
"deviceType" : {
"name" : "iPhone X",
"bundlePath" : "\/Applications\/Xcode-10.2.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/Library\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone X.simdevicetype",
"identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-X"
},
"udid" : "D3541EC1-EFFD-4664-A3D9-08744EF887CD",
"isAvailable" : true,
"state" : "Booted",
"name" : "iPhone X"
}
]

detox[34516] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byId "D3541EC1-EFFD-4664-A3D9-08744EF887CD"
detox[34516] TRACE: [exec.js/EXEC_SUCCESS, #1] [
{
"availabilityError" : "",
"os" : {
"bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 11.4.simruntime",
"availabilityError" : "",
"buildversion" : "15F79",
"availability" : "(available)",
"isAvailable" : true,
"identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-4",
"version" : "11.4",
"name" : "iOS 11.4"
},
"availability" : "(available)",
"deviceType" : {
"name" : "iPhone X",
"bundlePath" : "\/Applications\/Xcode-10.2.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/Library\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone X.simdevicetype",
"identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-X"
},
"udid" : "D3541EC1-EFFD-4664-A3D9-08744EF887CD",
"isAvailable" : true,
"state" : "Booted",
"name" : "iPhone X"
}
]

detox[34516] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBootDevice({ coldBoot: false,
deviceId: 'D3541EC1-EFFD-4664-A3D9-08744EF887CD' })
detox[34516] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeUninstallApp({ deviceId: 'D3541EC1-EFFD-4664-A3D9-08744EF887CD',
bundleId: 'org.reactjs.native.example.xxx' })
detox[34516] DEBUG: [exec.js/EXEC_CMD, #2] /usr/bin/xcrun simctl uninstall D3541EC1-EFFD-4664-A3D9-08744EF887CD org.reactjs.native.example.xxx
detox[34516] DEBUG: [exec.js/EXEC_TRY, #2] Uninstalling org.reactjs.native.example.xxx...
detox[34516] TRACE: [exec.js/EXEC_SUCCESS, #2]
detox[34516] DEBUG: [exec.js/EXEC_SUCCESS, #2] org.reactjs.native.example.xxx uninstalled
detox[34516] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl install D3541EC1-EFFD-4664-A3D9-08744EF887CD "/Users/distiller/mobile4/ios/build/xxx/Build/Products/Debug-iphonesimulator/xxx.app"
detox[34516] DEBUG: [exec.js/EXEC_TRY, #3] Installing /Users/distiller/mobile4/ios/build/xxx/Build/Products/Debug-iphonesimulator/xxx.app...
detox[34516] TRACE: [exec.js/EXEC_SUCCESS, #3]
detox[34516] DEBUG: [exec.js/EXEC_SUCCESS, #3] /Users/distiller/mobile4/ios/build/xxx/Build/Products/Debug-iphonesimulator/xxx.app installed
detox[34516] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeAll()
detox[34516] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeTerminateApp({ deviceId: 'D3541EC1-EFFD-4664-A3D9-08744EF887CD',
bundleId: 'org.reactjs.native.example.xxx' })
detox[34516] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl terminate D3541EC1-EFFD-4664-A3D9-08744EF887CD org.reactjs.native.example.xxx
detox[34516] DEBUG: [exec.js/EXEC_TRY, #4] Terminating org.reactjs.native.example.xxx...
detox[34516] TRACE: [exec.js/EXEC_SUCCESS, #4]
detox[34516] DEBUG: [exec.js/EXEC_SUCCESS, #4] org.reactjs.native.example.xxx terminated
detox[34516] DEBUG: [exec.js/EXEC_CMD, #5] applesimutils --simulator D3541EC1-EFFD-4664-A3D9-08744EF887CD --bundle org.reactjs.native.example.xxx --restartSB --setPermissions notifications=YES
detox[34516] DEBUG: [exec.js/EXEC_TRY, #5] Trying to set permissions...
1) "before all" hook

0 passing (2m)
1 failing

1) "before all" hook:
Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
at listOnTimeout (internal/timers.js:535:17)
at processTimers (internal/timers.js:479:7)

detox[34516] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onAfterAll()
detox[34516] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=b0b44eb6-5691-d7a6-e3a3-325fe65d48ff
detox[34516] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully

```

invalid ios

Most helpful comment

I ran into the same issue. Upgrading Detox to version 12.11.1, which has been released 4 days ago, fixed the issue for me. It apparently had to do with an old API of AppleSimUtils being used (see https://github.com/wix/Detox/releases/tag/12.11.1).

Hope this fixes your issues as well.

All 5 comments

I'm facing the same issue. Our circleci build is running on Xcode 10.1.0, otherwise similar config to @mglaze

Same here. Worked fine one\two weeks ago and without changing any configurations now fails with timeout on "Trying permissions".
Circle CI config: https://github.com/RocketChat/Rocket.Chat.ReactNative/blob/37db977a22ad3da43ddd31d712e531bf8cc9ee41/.circleci/config.yml#L45
Circle CI job logs: https://circleci.com/gh/RocketChat/Rocket.Chat.ReactNative/8810

I ran into the same issue. Upgrading Detox to version 12.11.1, which has been released 4 days ago, fixed the issue for me. It apparently had to do with an old API of AppleSimUtils being used (see https://github.com/wix/Detox/releases/tag/12.11.1).

Hope this fixes your issues as well.

@thabemmz thanks! Upgrading detox to 12.11.1 solved the issue

Why is the "I have tested this issue on the latest Detox release and it still reproduces" checkbox ticked if it clearly isn't the case? :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeoNatan picture LeoNatan  Â·  4Comments

isnifer picture isnifer  Â·  4Comments

danut-t picture danut-t  Â·  3Comments

raphkr picture raphkr  Â·  4Comments

alexmngn picture alexmngn  Â·  3Comments