wix / Detox

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

launchApp hanging on 18.2.2 with TrustKit #2611

Open deecewan opened 3 years ago

deecewan commented 3 years ago

Description

When running the tests, with no "real" tests (just the demo ones that come from init), the app hangs at "Loading from localhost:8081". When launching the same app on the simulator not using detox to launch it, I get past that banner almost instantly to the first screen of the app.

The log implies that the network request is "done", but it's still waiting on the bundle too load. This doesn't happen on older versions of detox (17.8.3 is the pre-18 version i tried).

2409 seems to be a similar issue, but it appears to also be happening on 17.5.0 versions. Notably, we don't use react-native-splash-screen. Also, I have checked that debugging is disabled, and live reload is disabled. I am using a debug version of the app.

2569 seems to be similar as well, but the app does not boot correctly. I do see the

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

error however

Reproduction

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.

  1. run detox init -r jest
  2. fill out the .detoxrc.js with some valid content
  3. run detox test -c ios to run the tests on iOS
  4. launchApp runs, but
    • “React Native (bundle load)” shows as pending on the detox side, and
    • "Loading from localhost:8081" shows on the simulator

This doesn't happen when I launch the app manually (exact same app - only change is manual launch), and also seems to work correctly when I installed detox@17.8.3 - there was no hang and the app booted normally.

Expected behavior

The app gets passed the "Loading from localhost:8081"

Screenshots

If applicable, add screenshots to help explain your problem.

image image

Environment (please complete the following information):

Logs

If you are experiencing a timeout in your test

Device and verbose Detox logs

expand to see - i cut it off before the timeout. this same this thing just continues until the timeout ``` $ /Users/david/projects/ferocia/up/native/node_modules/.bin/detox test -c ios --loglevel trace detox[94957] INFO: [test.js] DETOX_CONFIGURATION="ios" DETOX_LOGLEVEL="trace" DETOX_REPORT_SPECS=true DETOX_START_TIMESTAMP=1611270389237 DETOX_USE_CUSTOM_LOGGER=true jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e detox[94958] TRACE: [Detox.js/DETOX_CREATE] created a Detox instance with config: {"artifactsConfig":{"rootDir":"artifacts/ios.2021-01-21 23-06-29Z","plugins":{"log":{"enabled":true,"keepOnlyFailedTestsArtifacts":false},"screenshot":{"shouldTakeAutomaticSnapshots":true,"keepOnlyFailedTestsArtifacts":true,"takeWhen":{"testStart":false,"testDone":true},"enabled":true},"video":{"android":{"bitRate":4000000},"simulator":{"codec":"hevc"},"enabled":false,"keepOnlyFailedTestsArtifacts":false},"instruments":{"enabled":false,"keepOnlyFailedTestsArtifacts":false},"timeline":{"enabled":false},"uiHierarchy":{"enabled":true,"keepOnlyFailedTestsArtifacts":false}},"pathBuilder":{"_rootDir":"artifacts/ios.2021-01-21 23-06-29Z"}},"behaviorConfig":{"init":{"reinstallApp":true,"exposeGlobals":true},"cleanup":{"shutdownDevice":false},"launchApp":"auto"},"cliConfig":{"configuration":"ios","loglevel":"trace","useCustomLogger":"true"},"deviceConfig":{"type":"ios.simulator","build":"./up ios build test","binaryPath":"./products/ios/test.app","device":{"type":"iPhone 8","os":"14.3"}},"runnerConfig":{"testRunner":"jest","runnerConfig":"e2e/config.json","specs":"e2e"},"sessionConfig":{"autoStart":true,"server":"ws://localhost:51374","sessionId":"3f310b0f-bbc3-fe73-3087-353b3c551fe3","debugSynchronization":10000},"errorBuilder":{"filepath":"/Users/david/projects/ferocia/up/native/.detoxrc.js","contents":{"testRunner":"jest","runnerConfig":"e2e/config.json","artifacts":{"rootDir":"artifacts","plugins":{"instruments":{"enabled":false},"log":{"enabled":true},"uiHierarchy":"enabled","screenshot":{"shouldTakeAutomaticSnapshots":true,"keepOnlyFailedTestsArtifacts":true,"takeWhen":{"testStart":false,"testDone":true}},"video":{"android":{"bitRate":4000000},"simulator":{"codec":"hevc"}}}},"configurations":{"ios":{"type":"ios.simulator","build":"./up ios build test","binaryPath":"./products/ios/test.app","device":{"type":"iPhone 8","os":"14.3"}},"android":{"type":"android.emulator","binaryPath":"SPECIFY_PATH_TO_YOUR_APP_BINARY","device":{"avdName":"Pixel_2_API_29"}}}},"configurationName":"ios"}} detox[94958] INFO: [DetoxServer.js] server listening on localhost:51374... detox[94958] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:51374 detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"3f310b0f-bbc3-fe73-3087-353b3c551fe3","role":"tester"},"messageId":0} detox[94958] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3 detox[94958] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3 detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"3f310b0f-bbc3-fe73-3087-353b3c551fe3","role":"tester"},"messageId":0} detox[94958] DEBUG: [exec.js/EXEC_CMD, #0] applesimutils --list --byOS 14.3 --byType "iPhone 8" detox[94958] TRACE: [exec.js/EXEC_SUCCESS, #0] [ { "os" : { "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime", "buildversion" : "18C61", "runtimeRoot" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot", "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-14-3", "version" : "14.3", "isAvailable" : true, "name" : "iOS 14.3" }, "dataPath" : "\/Users\/david\/Library\/Developer\/CoreSimulator\/Devices\/46AF1CE8-0373-49B4-BB26-78E90B96CB5D\/data", "logPath" : "\/Users\/david\/Library\/Logs\/CoreSimulator\/46AF1CE8-0373-49B4-BB26-78E90B96CB5D", "udid" : "46AF1CE8-0373-49B4-BB26-78E90B96CB5D", "isAvailable" : true, "deviceType" : { "minRuntimeVersion" : 720896, "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone 8.simdevicetype", "maxRuntimeVersion" : 4294967295, "name" : "iPhone 8", "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-8", "productFamily" : "iPhone" }, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-8", "state" : "Booted", "name" : "iPhone 8" } ] detox[94958] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byId 46AF1CE8-0373-49B4-BB26-78E90B96CB5D --maxResults 1 detox[94958] TRACE: [exec.js/EXEC_SUCCESS, #1] [ { "os" : { "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime", "buildversion" : "18C61", "runtimeRoot" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot", "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-14-3", "version" : "14.3", "isAvailable" : true, "name" : "iOS 14.3" }, "dataPath" : "\/Users\/david\/Library\/Developer\/CoreSimulator\/Devices\/46AF1CE8-0373-49B4-BB26-78E90B96CB5D\/data", "logPath" : "\/Users\/david\/Library\/Logs\/CoreSimulator\/46AF1CE8-0373-49B4-BB26-78E90B96CB5D", "udid" : "46AF1CE8-0373-49B4-BB26-78E90B96CB5D", "isAvailable" : true, "deviceType" : { "minRuntimeVersion" : 720896, "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone 8.simdevicetype", "maxRuntimeVersion" : 4294967295, "name" : "iPhone 8", "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-8", "productFamily" : "iPhone" }, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-8", "state" : "Booted", "name" : "iPhone 8" } ] detox[94958] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBootDevice({ coldBoot: false, deviceId: '46AF1CE8-0373-49B4-BB26-78E90B96CB5D', type: 'iPhone 8' }) detox[94958] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeUninstallApp({ deviceId: '46AF1CE8-0373-49B4-BB26-78E90B96CB5D', bundleId: 'au.com.up.money.integration' }) detox[94958] DEBUG: [exec.js/EXEC_CMD, #2] /usr/bin/xcrun simctl uninstall 46AF1CE8-0373-49B4-BB26-78E90B96CB5D au.com.up.money.integration detox[94958] DEBUG: [exec.js/EXEC_TRY, #2] Uninstalling au.com.up.money.integration... detox[94958] TRACE: [exec.js/EXEC_SUCCESS, #2] detox[94958] DEBUG: [exec.js/EXEC_SUCCESS, #2] au.com.up.money.integration uninstalled detox[94958] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl install 46AF1CE8-0373-49B4-BB26-78E90B96CB5D "/Users/david/projects/ferocia/up/native/products/ios/test.app" detox[94958] DEBUG: [exec.js/EXEC_TRY, #3] Installing /Users/david/projects/ferocia/up/native/products/ios/test.app... detox[94958] TRACE: [exec.js/EXEC_SUCCESS, #3] detox[94958] DEBUG: [exec.js/EXEC_SUCCESS, #3] /Users/david/projects/ferocia/up/native/products/ios/test.app installed ROOT_DESCRIBE_BLOCK[94958] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onRunDescribeStart({ name: 'ROOT_DESCRIBE_BLOCK' }) Example[94958] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onRunDescribeStart({ name: 'Example' }) detox[94958] INFO: Example is assigned to 46AF1CE8-0373-49B4-BB26-78E90B96CB5D {"type":"iPhone 8","os":"14.3"} detox[94958] INFO: at e2e/firstTest.e2e.js:11:21 before all detox[94958] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeTerminateApp({ deviceId: '46AF1CE8-0373-49B4-BB26-78E90B96CB5D', bundleId: 'au.com.up.money.integration' }) detox[94958] INFO: at e2e/firstTest.e2e.js:22:21 launch app done detox[94958] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl terminate 46AF1CE8-0373-49B4-BB26-78E90B96CB5D au.com.up.money.integration detox[94958] DEBUG: [exec.js/EXEC_TRY, #4] Terminating au.com.up.money.integration... detox[94958] INFO: Example: should have welcome screen detox[94958] TRACE: [Detox.js/DETOX_BEFORE_EACH] running test: "Example should have welcome screen" detox[94958] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onTestStart({ title: 'should have welcome screen', fullName: 'Example should have welcome screen', status: 'running', invocations: 1 }) detox[94958] TRACE: [Artifact.js/START] starting SimulatorLogRecording detox[94958] DEBUG: [exec.js/SPAWN_CMD, #5] [pid=95063] /usr/bin/xcrun simctl spawn 46AF1CE8-0373-49B4-BB26-78E90B96CB5D log stream --level debug --style compact detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"reactNativeReload","params":{},"messageId":-1000} detox[94958] TRACE: [DetoxServer.js/MESSAGE] role=tester action=reactNativeReload (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=app not connected, cannot fw action (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] TRACE: [exec.js/EXEC_SUCCESS, #4] detox[94958] DEBUG: [exec.js/EXEC_SUCCESS, #4] au.com.up.money.integration terminated detox[94958] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onTerminateApp({ deviceId: '46AF1CE8-0373-49B4-BB26-78E90B96CB5D', bundleId: 'au.com.up.money.integration' }) detox[94958] DEBUG: [exec.js/EXEC_CMD, #6] applesimutils --byId 46AF1CE8-0373-49B4-BB26-78E90B96CB5D --bundle au.com.up.money.integration --restartSB --setPermissions location=always,notifications=YES detox[94958] DEBUG: [exec.js/EXEC_TRY, #6] Trying to set permissions... detox[94958] TRACE: [exec.js/EXEC_SUCCESS, #6] detox[94958] DEBUG: [exec.js/EXEC_SUCCESS, #6] Permissions are set detox[94958] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeLaunchApp({ bundleId: 'au.com.up.money.integration', deviceId: '46AF1CE8-0373-49B4-BB26-78E90B96CB5D', launchArgs: { detoxServer: 'ws://localhost:51374', detoxSessionId: '3f310b0f-bbc3-fe73-3087-353b3c551fe3', detoxURLBlacklistRegex: '\\("localhost:8081"\\)' } }) detox[94958] TRACE: [Artifact.js/START] starting SimulatorLogRecording { udid: '46AF1CE8-0373-49B4-BB26-78E90B96CB5D', bundleId: 'au.com.up.money.integration' } detox[94958] TRACE: [Artifact.js/STOP] stopping SimulatorLogRecording detox[94958] DEBUG: [exec.js/KILL] sending SIGINT to [pid = 95063]: /usr/bin/xcrun simctl spawn 46AF1CE8-0373-49B4-BB26-78E90B96CB5D log stream --level debug --style compact detox[94958] TRACE: [exec.js/SPAWN_END, #5] /usr/bin/xcrun simctl spawn 46AF1CE8-0373-49B4-BB26-78E90B96CB5D log stream --level debug --style compact finished with code = 0 detox[94958] DEBUG: [exec.js/EXEC_CMD, #7] /usr/bin/xcrun simctl get_app_container 46AF1CE8-0373-49B4-BB26-78E90B96CB5D au.com.up.money.integration detox[94958] TRACE: [exec.js/EXEC_SUCCESS, #7] /Users/david/Library/Developer/CoreSimulator/Devices/46AF1CE8-0373-49B4-BB26-78E90B96CB5D/data/Containers/Bundle/Application/6AA6FDE4-C9E2-4572-AD36-774A922C5038/test.app detox[94958] DEBUG: [exec.js/SPAWN_CMD, #8] [pid=95116] /usr/bin/xcrun simctl spawn 46AF1CE8-0373-49B4-BB26-78E90B96CB5D log stream --level debug --style compact --predicate "processImagePath beginsWith \"/Users/david/Library/Developer/CoreSimulator/Devices/46AF1CE8-0373-49B4-BB26-78E90B96CB5D/data/Containers/Bundle/Application/6AA6FDE4-C9E2-4572-AD36-774A922C5038/test.app\"" detox[94958] DEBUG: [exec.js/EXEC_CMD, #9] SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/david/Library/Detox/ios/8819bfbbc5e7840cd22a0609009bcfaefd64e1a2/Detox.framework/Detox" /usr/bin/xcrun simctl launch 46AF1CE8-0373-49B4-BB26-78E90B96CB5D au.com.up.money.integration --args -detoxServer ws://localhost:51374 -detoxSessionId 3f310b0f-bbc3-fe73-3087-353b3c551fe3 -detoxURLBlacklistRegex '\("localhost:8081"\)' detox[94958] DEBUG: [exec.js/EXEC_TRY, #9] Launching au.com.up.money.integration... detox[94958] TRACE: [exec.js/EXEC_SUCCESS, #9] au.com.up.money.integration: 95210 detox[94958] DEBUG: [exec.js/EXEC_CMD, #10] /usr/bin/xcrun simctl get_app_container 46AF1CE8-0373-49B4-BB26-78E90B96CB5D au.com.up.money.integration detox[94958] TRACE: [exec.js/EXEC_SUCCESS, #10] /Users/david/Library/Developer/CoreSimulator/Devices/46AF1CE8-0373-49B4-BB26-78E90B96CB5D/data/Containers/Bundle/Application/6AA6FDE4-C9E2-4572-AD36-774A922C5038/test.app detox[94958] INFO: [AppleSimUtils.js] au.com.up.money.integration launched. To watch simulator logs, run: /usr/bin/xcrun simctl spawn 46AF1CE8-0373-49B4-BB26-78E90B96CB5D log stream --level debug --style compact --predicate 'process == "Up"' detox[95210] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onLaunchApp({ bundleId: 'au.com.up.money.integration', deviceId: '46AF1CE8-0373-49B4-BB26-78E90B96CB5D', launchArgs: { detoxServer: 'ws://localhost:51374', detoxSessionId: '3f310b0f-bbc3-fe73-3087-353b3c551fe3', detoxURLBlacklistRegex: '\\("localhost:8081"\\)' }, pid: 95210 }) detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"isReady","params":{},"messageId":-1000} detox[94958] TRACE: [DetoxServer.js/MESSAGE] role=tester action=isReady (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=app not connected, cannot fw action (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] DEBUG: [DetoxServer.js/LOGIN] role=app, sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3 detox[94958] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=app, sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3 detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"currentStatus","params":{},"messageId":1} detox[94958] TRACE: [DetoxServer.js/MESSAGE] role=tester action=currentStatus (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] TRACE: [DetoxServer.js/MESSAGE] role=app action=currentStatusResult (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":1,"type":"currentStatusResult","params":{"status":"The system is busy with the following tasks:\n\nDelayed Perform Selector\n⏱ 1 pending selector\n\nDispatch Queue\n⏱ Queue: “Main Queue ()” with 24 work items\n\nRun Loop\n⏱ “Main Run Loop”\n\nOne-time Events\n⏱ “React Native (bundle load)”\n⏱ “Network Request” with object: “URL: “https://api2.branch.io/v1/install””\n\nTimer\n⏱ Fire date: 2021-01-22 10:06:46 +1100 (fire interval: 0.9999979734420776) repeats: NO repeat interval: 0>\n⏱ Fire date: 2021-01-22 10:06:46 +1100 (fire interval: 1.499992966651917) repeats: NO repeat interval: 0>","messageId":1}} detox[94958] INFO: [actions.js] The system is busy with the following tasks: Delayed Perform Selector ⏱ 1 pending selector Dispatch Queue ⏱ Queue: “Main Queue ()” with 24 work items Run Loop ⏱ “Main Run Loop” One-time Events ⏱ “React Native (bundle load)” ⏱ “Network Request” with object: “URL: “https://api2.branch.io/v1/install”” Timer ⏱ Fire date: 2021-01-22 10:06:46 +1100 (fire interval: 0.9999979734420776) repeats: NO repeat interval: 0> ⏱ Fire date: 2021-01-22 10:06:46 +1100 (fire interval: 1.499992966651917) repeats: NO repeat interval: 0> detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"currentStatus","params":{},"messageId":2} detox[94958] TRACE: [DetoxServer.js/MESSAGE] role=tester action=currentStatus (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] TRACE: [DetoxServer.js/MESSAGE] role=app action=currentStatusResult (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"params":{"messageId":2,"status":"The system is busy with the following tasks:\n\nDispatch Queue\n⏱ Queue: “Main Queue ()” with 1 work item\n\nRun Loop\n⏱ “Main Run Loop”\n\nOne-time Events\n⏱ “React Native (bundle load)”"},"messageId":2,"type":"currentStatusResult"} detox[94958] INFO: [actions.js] The system is busy with the following tasks: Dispatch Queue ⏱ Queue: “Main Queue ()” with 1 work item Run Loop ⏱ “Main Run Loop” One-time Events ⏱ “React Native (bundle load)” detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"currentStatus","params":{},"messageId":3} detox[94958] TRACE: [DetoxServer.js/MESSAGE] role=tester action=currentStatus (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] TRACE: [DetoxServer.js/MESSAGE] role=app action=currentStatusResult (sessionId=3f310b0f-bbc3-fe73-3087-353b3c551fe3) detox[94958] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"params":{"messageId":3,"status":"The system is busy with the following tasks:\n\nDispatch Queue\n⏱ Queue: “Main Queue ()” with 1 work item\n\nRun Loop\n⏱ “Main Run Loop”\n\nOne-time Events\n⏱ “React Native (bundle load)”"},"messageId":3,"type":"currentStatusResult"} detox[94958] INFO: [actions.js] The system is busy with the following tasks: Dispatch Queue ⏱ Queue: “Main Queue ()” with 1 work item Run Loop ⏱ “Main Run Loop” One-time Events ⏱ “React Native (bundle load)” ```
LeoNatan commented 3 years ago

It seems like the React Native bundle load is stuck. We've seen this happen when there is a conflict between Detox and FB's Flipper, and we have code that is supposed to disable Flipper when running Detox tests. Can you please try disabling Flipper (normally in the AppDelegate.m file) and running the test again?

Thanks

therealemjy commented 3 years ago

Running in the same issue with Flipper disabled on the project.

Environment:

LeoNatan commented 3 years ago

Can anyone please create a zip (sans Node Modules) of a project that reproduces this and post here? Thanks

deecewan commented 3 years ago

@LeoNatan just checked - we don't have Flipper enabled either. The code doesn't seem to exist in AppDelegate.swift. I can add in a bunch of logging in the AppDelegate#application function and see if/when it is failing there.

I cannot post a zip of our application, but I will try and produce a MWE.

erheron commented 3 years ago

We are experiencing the same problem, and despite I don't know the cause yet, I was able to fix it by changing this:

...
await device.launchApp({
  launchArgs: {
     ...params
  }
  ...
  );
await mockServers()/setUrlBlacklist()/...

to this:

...
await device.launchApp({
  launchArgs: {
     ...params,
     detoxEnableSynchronization: 0,
  }
  ...
  );
await mockServers()/setUrlBlacklist()/...
device.enableSynchronization()

As you can see, the change is to disable and then enable synchronization. For the record, everything was working nearly perfectly with version 17. I've made this change everywhere where device.launchApp appears. Will update this comment once I know the cause in our application.

LeoNatan commented 3 years ago

@erheron I don't think your issue is related to this one. If you have timeouts in Detox, it means it's something busy in your app. Follow the sync debug guide and you will find out what is causing that.

The issue here is that RN doesn't load the bundle.

korengal commented 3 years ago

Having the same problem:

Detox: 18.2.1 React Native: 0.63.2 (Expo ejected project bare workflow) Node: 14.15.0 Device: iPhone 11 iOS 14.4 Xcode: 12.4 iOS: 14.4 macOS: 10.15.7

LeoNatan commented 3 years ago

Guys, I am unable to reproduce this. As requested before, please create an empty project that reproduces this issue with the latest Detox, so I can investigate. Thanks

dbilgin commented 3 years ago

I didn't have this locally, but after upgrading to the latest version I started getting the below problem on my Bitrise builds

detox[17557] INFO:  [actions.js] The system is busy with the following tasks:
Dispatch Queue
⏱ Queue: “Main Queue (<OS_dispatch_queue_main: com.apple.main-thread>)” with 1 work item
Run Loop
⏱ “Main Run Loop”
UI Elements
⏱ 1 CA animation pending
LeoNatan commented 3 years ago

@dbilgin You have an animation. Unrelated to the problem here.

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.

korengal commented 3 years ago

@deecewan Did u find a solution to this?

deecewan commented 3 years ago

I did not. I haven't had time to dig into it, either.

It's likely one of our libraries that's causing this. I'm not sure how to diagnose which one it is. Perhaps @LeoNatan has some hints as to where I can look to see what's breaking it?

LeoNatan commented 3 years ago

@deecewan Do you have Firebase/Google stuff in your project? Recently it was shown to have bugs.

deecewan commented 3 years ago

we do have firebase. I can't remember if it's enabled on iOS or not. I'll take a look.

marek-siemieniuk-morawski commented 3 years ago

I want to put my two cents: the issue of

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

might occur if someone forgot to finalize the Android configuration according to Introduction.Android. I'm aware the thread is about iOS but maybe it'll help someone who's facing this or similar problem.

dsteinbach commented 3 years ago

@marek-siemieniuk-morawski Thanks... this was my issue. Didn't add the java file. Thought it was for non-RN setups.

Iskander508 commented 3 years ago

We have run into the similar issue with our production app. Disabling Flipper having no effect. I have been trying to reproduce the issue adding only bunch of dependencies into a clean project, but so far no luck. What I found out and may help to locate the issue:

  1. The issue only appears when using detox 18.x, on v17.14.9 it works well.
  2. The debug iOS build is hanging on the bundle load step (as described in the initial post).
  3. When we try to run the release iOS build, it goes past the initial loading, but hangs when performing some specific server call from a redux-saga using axios. (figured out by trying without that call). Strangely, some axios calls finish successfully before. The app doesn't hang completely, the buttons in UI are still working when pressed manually, but the app doesn't get pass the hanging operation. It looks like if the redux-saga would get cancelled. The detox test fails almost immediately by not passing a testing expect call. (so like if synchronization would be completed)
  4. Every time the same hang is 100% reproducible, so not random at all. Always happening at the same stage of the app.
  5. Running the exact same build manually works without issues.

So it seems strangely that the issue is not connected with any particular library, but more with the architecture of the app. Our app is using many libraries. All hangs I've seen so far are coming from a redux-saga custom code. When we workaround one hang, it hangs later in the flow on something else. Sometimes not even directly on a server call, but when trying to wait for the server response using a redux-saga take effect. I'll try to spend more time investigating where it's coming from, and hopefully create some minimal example. Unfortunately so far we only run into this issue with our production code, so cannot share.

EDIT: After hours of investigating and removing one lib at a time (very tedious job), I've found the culprit: react-native-cert-pinner. When removed from the project, tests work again. Are you using the same (or similar) in your project @deecewan ? And does someone know some better alternative? The lib is not maintained anymore (for 2 years). Thank you

EDIT2: It seems like issue with TrustKit config. Setting the TSKSwizzleNetworkDelegates to false in app plist seems to solve the issue.

deecewan commented 3 years ago

@Iskander508 we don't use that particular project, but we do have Cert Pinning in our app.

Iskander508 commented 3 years ago

Then the problem seems quite obviously caused by TrustKit. @LeoNatan: would it be possible to integrate some similar fix that was used for the EarlGrey implementation?: https://github.com/wix/Detox/issues/1392

avanderberg commented 3 years ago

EDIT2: It seems like issue with TrustKit config. Setting the TSKSwizzleNetworkDelegates to false in app plist seems to solve the issue.

I can confirm that this change solves the issue for our app as well.

d4vidi commented 3 years ago

Amazing, thanks @Iskander508 @avanderberg

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

d4vidi commented 3 years ago

@MoeMamdouh Setting NSAllowsArbitraryLoads to true enables all unsecure HTTP traffic and is therefore a bad approach. It can get your app to fail app-store reviews. Read all about it here. Consider using NSAllowsLocalNetworking, instead.

ericschaal commented 3 years ago

Same problem, I am using Trustkit with "kTSKSwizzleNetworkDelegates: @YES"!

walterholohan commented 3 years ago

@ericschaal I have the same problem. I am using Trustkit with "kTSKSwizzleNetworkDelegates: @YES". Were you able to fix the issue?

walterholohan commented 3 years ago

We have SSL pinning setup in our app using TrustKit. We have followed the approach outlined in https://itnext.io/react-native-security-ssl-pinning-cde086210d58

andrea-11fs commented 3 years ago

Having the same issue, I am using Trustkit with "kTSKSwizzleNetworkDelegates: @YES" as well.

Has anyone found the solution to this ?

ericschaal commented 3 years ago

@walterholohan unfortunately the only solution I found was to downgrade Detox to v17.

walterholohan commented 3 years ago

@d4vidi do you think this issue will be fixed in the near future?

At the moment we have the following two options when it comes to using Detox and TrustKit SSL pinning:

  1. Downgrade to v17 and keep using TrustKit swizzling
  2. Refactor our app's SSL pinning strategy to not use sizzling (At the moment RN does not expose an API to accept a custom Network interface on iOS, that is the reason why we need to use swizzling)
d4vidi commented 3 years ago

Hey I've added this to the backlog, I hope we could handle it soon 🙏🏻

walterholohan commented 3 years ago

Fantastic @d4vidi. I will buy you a beer if you manage to fix it for us.

d4vidi commented 3 years ago

LOL, I highly appreciate the offer, but if anything, @alon-ha would be address for this. In any case, it's not quite needed! Wix takes good care of us in that sense 🍻

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

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

walterholohan commented 3 years ago

In the meantime, as a workaround, we are disabling SSL pinning when Detox is running. We feel that disabling SSL pinning will not drastically affect our test coverage and the quality of the product we are shipping. @ericschaal this might also be an option for you.

Here is an example of how we are disabling it in AppDelegate.m:

BOOL IS_DETOX = [[[NSProcessInfo processInfo] arguments] containsObject: @"-detoxServer"];
 if (IS_DETOX == NO) {
  /// SSL Pinning Init Code
 }
ericschaal commented 3 years ago

Thank you @walterholohan that's a great alternative.

DanielWFrancis commented 3 years ago

Having this issue during first setup while using Expo RN, disabled kTSKSwizzleNetworkDelegates in my infoPlist key in app.json but still not getting anywhere.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

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

deecewan commented 3 years ago

it's still relevant

d4vidi commented 3 years ago

@alon-ha any updates here, yet?

alon-ha commented 3 years ago

In TrustKit doc they specifically mention: "Apps where method swizzling of the connection delegates is already performed by another module or library (such as Analytics SDKs)" DetoxSync (The mechanism for tracking app status in Detox) swizzling both NSURLSession and NSURLConnection. I already check the swizzling in DetoxSync and it's done correctly. I still need to validate and go over their code, But I'm afraid I can't do anything about it and they are doing swizzling the wrong way which cause other libraries swizzling to not work properly. Will update after I go fully over their code

alon-ha commented 3 years ago

I created a DetoxTemplate project that you can fork and add an example test which reproduce your issue. It will be great if someone can do so and add TrustKit / the minimal test which cause this issue. Then I will be able to solve it by cloning and debug locally. Worst case will be to open a PR to TrustKit if I won't be able to add a fix in detox (As the swizzling here done correctly). @deecewan @walterholohan

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

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

deecewan commented 3 years ago

keep open

hollanderbart commented 3 years ago

Based on @walterholohan solution I use the following code in AppDelegate.m. This seems to work.

  BOOL IS_DETOX = [[[NSProcessInfo processInfo] arguments] containsObject: @"-detoxServer"];
  NSDictionary *trustKitConfig =
  @{
    kTSKSwizzleNetworkDelegates: @(!IS_DETOX),
    kTSKPinnedDomains: @{
    ...
    }};
  [TrustKit initSharedInstanceWithConfiguration:trustKitConfig];
parkcoop commented 3 years ago

Looking for "-detoxServer" is still a good solution

Swift:

let IS_DETOX: Bool = ProcessInfo.processInfo.arguments.contains("-detoxServer")
let trustKitConfig: [String: Any] = [
      kTSKSwizzleNetworkDelegates: !IS_DETOX,
gabimoncha commented 3 years ago

I've disabled both TrustKit and Flipper, updated detox to the latest version and app still hangs after terminating and launching with the same instance, or by reloading react native.

Detox: 18.23.1 React Native: 0.64.2 Node: 16.9.1 Device: iPhone 12 iOS 14.5 Xcode: 13 iOS: 14.5 macOS: 11.6

Numan-Munir commented 1 year ago

I've disabled both TrustKit and Flipper, updated detox to the latest version and app still hangs after terminating and launching with the same instance, or by reloading react native.

Detox: 18.23.1 React Native: 0.64.2 Node: 16.9.1 Device: iPhone 12 iOS 14.5 Xcode: 13 iOS: 14.5 macOS: 11.6

React Native minimum version should be 0.68.x https://github.com/wix/Detox