test(offline): mock e2e for a device-local vs_ai game (C8) #206

Merged
developer merged 1 commits from feature/offline-mock-e2e into development 2026-07-06 19:07:40 +00:00
Owner

Fast-follow (c) from the offline plan: a Playwright mock e2e that auto-covers the whole offline / local-game flow (previously only contour-verified + unit-covered).

What the spec does (e2e/offline.spec.ts, both Chromium + WebKit):

  1. Forces the installed-PWA display mode (a matchMedia stub) so the Settings offline toggle is offered.
  2. Enters offline through the real toggle — its readiness check fetches every enabled variant dawg.
  3. Asserts the blue header chrome, that online games (vs Ann) are hidden, and the Stats tab is disabled.
  4. Creates a device-local English vs_ai game with a pinned bag seed (deterministic rack NEWYMAO), taps out the opening WAY across the centre, and watches the local robot reply with a real move.
  5. Reloads and asserts the game replays from IndexedDB intact.

Enabling infra — all e2e-only, nothing enters the production build:

  • mock/client.ts fetchDict now serves the per-variant dawgs from the preview build /e2edict/ (was: threw).
  • scripts/e2e-dict.mjs copies the real dawgs into dist-e2e/ from E2E_DICT_DIR; playwright.config runs it between build and preview. The ui CI job fetches the scrabble-dictionary release the same way the Go jobs do; locally it defaults to the sibling scrabble-solver/dawg. Dawgs are never committed (dist-e2e/ is gitignored) and are tree-shaken / absent from the prod build.
  • localgame/id.ts setForcedSeed + gateway.ts window.__mock.setLocalSeed: a mock-only seed seam (tree-shaken from prod).
  • docs/TESTING.md documents it.

Verified local: check 0 / unit 482 / e2e 198 (Chromium+WebKit) / app entry 113.8/114 KB.

Fast-follow (c) from the offline plan: a Playwright mock e2e that auto-covers the whole offline / local-game flow (previously only contour-verified + unit-covered). **What the spec does** (`e2e/offline.spec.ts`, both Chromium + WebKit): 1. Forces the installed-PWA display mode (a `matchMedia` stub) so the Settings offline toggle is offered. 2. Enters offline through the **real toggle** — its readiness check fetches every enabled variant dawg. 3. Asserts the blue header chrome, that online games (vs Ann) are hidden, and the Stats tab is disabled. 4. Creates a device-local **English vs_ai** game with a **pinned bag seed** (deterministic rack `NEWYMAO`), taps out the opening **WAY** across the centre, and watches the **local robot reply with a real move**. 5. Reloads and asserts the game **replays from IndexedDB** intact. **Enabling infra — all e2e-only, nothing enters the production build:** - `mock/client.ts` `fetchDict` now serves the per-variant dawgs from the preview build `/e2edict/` (was: threw). - `scripts/e2e-dict.mjs` copies the real dawgs into `dist-e2e/` from `E2E_DICT_DIR`; `playwright.config` runs it between build and preview. The `ui` CI job fetches the **scrabble-dictionary** release the same way the Go jobs do; locally it defaults to the sibling `scrabble-solver/dawg`. Dawgs are never committed (`dist-e2e/` is gitignored) and are tree-shaken / absent from the prod build. - `localgame/id.ts` `setForcedSeed` + `gateway.ts` `window.__mock.setLocalSeed`: a mock-only seed seam (tree-shaken from prod). - `docs/TESTING.md` documents it. Verified local: check 0 / unit 482 / **e2e 198** (Chromium+WebKit) / app entry 113.8/114 KB.
developer added 1 commit 2026-07-06 18:54:21 +00:00
test(offline): mock e2e for a device-local vs_ai game (C8)
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 15s
CI / ui (pull_request) Successful in 1m10s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m43s
e9f4cb0178
A Playwright spec drives the whole offline flow in the mock build: force the
installed-PWA display mode, enter offline via the Settings toggle (its readiness check
fetches the dawgs), assert the blue chrome + online-games-hidden + Stats-disabled, then
create and play a device-local English vs_ai game with a pinned bag seed (deterministic
rack NEWYMAO) -- play the opening WAY across the centre, watch the robot reply with a
real move, and reload to confirm the IndexedDB replay.

Enabling infra (all e2e-only; nothing enters the production build):
- mock/client.ts fetchDict serves the per-variant dawgs from the preview build's
  /e2edict/ (was: threw 'unsupported in mock').
- scripts/e2e-dict.mjs copies the real dawgs into dist-e2e from E2E_DICT_DIR (the ui CI
  job fetches the scrabble-dictionary release like the Go jobs; local default: the
  sibling scrabble-solver/dawg); playwright.config runs it between build and preview.
- localgame/id.ts setForcedSeed + gateway.ts window.__mock.setLocalSeed: a mock-only
  seam to pin a local game's bag seed (tree-shaken from prod).
- ci.yaml ui job: fetch the dawgs + pass E2E_DICT_DIR to the e2e step.
- docs/TESTING.md: the offline e2e + the mock-dawg wiring.

Verified: check 0 / unit 482 / e2e 198 (both engines) / app entry 113.8/114.
owner approved these changes 2026-07-06 19:07:16 +00:00
developer merged commit 08792dad3d into development 2026-07-06 19:07:40 +00:00
developer deleted branch feature/offline-mock-e2e 2026-07-06 19:07:40 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: developer/scrabble-game#206