From df96ab45fdf5f14ed8b911d519bc52450a68ceeb Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Sun, 16 Aug 2026 14:35:57 +0200 Subject: [PATCH] fix(appium-tests): give the USB permission dialog a real timeout after replug Re-enumeration and the system permission dialog can lag several seconds while the guest is under heavy write I/O; the previous 1s wait made the unplug tests flaky. --- appium-tests/etchdroid/actions.py | 4 ++-- appium-tests/tests/test_qemu.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/appium-tests/etchdroid/actions.py b/appium-tests/etchdroid/actions.py index 09b667a..ef97ee9 100644 --- a/appium-tests/etchdroid/actions.py +++ b/appium-tests/etchdroid/actions.py @@ -53,8 +53,8 @@ def grant_usb_permission(driver: Remote): pass -def accept_usb_permission(driver: Remote): - ok_btn = wait_for_element(driver, '//*[@text="OK"]', timeout=1) +def accept_usb_permission(driver: Remote, timeout: float = 1): + ok_btn = wait_for_element(driver, '//*[@text="OK"]', timeout=timeout) ok_btn.click() diff --git a/appium-tests/tests/test_qemu.py b/appium-tests/tests/test_qemu.py index ea83a8b..8116738 100644 --- a/appium-tests/tests/test_qemu.py +++ b/appium-tests/tests/test_qemu.py @@ -52,7 +52,9 @@ def unplug_and_reconnect_usb( sleep(3) mark("Accepting permission...") - app.accept_usb_permission(driver) + # Generous timeout: re-enumeration and the permission dialog can lag several seconds + # while the guest is under heavy write I/O. + app.accept_usb_permission(driver, timeout=15) @pytest.fixture(scope="function") @@ -240,7 +242,7 @@ def test_unplug_resume_from_notification( # A patch should be submitted to libaums to handle this. sleep(3) - app.accept_usb_permission(driver) + app.accept_usb_permission(driver, timeout=15) skip_btn = app.get_skip_verify_button(driver) skip_btn.click()