-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS: WaitFor Method using withTimeout is setting test into constant Loop and it will not go on #4449
Comments
@alexandravychytill I suspect that the app's main thread is blocked even before the wait-for assertion. To verify, you can try the assertion without the wait-for and timeout parts and see if you get the same result. The issue with the main thread can happen for various reasons, and you might find our troubleshooting documentation helpful for this If you continue to face difficulties with this issue, consider using the following workaround flag for DetoxSync to bypass the main run-loop sync issue: await device.launchApp({
...
launchArgs: {
DTXDisableMainRunLoopSync: true,
}
}); |
So I tried the launchArgs, but still when using the setTimout function it is looping with this message:
The app on it's own is loading a few seconds due to internet connection after login, thats why I use the setTimout function, so all AC are visible after internet connection is established. On Android setTimout is working fine as said, but on iOS still there is always a loop when using it. |
@asafkorem Is there anything else to do other than adding the launchArgs? I updated the detox version to the latest in my package.json, but I have the feeling this flag doesn't change anything.
|
@asafkorem Is it possible, that .withTimeout(timeout) is just not working currently for iOS? |
Feel like my issue is related to #4282, was there ever a good solution found @asafkorem? Additional log:
|
@alexandravychytill are you sure the app didn't crash or something? |
@mroswald are you sharing the same app and issue with @alexandravychytill? if not, can you please open a different issue and provide the error message + logs you're getting? If that's not the same case it might be a different issue.. |
No, just wanted to know more about this flag as it's not documented anywhere. |
@mroswald This is not-official or documented on purpose, I'm testing this new behaviour (experimental). |
@asafkorem so after some investigation I found out, that the webview is causing my synchronization issue. As in the issue #4438 described, when sharedCookiesEnabled is set to true, the synchronization problem on iOS is happening. My current fix is to disable sharedCookiesEnabled when testing with detox. But I would appreciate if you could investigate further and find a fix, so detox tests on iOS do not crash when sharedCookiesEnabled is true 😊 |
What happened?
await waitFor(element(by.id(elementId))) .toBeVisible() .withTimeout(timeout); sets test into constant loop, for android current implementation working all fine.
Message:
The app is busy with the following tasks:
• There are 2 work items pending on the dispatch queue: "Main Queue (<OS_dispatch_queue_main: com.apple.main-thread>)".
• Run loop "Main Run Loop" is awake.
What was the expected behaviour?
only should go on till as defined amount of seconds
Was it tested on latest Detox?
Did your test throw out a timeout?
Help us reproduce this issue!
await waitFor(element(by.id(""))) .toBeVisible() .withTimeout(5000);
In what environment did this happen?
Detox version: 20.20.1
React Native version: 0.72.0
Has Fabric (React Native's new rendering system) enabled: yes
Node version: >=16
Device model: iPhone 15
iOS version: 17.2
macOS version: 14.4
Xcode version: 15.2
Test-runner (select one): jest
Detox logs
Detox logs
Device logs
Device logs
More data, please!
No response
The text was updated successfully, but these errors were encountered: