feat: add on-demand device screenshots
Tests / Test apps.device-host-agent.tests.test_mcp_token.test_load_or_create_concurrent_calls_do_not_corrupt failed
Tests / Test apps.device-host-agent.tests.test_mcp_token.test_load_or_create_concurrent_calls_do_not_corrupt failed
This commit is contained in:
@@ -81,6 +81,13 @@ class AndroidDriver(Driver):
|
||||
except Exception as exc:
|
||||
raise DriverError("screenshot failed") from exc
|
||||
|
||||
def health_check(self) -> None:
|
||||
client = self._require_client()
|
||||
try:
|
||||
client.get_status()
|
||||
except Exception as exc:
|
||||
raise DriverError("health check failed") from exc
|
||||
|
||||
def tap(self, x: float, y: float) -> None:
|
||||
client = self._require_client()
|
||||
try:
|
||||
|
||||
@@ -25,6 +25,15 @@ class Driver(ABC):
|
||||
def screenshot(self) -> bytes:
|
||||
"""Return the current screen as image bytes."""
|
||||
|
||||
def health_check(self) -> None:
|
||||
"""Verify the live session without reading the device screen.
|
||||
|
||||
Drivers with a transport-level status endpoint should override this
|
||||
method. The default is a no-op for legacy drivers that do not expose
|
||||
a separate health check.
|
||||
"""
|
||||
return None
|
||||
|
||||
@abstractmethod
|
||||
def tap(self, x: float, y: float) -> None:
|
||||
"""Tap the screen at the given coordinates."""
|
||||
|
||||
@@ -71,6 +71,13 @@ class WDADriver(Driver):
|
||||
except Exception as exc:
|
||||
raise DriverError("screenshot failed") from exc
|
||||
|
||||
def health_check(self) -> None:
|
||||
client = self._require_client()
|
||||
try:
|
||||
client.get_status()
|
||||
except Exception as exc:
|
||||
raise DriverError("health check failed") from exc
|
||||
|
||||
def tap(self, x: float, y: float) -> None:
|
||||
client = self._require_client()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user