如何在 Travis 中禁用 Android 模拟器动画?
How to disable Android emulator animations in Travis?
我正在 运行在 Travis CI 中进行 Espresso 测试。当我 运行 在我的设备中进行测试时,我通常会禁用所有动画,因此我不必一直使用 Thread.sleep。
但我真的不知道如何在 Travis CI 中执行此操作,所以没有 Thread.sleep 我的测试失败了。我浏览了互联网...但我没有找到任何关于如何在模拟器中禁用动画的教程
我知道我可以在 Espresso 中使用闲置资源。但有时我不想这样做。
如果可能使用 adb shell 命令:
adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0
在詹金斯上测试ci
如果你试试@azizbekian 的路径,我写过这个here, created new test rules here and tested it here
我确认@Testujaca Malpeczka 路径在 Travis-ci 上适用于 Android API 17-22,如所讨论的 here
如果您正在寻找最新 Android API 和工具的解决方案,工作正在进行 and
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 和可能的任何持续集成构建服务器,参见 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 模拟器中存在错误。
改天我会使用 android-topeka 示例在 24+ 的更高版本中尝试它,可能它有效。
任何使用 sdkmanager
的帮助、改进或有效的替代方法都将非常感谢ci。
我正在 运行在 Travis CI 中进行 Espresso 测试。当我 运行 在我的设备中进行测试时,我通常会禁用所有动画,因此我不必一直使用 Thread.sleep。
但我真的不知道如何在 Travis CI 中执行此操作,所以没有 Thread.sleep 我的测试失败了。我浏览了互联网...但我没有找到任何关于如何在模拟器中禁用动画的教程
我知道我可以在 Espresso 中使用闲置资源。但有时我不想这样做。
如果可能使用 adb shell 命令:
adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0
在詹金斯上测试ci
如果你试试@azizbekian 的路径,我写过这个here, created new test rules here and tested it here
我确认@Testujaca Malpeczka 路径在 Travis-ci 上适用于 Android API 17-22,如所讨论的 here
如果您正在寻找最新 Android API 和工具的解决方案,工作正在进行
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 和可能的任何持续集成构建服务器,参见 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 模拟器中存在错误。
改天我会使用 android-topeka 示例在 24+ 的更高版本中尝试它,可能它有效。
任何使用 sdkmanager
的帮助、改进或有效的替代方法都将非常感谢ci。