Skip to content

Move per-test game reset into a fixture and extract play-word flow#1

Closed
RISCfuture wants to merge 1 commit into
mainfrom
fix/ui-test-guidance
Closed

Move per-test game reset into a fixture and extract play-word flow#1
RISCfuture wants to merge 1 commit into
mainfrom
fix/ui-test-guidance

Conversation

@RISCfuture

Copy link
Copy Markdown
Contributor

Addresses two e2e structure findings in e2e/gameplay.spec.ts, aligning with the Playwright test guidance (fixtures own lifecycle; helpers own actions).

Findings addressed

  • Finding 1 (fixture): The beforeEach cleared localStorage and reloaded to reset the game inline. This per-test reset now lives in a Playwright auto-fixture (resetGame, via test.extend with { auto: true }) in e2e/fixtures.ts, so it is injected per test rather than inlined in the spec. The spec's beforeEach now only reads wordsRemaining from the already-reset page.
  • Finding 2 (flow helper): The duplicated per-word play loop (find tiles for the word, click them, click Add, wait for the current word to clear) at the old :117-122 and :155-160 is extracted into playWord / playWords in e2e/game-flows.ts, composed from the existing GameBoardPage primitives (clickTiles, clickAdd, getCurrentWord) and tilesForWordFromPage. Both the "all fourtiles" and "all words" beforeEach blocks now call playWords. The helper's only assertion is synchronization (waiting for the word to clear); feature assertions stay in the specs.

The thin star / found-words page objects were intentionally left unchanged, as noted in the finding.

Verification

All run on Node 26.3.0 / pnpm 11.5.1:

  • pnpm run type-check (vue-tsc): pass
  • pnpm run lint (eslint + stylelint + oxlint + knip): pass (exit 0; only pre-existing knip config hints, unrelated to this change)
  • pnpm run test:unit (vitest): 6/6 pass
  • npx playwright test --list: specs compile (39 tests)
  • npx playwright test --project=chromium: 13/13 pass (22.3s), exercising the new fixture and flow helper

One targeted eslint-disable-next-line @typescript-eslint/no-invalid-void-type is applied to the resetGame: void fixture type, which is the idiomatic Playwright type for an auto-fixture that exposes no value to specs.

🤖 Generated with Claude Code

Address two e2e structure findings in the gameplay spec:

- Replace the inlined per-test reset (goto + clear localStorage + reload)
  in beforeEach with an injected auto-fixture (resetGame) in fixtures.ts,
  so lifecycle setup is owned by a Playwright fixture rather than the spec.
- Extract the duplicated per-word play loop (find tiles, click them, add,
  wait for the current word to clear) into a playWord/playWords flow helper
  composed from the existing GameBoardPage primitives, and use it in both
  the "all fourtiles" and "all words" beforeEach blocks.

The thin star and found-words page objects are left unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@RISCfuture

Copy link
Copy Markdown
Contributor Author

Superseded by #2 on fix/ui-test-guidance-2, which carries the same fixes with full local verification (lint, type-check, unit tests, and the complete Playwright e2e suite) and green CI. This PR was created during an interrupted first run; closing as a duplicate.

@RISCfuture RISCfuture closed this Jun 16, 2026
@RISCfuture RISCfuture deleted the fix/ui-test-guidance branch June 16, 2026 07:37
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