Skip to content

ci(zbugs-swift): warm the app up before the screenshot tests - #204

Merged
tmm merged 1 commit into
mainfrom
fix/zbugs-screenshots-warm-up
Nov 14, 2026
Merged

tmm merged 1 commit into
mainfrom
fix/zbugs-screenshots-warm-up

Conversation

@tmm

@tmm tmm commented Nov 14, 2026

Copy link
Copy Markdown
Member

testListPagesPastTheFirst200 fails about one zbugs-screenshots run in seven, each time in a different way. A back tap doesn't navigate ("No the Status picker"), a launch query times out, or the final screenshot times out.

Cause. All 6 failures since Nov 3 (5 on iPhone, 1 on iPad) happened in the first UI test after the simulator booted. Tests run in alphabetical order, so that is always this test. Its app launch took 9–79 s on CI, against 3–12 s for testScreens on the now-warm simulator, and testScreens has never failed. A diagnostic run showed the runner I/O-starved (load 100–450) while the simulator's first-boot daemons were still busy. XCTest evaluates element queries on the app's main thread, which the first sync keeps busy, so queries, taps, and screenshot requests stall. On iOS 26, a back tap that is synthesized slowly enough becomes a long press, which opens the back-history menu instead of navigating. CI logged about 20 s between "Find" and "Synthesize" on the lost tap, so that is the likely mechanism, though it isn't proven.

Fix.

  • After booting each simulator destination (except offline), the job builds for testing, installs the app, and launches it once outside XCTest.
  • It waits until zero-cache has sent the app its issuePreloadV2 and the app's CPU has gone quiet, then terminates the app. The tests then run on the warm simulator, reusing the same derived data.
  • The warm-up is best effort, capped at 4 minutes, and prints how long it took.
  • On iPhone, if the filters haven't appeared 10 s after the back tap and the back button is still there, the test taps it again.

Checks. On a Mac (macos-26, Xcode 26.3), the extracted step run on an erased simulator warmed up in 11 s, and both tests passed. CI-load repeat results are below.

Every failure of testListPagesPastTheFirst200 since Nov 3 was the first
UI test after the simulator booted: a back tap lost, a launch query or a
screenshot request timed out. Its launch took 9-79 s on CI against 3-12 s
for testScreens on the warm simulator, which hasn't failed, and XCTest
answers queries on the app's main thread, which the first sync keeps busy.
The job now launches the app once after the boot and waits until it has
taken in its first sync and gone quiet, then the tests run on the same
build. On iPhone the test also taps back again if the filters haven't
appeared and the back button is still there.

Amp-Thread-ID: https://ampcode.com/threads/T-fbae32eb-2a12-4ebe-a716-b1b0bf7c246f
Co-authored-by: tmm <tmm@tmm.dev>
@tmm
tmm merged commit 260ee7a into main Nov 14, 2026
32 checks passed
@tmm
tmm deleted the fix/zbugs-screenshots-warm-up branch November 14, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants