feat(driver): add Android UiAutomator2 driver
Tests / Test No test results found

Register `SUPPORTED_DRIVER_TYPES["uiautomator2"]` backed by the new
`AndroidDriver`, mirroring `WDADriver` method-for-method. tap/swipe/home use
the confirmed UiAutomator2 mobile commands (`clickGesture`, `dragGesture`,
`pressKey`); swipe converts `duration_ms` to a drag speed with a zero-distance
guard. Adds 34 mocked unit tests, an env-var-gated integration test, and
corrects the outdated "Android not registered" note in the iPhone setup doc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-13 14:47:01 +08:00
co-authored by Claude Opus 4.6
parent 2ccbc63d95
commit 50f0b8ade9
6 changed files with 561 additions and 18 deletions
+27
View File
@@ -0,0 +1,27 @@
from __future__ import annotations
import os
import pytest
from driver.android_driver import AndroidDriver, AndroidDriverConfig
@pytest.mark.integration
def test_android_driver_screenshot_against_real_device() -> None:
server_url = os.getenv("APEX_ANDROID_SERVER_URL")
if not server_url:
pytest.skip("set APEX_ANDROID_SERVER_URL to run Android hardware integration")
driver = AndroidDriver(
AndroidDriverConfig(
server_url=server_url,
udid=os.getenv("APEX_ANDROID_UDID") or None,
device_name=os.getenv("APEX_ANDROID_DEVICE_NAME") or None,
)
)
driver.connect()
try:
assert driver.screenshot()
finally:
driver.disconnect()