When running test on iOS, errors are thrown for javascript timers on the main thread. Documentation states that animation synchronisation can be turned off but does not specify how.
Is there a formal way of turning off animation synchronisation ?
detox info Sync WXRunLoopIdlingResource: React Native thread is busy.
detox info Sync WXAnimatedDisplayLinkIdlingResource: undefined
detox info Sync JavaScript Timers: Javascript Timers Ids: 444
detox info Sync App State: Waiting for an animation to finish. Continuous animations may never finish and must be stopped explicitly. Animations attached to hidden view may still be running in the background.
detox info Sync Waiting for network requests to finish.
detox info Sync Waiting for view's draw or layout pass to complete.: (
detox info Sync "http://localhost:8081/assets/app/assets/images/[email protected]?platform=ios&hash=0681e25e9fbb3bfb14bf639eeb245a1d",
detox info Sync )
detox info Sync Dispatch Queue: com.apple.main-thread
detox verb ws send: {"type":"currentStatus","params":{},"messageId":24}
detox verb ws onMessage: {"type":"currentStatusResult","messageId":24,"params":{"state":"busy","resources":[{"name":"JavaScript Timers","info":{"javascriptTimerIDs":[874],"prettyPrint":"Javascript Timers Ids: 874"}},{"name":"Dispatch Queue","info":{"queue":"<OS_dispatch_queue_main: com.apple.main-thread[0x11315cdc0] = { xref = -2147483648, ref = -2147483648, sref = 1, target = com.apple.root.default-qos.overcommit[0x11315e300], width = 0x1, state = 0x001ffe9e00000400, dirty, max qos 6, in-flight = 0, thread = 0x403 }>","prettyPrint":"com.apple.main-thread"}}],"messageId":24}}
detox verb ws
detox info Sync JavaScript Timers: Javascript Timers Ids: 874
detox info Sync Dispatch Queue: com.apple.main-thread
detox verb ws send: {"type":"currentStatus","params":{},"messageId":25}
detox verb ws onMessage: {"type":"currentStatusResult","messageId":25,"params":{"state":"busy","resources":[{"name":"JavaScript Timers","info":{"javascriptTimerIDs":[936],"prettyPrint":"Javascript Timers Ids: 936"}},{"name":"Dispatch Queue","info":{"queue":"<OS_dispatch_queue_main: com.apple.main-thread[0x11315cdc0] = { xref = -2147483648, ref = -2147483648, sref = 1, target = com.apple.root.default-qos.overcommit[0x11315e300], width = 0x1, state = 0x001ffe9e00000400, dirty, max qos 6, in-flight = 0, thread = 0x403 }>","prettyPrint":"com.apple.main-thread"}}],"messageId":25}}
detox verb ws
await device.disableSynchronization(); will disable all synchronization.
@rotemmiz is there no method to just disable animation synchronisation rather than the entire synchronisation engine ?
See below for the documentation which implies that this may be possible
Endless looping animations
By default, Detox will wait until animations complete. If you have an endless looping animation,
this may cause Detox to hang. In this case, consider turning off the animation synchronisation...
Also Earl Grey has this method to alter the animaton timeout, will detox support this?
[[GREYConfiguration sharedInstance] setValue:@(30.0)forConfigKey:kGREYConfigKeyCALayerMaxAnimationDuration];
I don't think we exposed the EG configurations to Detox.
But I doubt that configuration will be at any help in your case.
RN does not use system animations (React "Native"); it either uses timers (yuck) or its own native animation implementation (useNativeDriver). In the timers case, there isn't much we can do to differentiate between legit app timers and animation timers. We do some logic to try and minimize false positives, but there will always be cracks to fall through.
Are you using Animated? If so, try setting useNativeDriver to true and see if that helps.
@LeoNatan @rotemmiz
I have used useNativeDriver for all animations present however I still receive this stack trace when debugging synchonization
Timed: animateWithDuration:delay:options:animations:completion:
detox info Sync Timed: animateWithDuration:delay:options:animations:completion:
detox info Sync WXAnimatedDisplayLinkIdlingResource: undefined
detox info Sync Dispatch Queue: com.apple.main-thread
detox info Sync WXAnimatedDisplayLinkIdlingResource: undefined
detox info Sync Dispatch Queue: com.apple.main-thread
detox info Sync WXAnimatedDisplayLinkIdlingResource: undefined
What else can be done to remove these errors ?
I'm running into something similar too. When updating from detox 5.10.0 to 6.0.4 I have a particular test that also gets stuck. When using --debug-synchronization I see detox info Sync Dispatch Queue: com.apple.main-thread too.
One thing I found was that my test was working if I removed the surrounding <Modal>. In the modal, even with all animations turned off it would not work.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
Did you guys find a solution for this?
As an FYI, if you are using Lottie, it will hang. Disabling animations on Lottie makes things work.
@ericlewis Do you mind opening a new issue for the Lottie situation and attaching a small sample project where this reproduces? Thanks
@ericlewis we have the same problem :-( did you find a workaround? Would really help us