Closed bryanboyko closed 3 years ago
Manually launch the Simulator app from Xcode and see what happens on screen.
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
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.
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,
This method for getting a .app and then running detox tests with it was working a number of months 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?
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.
Is there any way you can obtain an Xcode project? We have a guide you can then follow to try to debug.
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?
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.
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
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
+1. I am experiencing the same issue and have tried similar workarounds.
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.
I will go over the guide now and report back. I'm not using Expo
Thanks
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
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.
@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.
@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"
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.
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
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"
}
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
They are now failing as described above with the following
package.json
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
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
--loglevel trace
argument and am providing the verbose log below: