feat(driver): add Driver.long_press on WDA and Android
This commit is contained in:
@@ -103,6 +103,7 @@ def test_connect_failure_raises_device_offline_and_clears_client() -> None:
|
||||
("lock", {}),
|
||||
("unlock", {}),
|
||||
("disconnect", {}),
|
||||
("long_press", {"x": 1, "y": 2}),
|
||||
],
|
||||
)
|
||||
def test_operation_before_connect_raises_device_offline(
|
||||
@@ -255,6 +256,21 @@ def test_swipe_near_zero_distance_uses_default_speed() -> None:
|
||||
assert speed > 0
|
||||
|
||||
|
||||
def test_long_press_uses_long_click_gesture() -> None:
|
||||
driver = _connected_driver()
|
||||
driver.long_press(30, 40, duration_ms=1500)
|
||||
driver._client.execute_script.assert_called_once_with(
|
||||
"mobile: longClickGesture", {"x": 30, "y": 40}
|
||||
)
|
||||
|
||||
|
||||
def test_long_press_wraps_exception_into_driver_error() -> None:
|
||||
driver = _connected_driver()
|
||||
driver._client.execute_script.side_effect = RuntimeError("boom")
|
||||
with pytest.raises(DriverError):
|
||||
driver.long_press(1, 2)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# build_android_driver_factory
|
||||
# --------------------------------------------------------------------------- #
|
||||
|
||||
Reference in New Issue
Block a user