Open christianchown opened 4 years ago
We are working on removing usage of Earl Grey on iOS, so we might be able to squeeze this soon.
In the meantime, mock your code to limit whatever it is you have with long timers to be limited to 1.5 seconds.
Thanks, that would be great if you can squeeze it in. In the meantime, we've done what you've suggested
@christianchown it's not entirely accurate - that an expect
would fail in this state (namely, with a timer set to >1.5sec from "now"). It's a rule-of-thumb threshold we use for assessing whether an app is Idle (e.g. following an action). Do you have a specific use case in mind where this breaks a test, in particular?
@d4vidi The 1.5 time cutoff is used for every timer fired by the app. So if an animation is fired that takes longer than 1.5 seconds to finish, Detox will ignore it and proceed with the test, thus resulting in a failure.
@LeoNatan Aren't animation monitored independently on iOS, as on Android?
Native animations are. But RN isn’t native in any sense of the word, especially JS “animations”.
Yes that's what I meant. I understand that's a no.
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.
The issue has been closed for inactivity.
Let's revisit this. If this has been resolved, maybe we should add something to documentation.
Is your feature request related to a problem? Please describe. Currently, an
expect()
will fail if asetTimeout()
is enacted that is longer than 1.5 seconds, as the documentation states hereThe current workaround is to swap out
expect()
for a combination ofwaitFor()
andwithTimeout()
. As the documentation states, you should only usewaitFor/withTimeout
as a last resort.Describe the solution you'd like For there to be an additional
launchApp
configuration setting that allows for a differentsetTimeout
limitAdditional context From a very quick scan of the code, I think the currently hard-coded constants for the timeout setting are here:
iOS: https://github.com/wix/Detox/blob/57300d5970b6facf1468f2abc59e8fab641404c2/detox/ios/Detox/WXJSTimerObservationIdlingResource.m#L114
Android: https://github.com/wix/Detox/blob/d8cf10e375188ae55980b3fea36022674b6f08eb/detox/android/detox/src/main/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategy.kt#L10