Skip to content

test(e2e): move game reset to fixture, extract play-word flow helper#2

Merged
RISCfuture merged 1 commit into
mainfrom
fix/ui-test-guidance-2
Jun 17, 2026
Merged

test(e2e): move game reset to fixture, extract play-word flow helper#2
RISCfuture merged 1 commit into
mainfrom
fix/ui-test-guidance-2

Conversation

@RISCfuture

Copy link
Copy Markdown
Contributor

Summary

Addresses two findings from the UI/E2E test guidance audit on e2e/gameplay.spec.ts, applying the Playwright structure conventions (fixtures own lifecycle; helpers own actions; web-first assertions; layered helpers).

Finding 1 — reset belongs in a fixture (addressed)

The beforeEach cleared localStorage and reloaded to reset the game inline. That per-test reset is now an auto Playwright fixture freshGame in e2e/fixtures.ts (test.extend, { auto: true }), injected per test. The spec's beforeEach now only reads wordsRemaining.

Finding 2 — duplicated play loop (addressed)

The per-word play loop was duplicated across the "all fourtiles" and "all words" blocks. Extracted into layered flow helpers in e2e/game-helpers.ts:

  • playWord — a single user action (resolve tiles for a word, tap, submit, wait for the current-word display to clear), composed from the existing GameBoardPage primitives (clickTiles, clickAdd).
  • playWords — a flow that plays a list of words in order.

Helpers only assert for synchronization (expect(...).toHaveText(''), web-first, no waitForTimeout); feature assertions stay in the specs. The 10s clear timeout used by the long "all words" run is passed through as an option.

Intentionally not churned

The thin FourtileStarsPanel / FoundWordsPanel page objects were left as-is, per the audit note.

Verification

  • pnpm type-check (vue-tsc): pass
  • pnpm lint (eslint + stylelint + oxlint + knip): pass; knip reports no unused exports
  • pnpm test:unit (vitest): 6/6 pass
  • npx playwright test --list: specs compile (39 tests)
  • npx playwright test (full run, chromium + firefox + webkit): 39/39 pass

🤖 Generated with Claude Code

Address two findings from the UI/E2E test guidance audit:

- Move the per-test game reset (goto, localStorage.clear, reload) out of
  the inline beforeEach and into an auto Playwright fixture (freshGame)
  via test.extend, so lifecycle setup is injected per test rather than
  re-implemented in the spec.
- Extract the duplicated per-word play loop (used for "all fourtiles" and
  "all words") into a layered flow helper: playWord (single action) and
  playWords (flow), composed from the existing GameBoardPage primitives
  and synchronizing with web-first assertions only. The thin star and
  found-words page objects are left as-is.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@RISCfuture RISCfuture merged commit 6f45734 into main Jun 17, 2026
3 checks passed
@RISCfuture RISCfuture deleted the fix/ui-test-guidance-2 branch June 17, 2026 02:49
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.

1 participant