test(web): faster, deterministic Playwright suite #904

Merged
chris merged 3 commits from perf/playwright-test-speedup into main 2026-09-27 11:57:58 +02:00
Owner

Summary

Speeds up the web test stage on PRs by removing the main sources of wasted test time — fixed sleeps, race-prone waits, and the two persistently-failing desktop specs that burned all 3 retry attempts in CI.

1. Fixed sleeps → deterministic waits (10 spec files, 28 occurrences)

  • thumbnail-retry-budget.spec.ts: 15s hard sleep replaced with page.clock fast-forward + per-retry request waits → 15s → <1s per project
  • All other waitForTimeout calls (150ms–600ms) replaced with auto-retrying expect, expect.poll stability streaks, request counters, or rAF-based pacing
  • No assertion weakened, no timeout raised

2. Two CI timeout-flakes made deterministic

  • timeline.spec.ts:302 (section-header select): waits for section tiles + stable layout before the group-hover dispatch; was hitting the 30s test timeout and passing only on retry (≈60s wasted)
  • instance-remove-mode.spec.ts:131: deterministic post-goto render waits before clicks; applied to all sibling tests in the describe

3. Two persistent desktop failures fixed at the root

  • albums.spec.ts:1332 (failed all 3 attempts in run 3041): root cause was previews mounting only after 65 parallel album-detail requests — now gated on the served-detail responses; layout sampled in one atomic snapshot (ResizeObserver-stable); matrix split into 4 retry-isolated batches (60s/65-patterns → 45s per ~16-pattern batch)
  • embedding-map.spec.ts:396 (repeatedly 19.5–25.9s + timeouts): clicks were silently swallowed during Leaflet zoom animations (anim class lives on .leaflet-map-pane, not .leaflet-container) — now waits for real idle state + marker re-render detach proof; mobile-only hover replaced with dispatchEvent('mouseenter') (same handler, no viewport constraint)

Verification

  • All 10 touched specs, both projects (desktop + mobile), --retries=0: 322 passed, 12 skipped (pre-existing), 0 failed, 0 flaky
  • npx playwright test --list + strict tsc checks clean

Expected CI effect

Shorter, more stable web stage: no more 3-attempt failures on albums/embedding-map, no more 30s-timeout-then-retry double runs, ~30s less pure sleeping per run (thumbnail-retry budget alone was 33s of sleep across projects).

## Summary Speeds up the web test stage on PRs by removing the main sources of wasted test time — fixed sleeps, race-prone waits, and the two persistently-failing desktop specs that burned all 3 retry attempts in CI. ### 1. Fixed sleeps → deterministic waits (10 spec files, 28 occurrences) - `thumbnail-retry-budget.spec.ts`: 15s hard sleep replaced with `page.clock` fast-forward + per-retry request waits → **15s → <1s per project** - All other `waitForTimeout` calls (150ms–600ms) replaced with auto-retrying `expect`, `expect.poll` stability streaks, request counters, or rAF-based pacing - No assertion weakened, no timeout raised ### 2. Two CI timeout-flakes made deterministic - `timeline.spec.ts:302` (section-header select): waits for section tiles + stable layout before the group-hover dispatch; was hitting the 30s test timeout and passing only on retry (≈60s wasted) - `instance-remove-mode.spec.ts:131`: deterministic post-`goto` render waits before clicks; applied to all sibling tests in the describe ### 3. Two persistent desktop failures fixed at the root - `albums.spec.ts:1332` (failed all 3 attempts in run 3041): root cause was previews mounting only after 65 parallel album-detail requests — now gated on the served-detail responses; layout sampled in one atomic snapshot (ResizeObserver-stable); matrix split into 4 retry-isolated batches (60s/65-patterns → 45s per ~16-pattern batch) - `embedding-map.spec.ts:396` (repeatedly 19.5–25.9s + timeouts): clicks were silently swallowed during Leaflet zoom animations (anim class lives on `.leaflet-map-pane`, not `.leaflet-container`) — now waits for real idle state + marker re-render detach proof; mobile-only hover replaced with `dispatchEvent('mouseenter')` (same handler, no viewport constraint) ## Verification - All 10 touched specs, both projects (desktop + mobile), `--retries=0`: **322 passed, 12 skipped (pre-existing), 0 failed, 0 flaky** - `npx playwright test --list` + strict `tsc` checks clean ## Expected CI effect Shorter, more stable web stage: no more 3-attempt failures on albums/embedding-map, no more 30s-timeout-then-retry double runs, ~30s less pure sleeping per run (thumbnail-retry budget alone was 33s of sleep across projects).
- albums: gate on album-detail responses, atomic layout snapshots,
  split 65-pattern matrix into 4 retry-isolated batches (45s each)
- embedding-map: wait for real Leaflet idle state (.leaflet-map-pane
  anim classes + transform stability), marker-detach proof after zoom,
  single-snapshot marker counts, event-driven pan steps
test(web): fix mobile-only hover failure in quadtree test
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 3m57s
a2ae66b7ce
Playwright cannot scroll transform-positioned Leaflet markers into the
Pixel 7 viewport; dispatch mouseenter directly (same handler path).
chris merged commit 16f1b936a5 into main 2026-09-27 11:57:58 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!904
No description provided.