Skip to content

perf(e2e): navigate to game states via URL routing and localStorage injection#74

Open
adrienbrault wants to merge 5 commits into
mainfrom
claude/optimize-e2e-tests-OPdLy
Open

perf(e2e): navigate to game states via URL routing and localStorage injection#74
adrienbrault wants to merge 5 commits into
mainfrom
claude/optimize-e2e-tests-OPdLy

Conversation

@adrienbrault

Copy link
Copy Markdown
Owner

The screenshot tests were spending 1-2s per test on click-through navigation
(landing → start solo → pick difficulty → board). The app exposes direct routes
for each screen, which eliminates the full SPA click-through overhead.

  • gotoSoloGame: replaced 3-step click-through with page.goto("/solo/easy/e2e-screenshot-test")
  • daily challenge test: page.goto("/daily") instead of landing → button click
  • join game test: page.goto("/join") instead of landing → button click
  • "in progress" test: inject pre-built SavedGame into localStorage so the board
    restores a realistic in-progress state (given cells + 6 user fills + pencil notes)
    without any UI interaction loop or artificial waitForTimeout calls.
    Previously 5.19s avg; now ~1.7s avg — same as other direct-nav tests.

https://claude.ai/code/session_01KZVJRBbKGBnppCXDpeJAzW

claude added 5 commits March 9, 2026 11:57
…njection

The screenshot tests were spending 1-2s per test on click-through navigation
(landing → start solo → pick difficulty → board). The app exposes direct routes
for each screen, which eliminates the full SPA click-through overhead.

- gotoSoloGame: replaced 3-step click-through with page.goto("/solo/easy/e2e-screenshot-test")
- daily challenge test: page.goto("/daily") instead of landing → button click
- join game test: page.goto("/join") instead of landing → button click
- "in progress" test: inject pre-built SavedGame into localStorage so the board
  restores a realistic in-progress state (given cells + 6 user fills + pencil notes)
  without any UI interaction loop or artificial waitForTimeout calls.
  Previously 5.19s avg; now ~1.7s avg — same as other direct-nav tests.

https://claude.ai/code/session_01KZVJRBbKGBnppCXDpeJAzW
…enshot

This test called gotoSoloGame and immediately took a screenshot with no DOM
injection — producing an output identical to "solo game". The "hidden bars"
state is already covered by every solo game screenshot, making this 9-project
test a duplicate that adds ~15s of serial test time.

https://claude.ai/code/session_01KZVJRBbKGBnppCXDpeJAzW
…rojects

Dark mode and the "with friends" landing variant test theming and data display,
not viewport-specific layout. Running them on all 9 projects adds test volume
without catching layout regressions.

Add grepInvert: /dark mode|with friends/ to the 7 secondary projects
(iPhone 14, iPad Mini, iPhone 14 Safari, iPhone 14 Landscape, iPhone SE Landscape,
iPhone 14 Landscape Safari, iPhone SE Landscape Safari). iPhone SE and Desktop
retain full test coverage including all variants.

Also promote Desktop to a primary project alongside iPhone SE so it appears
first in the project list alongside the other primary project.

https://claude.ai/code/session_01KZVJRBbKGBnppCXDpeJAzW
Each isolated Playwright test pays a fixed ~1.25s cost for browser context
creation + initial navigation. With 129 tests, that was ~160s of pure overhead
that contributed nothing to the screenshots themselves.

Restructured to a single "all screenshots" test per project. All 13-19
screenshot scenarios for a device run sequentially within one shared browser
context. Variant screenshots (dark mode, numpad position) use page.reload()
after setting localStorage — a ~400ms reload vs ~1.25s new context.

Primary projects (iPhone SE, Desktop) run the full 19-scenario suite including
dark-mode and with-friends variants. Secondary projects run the 13-scenario
subset via an isPrimary() check. Each scenario uses test.step() for
granularity in test reports.

Also removed waitForTimeout(150) in the win modal step in favour of
waiting for the injected overlay element to appear.

Results: 129 tests → 9 tests | 266s serial → 127s serial | 75s wall → 26s wall

https://claude.ai/code/session_01KZVJRBbKGBnppCXDpeJAzW
With one test per project, setting workers=9 ensures all 9 project tests
start simultaneously rather than queuing. Previously grepInvert was used to
filter dark-mode tests from secondary projects at the config level; this is
now handled via isPrimary() inside the consolidated test, so the LAYOUT_ONLY
regex and per-project grepInvert are no longer needed.

https://claude.ai/code/session_01KZVJRBbKGBnppCXDpeJAzW
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 9, 2026

Copy link
Copy Markdown

Deploying sudoku with  Cloudflare Pages  Cloudflare Pages

Latest commit: 49be74f
Status: ✅  Deploy successful!
Preview URL: https://e51af3b4.sudoku-4cc.pages.dev
Branch Preview URL: https://claude-optimize-e2e-tests-op.sudoku-4cc.pages.dev

View logs

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