【问题标题】:Rotate Android Emulator In Espresso Test [duplicate]在 Espresso 测试中旋转 Android 模拟器 [重复]
【发布时间】:2020-10-12 13:57:16
【问题描述】:

我目前可以通过执行以下操作从我的 espresso 测试中旋转我的应用程序的显示:

val currentActivity = getCurrentActivity()
currentActivity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
getInstrumentation().waitForIdleSync()

但是,这只会旋转显示;模拟器本身保持纵向模式。我已将自动旋转设置打开/旋转屏幕的内容。

有谁知道如何让模拟器也旋转?

【问题讨论】:

标签: android android-espresso android-instrumentation


【解决方案1】:

You can rotate the display using emulator commands over telnet.

From the docs:

$ telnet localhost 5554
...
auth 123456789ABCdefZ
...
rotate
...

(在 macOS 上,您可能需要brew install telnet

【讨论】:

  • 我在问如何通过 UI espresso 测试来旋转它。
猜你喜欢
  • 1970-01-01
  • 2015-11-06
  • 1970-01-01
  • 2013-11-12
  • 1970-01-01
  • 1970-01-01
  • 2022-11-20
  • 1970-01-01
  • 2013-02-28
相关资源
最近更新 更多