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>
28 lines
731 B
Python
28 lines
731 B
Python
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()
|