Hi guys, how can I disable animations when running...
# android
d
Hi guys, how can I disable animations when running espresso tests? Have done everything I found on SO, everywhere. Yet animations done by : view.animate()... keep disabling my tests to continue running. Please some light here. Tried DisableAnimation rules, also gradle configurations, nothing works, few animations are disabled, OS level like transitions, but view animations are not. Kind regards.
w
If you run the animations manually, you need to scale the duration based on system animation duration scale
Copy code
val Context.animationDurationScale: Float
    get() = Settings.Global.getFloat(this.contentResolver, Settings.Global.ANIMATOR_DURATION_SCALE, 1f)
At least that’s what we’ve been doing
For some animations, disabling them are not possible, like material bottom sheet 😕
d
thanks, yes, already noticed and there are some animations we have to disable with flags for the espresso builds 😞