如何在Travis中禁用Android模拟器动画? [英] How to disable Android emulator animations in Travis?
问题描述
我正在Travis CI中运行Espresso测试.当我在设备上运行测试时,通常会禁用所有动画,因此不必一直使用Thread.sleep.
I am running Espresso tests in the Travis CI. When I run my tests in my device, I normally disable all my animations so I don't have to use Thread.sleep all the time.
但是我真的不知道如何在Travis CI中执行此操作,因此如果没有Thread.sleep,我的测试将失败.我在互联网上看了一下...但是我没有找到有关如何禁用模拟器中动画的任何教程
But I really don't know how to do this in the Travis CI, so my tests fail without the Thread.sleep. I looked over the internet... but I didn't find any tutorial about how to do disable the animations in the emulator
我知道我可以在Espresso中使用空闲资源.但是有时候我不愿意.
I could use idling resource in Espresso, I know. But some times I would prefer not to.
推荐答案
如果您尝试@azizbekian的路径,我会写这个此处,创建了新的测试规则此处
If you try @azizbekian's path, I wrote about this here, created new test rules here and tested it here
我确认@Testujaca Malpeczka路径在Travis-ci上适用于Android API 17-22,如所讨论的
I confirm @Testujaca Malpeczka path works on Travis-ci for Android APIs 17-22 as discussed here
如果您正在寻找最新的Android API和工具的解决方案,请在此处和
If you are looking for a solution for latest Android APIs and tools, work in progress here and here
before_script:
# Wait for emulator fully-booted and disable animations
- android-wait-for-emulator
- 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 &
- adb shell input keyevent 82 &
它还可以在Circle-ci和可能的任何持续集成构建服务器中使用,请参见
It also works in Circle-ci and probably any continuous integration build server, see broken link here
test:
pre:
- ...
- circle-android wait-for-boot
- adb shell input keyevent 82
- 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
我的扩展测试规则适用于Android API 15-22,并且Android 23仿真器中存在一个错误.
My extended test rules work for Android APIs 15-22, and there was a bug in Android 23 emulator.
第二天,我将使用android-topeka示例在24+的更高版本中尝试使用它,
I'll try it for later versions 24+ using android-topeka sample another day, probably it works.
任何使用sdkmanager
的帮助,改进或有效的替代方法,将不胜感激.
Any help, improvement or effective alternative using sdkmanager
would be much appreciated.
这篇关于如何在Travis中禁用Android模拟器动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!