bitrise-steplib / steps-virtual-device-testing-for-android

MIT License
22 stars 23 forks source link

Disable animation while running Espresso tests #25

Closed CoreFloDev closed 2 years ago

CoreFloDev commented 6 years ago

Hi,

We are using this emulator to run Android Espresso tests on Bitrise. One of the requirement to avoid flaky tests, is to disable animations on the device as specified in the documentation https://developer.android.com/training/testing/espresso/setup

Unfortunately, it seems that there is no option to disable animations. Is it possible to add a parameter to disable them? Or maybe I am just missing something?

To disable the animation, this command work well:

adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0

Please tell me if you need more details

Thanks!

bitce commented 6 years ago

Hi @CoreFloDev ! Indeed, animations are not off by default, and you may run the exact script you mentioned to disable them!

Or are you meaning to submit this to us as a feature request, to include this option in the step by default? :)

shendriksen commented 6 years ago

Hi @bitce,

We are using the '[BETA] Virtual Device Testing for Android' step on Bitrise.

This step bring up an emulator, runs the tests and destroys the emulator.

Our problem is that we cannot place a step before or after this step to disable animations as the emulator will not exist during those times.

Ideally it would be nice to setup hooks on the Virtual Device step so that we can run the above adb commands when the emulator is created. Alternatively an option to disable animations would be nice.

bitce commented 6 years ago

Hey @shendriksen,

Sorry, should have clarified first that in order to do this you need the Android Debug Bridge, as this would allow you to connect to the device in the meantime and run the adb commands.

shendriksen commented 6 years ago

@bitce we are currently using the following steps:

image

We would like to use ADB as you mention but putting a script with the below, before or after '[BETA] Virtual Device Testing for Android', will not work.

adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0

Do you have an example of what you are suggesting please?

Thanks

bitce commented 6 years ago

Sorry again, to summarize: you indeed can not add a script step to accomplish this. What I mean to suggest is that you can, in fact, set up adb and connect to the virtual device you are running the test on, and run these commands through the adb CLI during the test.

shendriksen commented 6 years ago

Thanks @bitce.

I have opened a feature request for the ability to run scripts after the device has booted: https://discuss.bitrise.io/t/beta-virtual-device-testing-for-android-custom-adb-script-option/5813

bitce commented 6 years ago

Sure thing!

I'm glad to hear that! We'll get back to you there too 😉

tir38 commented 6 years ago

Have you actually seen this as a problem? Since this step is backed by AVDs on Firebase Test Lab, Bitrise users aren't the only ones with this problem. (i.e. i bet Firebase has animations turned off by default). You could always add this to your build.gradle (helpful for local testing too)

        testOptions {
            animationsDisabled true
        }
bitrise-coresteps-bot commented 2 years ago

Hello there, I'm a bot. On behalf of the community I thank you for opening this issue.

To help our human contributors focus on the most relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 90 days, so I marked it as stale.

The community would appreciate if you could check if the issue still persists. If it isn't, please close it. If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me".

If no comment left within 21 days, this issue will be closed.

CoreFloDev commented 2 years ago

I don't use Bitrise on my new projects so no