test(appium): scale element waits in CI

This commit is contained in:
Davide Depau committed 2026-08-12 16:31:40 +02:00
1 parent 862fb9cfd6
commit 1bf2e9975e
2 files changed
+10

No files matched your search

+6
View File
@@ -13,6 +13,12 @@ class Config:
QEMU_USB_SLOW_BUS = os.environ.get("QEMU_USB_SLOW_BUS", "uhci.0")
QEMU_USB_DEV_ID = os.environ.get("QEMU_USB_DEV_ID", "usbstick")
# Every Appium element wait is multiplied by this. CI has no host GPU, so the guest
# software-renders (see appium-tests/scripts/vm-config.sh) and first-frame latency
# regularly exceeds the short timeouts the flow helpers use. Locally the guest is
# GPU-accelerated, so 1x keeps failures quick to report while iterating.
WAIT_TIMEOUT_SCALE = float(os.environ.get("WAIT_TIMEOUT_SCALE", "5" if os.environ.get("CI") else "1"))
DISABLE_SETUP = os.environ.get("DISABLE_SETUP", "0") == "1"
DISABLE_SHUTDOWN = os.environ.get("DISABLE_SHUTDOWN", "0") == "1"
+4
View File
@@ -5,6 +5,7 @@ import tempfile
from appium.webdriver.common.appiumby import AppiumBy
from collections import namedtuple
from contextlib import contextmanager
from etchdroid.config import Config
from pathlib import Path
from selenium.common import ElementNotVisibleException, NoSuchElementException
from selenium.webdriver.support.wait import WebDriverWait
@@ -39,6 +40,9 @@ def wait_for_element(
xpath: str,
timeout: float = 3,
) -> appium.webdriver.WebElement:
# Capped so that scaling up doesn't turn a genuine failure in one of the 120s waits into a
# ten-minute stall.
timeout = min(timeout * Config.WAIT_TIMEOUT_SCALE, 120)
wait = get_wait(driver, timeout)
return wait.until(
lambda x: x.find_element(