Disable RN Timers and Animation synchronization to prevent tests from stalling
See original GitHub issueIs your feature request related to a problem? Please describe.
It’s related to a problem we’ve been facing at Skyscanner. Some of our tests were stalling in Android because of ReactNativeTimersIdlingResource.isIdleNow() and AnimatedModuleIdlingResource.isIdleNow() never returning true in some cases. I couldn’t identify exactly when this happens since some of the times this happened we didn’t have any infinite animations running in that particular screen.
Describe the solution you’d like
We already have the disableSynchronization() function but that’s only disabling the network synchronization. So my proposal is to add similar methods to disable RN timers synchronization and animation synchronization. You can see an already implemented version of this here: https://github.com/leanmazzu/Detox/commit/efb0dcfd799ffea3d91bd1c8e46ee84df3950dd6. This is what we currently have in place in our Skyscanner fork and it’s working just fine for us.
Describe alternatives you’ve considered N/A
Additional context
This would be a non-breaking change as it’s not modifying the current disableSynchronization() method or anything else.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:45 (17 by maintainers)
Top Related StackOverflow Question
@Grohden kudos for getting that fixed - even though that in essence, I advise not to disable animations in E2E-level testing. Rather, in our projects, we’ve force-disabled animations mocking altogether: https://github.com/facebook/react-native/issues/27010#issuecomment-573645965
I’m hitting a similar issue,
UIManagerModuleis always busy (because of a looping animation). Was about to implement disable myself but found this! Thanks @leanmazzu for the PR!@maxime-helen I found it useful to check the instrumentation app logs:
adb logcat *:S Detox:V -T 50If your app is stuck and those actions are timing out then check the logs for messages like"UIManagerModule is busy"