18

I recently discovered the property testOptions.animationsDisabled in the Android Gradle plugin.

I was hoping it would be helpful to disable the animations on my devices when executing UI tests with Espresso, but it's not, i.e. I still have to disable the animations manually or using one of several options available. Otherwise some UI tests become flaky.

Since the description of this property is rather short, does anyone know how it's meant to be used?

My gradle file is as follows:

apply plugin: 'com.android.application'
android {
    testOptions {
        animationsDisabled = true
    }
}

Thanks.

JDurstberger
  • 4,127
  • 8
  • 31
  • 68
Philippe A
  • 1,252
  • 9
  • 22
  • This is also a good place to see what are the test options for Android apps, but it's not documented here either https://developer.android.com/studio/test/index.html#test_options – Philippe A Apr 19 '17 at 11:26
  • 7
    I downloaded the source code for the gradle plugin 2.3.3 and as far as I can see the flag is set in the `TestOptions` class and then accessed from there and set on `AbstractTestDataImpl`. From there it is not used again :(. I don't think this flag is doing anything. – JDurstberger Aug 10 '17 at 07:37
  • Anybody know if this is fixed or if there's a link to a github issue that can be voted on? – nAndroid Oct 26 '20 at 15:41

2 Answers2

6

Unfortunately, nothing.

I added a comment a while ago that it is not used in the 2.3.3 plugin.

I hoped something changed with the Android Studio 3.1 and androidGradle 3.1 plugin release but that isn't the case.

I think it is a bit misleading that this flag exists and isn't better documented

Edit:

I have been forwarded this blog post that explains how to set up a test rule that disables animations for you.

https://proandroiddev.com/one-rule-to-disable-them-all-d387da440318

JDurstberger
  • 4,127
  • 8
  • 31
  • 68
-1

You should be upgrade build:gradle:2.3.0'

and build

simple:

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.0'
}
maomao
  • 1