Skip to content

ghostbuster91/espresso-animations-disabled-test

Repository files navigation

Espresso animations test

It is not a secret that espresso fails when there are some animations in your application.

But not many people know that there is a flag for disabling animations in tests:

testOptions {
    animationsDisabled = true
}

Link to official documentation: here

Ok, that's great, but does it really work? Do I still have to turn off animations manually? (Setting window_animation_scale and transition_animation_scale and animator_duration_scale to 0)

TDLR; Yes, it mostly works.

Also thanks to dryrun you can try it yourself.

Just run dryrun -a git@github.com:ghostbuster91/espresso-animations-disabled-test.git

Overview

Because it is very hard to find any information about this flag I decided to check it by myself. To do this I ran some tests against emulators with apis within range <16, 26>.

My tests consists of:

  • checking if progress bar is visible
  • checking if snackbar is visible
  • performing click on snackbar action

Results: Below tables show what should be the state of animation settings so the corresponding tests passed, while having this flag turned on.

The row animations represents the state of animations which can be altered through settings screen or adb commands.

Assert progressBar is visible:

API level 16 17 18 19 21 22 23 24 25 26
Animations DM DM DM DM ON ON ON OFF DM DM

DM stand for doesn't matter

OFF means that animations have to be turned off

ON means that animations have to be turned on

Assert snackbar is visible:

API level 16 17 18 19 21 22 23 24 25 26
Animations DM DM DM DM OFF OFF OFF OFF OFF OFF

Assert snackbar is clickable:

API level 16 17 18 19 21 22 23 24 25 26
Animations DM DM DM DM DM DM DM DM DM DM

Summary:

The animationsDisabled flag is not a silver bullet. It can helps us a lot, but on some apis there is no easy solution to get espresso work with animations.

E.g. On api 22 we can't have both progressBar and snackbar working.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages