A tap that lands while a dialog is still animating in is dropped, and
the click call succeeds either way, so the test walked on believing the
dialog was dismissed. It was not: the recording shows the notification
permission dialog still covering a success screen the test then spent
two minutes failing to find, because a system dialog on top is the only
window in the accessibility tree.
Click these until the dialog is actually gone.
Two races, same cause: the tests had to complete a slow detour through
system UI before the job outran them. The banner only exists while the
job runs, and the skip-verification button only during verification, so
on CI the job was often over first.
Give both jobs room to outlast the detour, and drop the skip click from
these two -- they are about the banner, and test_skip_verification
already covers the button, so waiting for success removes the second
race entirely.
Lower the image size cap as well: with seconds-based windows, a fast
host turns a longer window into gigabytes of pointless I/O, while CI
stays far below the cap.
A fixture imported into two test modules becomes two definitions with
separate caches, so the session-scoped calibration write ran once per
module -- about 70s wasted on CI. Re-export it from conftest instead.
Poll dumpsys usb after a hot-plug instead of sleeping a fixed 2s: the
framework's view is what the app sees, and a fixed sleep loses the race
on slow hosts, so the flow started while the detach had been processed
but not the attach.
Restore the original drive when a setup or reconnect step fails. A
fixture that fails during setup never runs its teardown, so one failure
left every later test with no USB drive at all.
Also drop the over-sized unplug images: both unplugs happen in
different phases (one during the write, one during verification), so
one window is enough, and the bigger job pushed wait_for_success past
its 120s cap because each resume replays work.
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.
Apply the measured-speed image sizing to the unplug tests, and
replace the fixed 10 MB pushed payload with dd from /dev/urandom on
the device: pushing speed-scaled amounts of data through Appium as
base64 would take longer than the test itself. Written data is now
verified via sha256 instead of a byte-for-byte payload comparison,
and the host-side raw target image is sized to match (sparse: a
zeroed target cannot false-match a random source).
Emulated USB speed varies by orders of magnitude between hosts, and
fixed image sizes made the timing-sensitive tests flaky: on a fast
host the write finished before the harness could click the skip
verification button.
Measure the drive's throughput once per session with a small
app-driven speedtest write, timed from the app's own logcat
timestamps so UI latency cannot skew it, and size each generic test's
image so the write phase lasts TARGET_WRITE_SECONDS (env-tunable).
The calibration flow retries once, absorbing a known first-boot file
picker flake that would otherwise error every test in the session.