test(02-05): playwright e2e for PIPE-07 — full Phase-2 loop
- tests/e2e/season1-loop.spec.ts: PIPE-07 smoke covering load → Begin → plant rosemary → fast-forward FakeClock 3min → harvest → fragment-reveal modal → close → journal-icon visible → open journal → fragment present → reload page → fragment persists. Sidesteps Phaser canvas pixel-clicking via window.__tlgStore command dispatch (test-only window slot, production-guarded by import.meta.env.PROD). - playwright.config.ts: bumped webServer timeout 30s → 60s for cold Vite startup; pinned port 5273 + --strictPort to avoid collisions with other dev servers on the user's machine; reuseExistingServer false so the spec always starts a fresh Vite against this project. - package.json: added test:e2e script (npx playwright test). Not added to npm run ci — Playwright is slower than Vitest; manual run before /gsd-verify-work + future v1 release pipeline. - src/content/loader.ts (Rule 3 — Blocking): replaced gray-matter with a 15-line parseFrontmatter helper. gray-matter pulls in Node's Buffer global which is undefined in Vite's browser bundle; the build emits a 'Module "buffer" externalized' warning that masks the runtime ReferenceError. Surfaced under Vite dev mode while running the e2e — Plan 02-03's Markdown loader path (lura-first- letter.md + winter-rose-night.md) was effectively broken in real browsers since shipping. parseFrontmatter handles the strict '---<yaml>---<body>' shape the .md fragments use; bundle dropped from 2.2MB to 1.9MB as a side effect of dropping the unused dep. - deferred-items.md: tracks the gray-matter package.json cleanup (the dep is now unused but kept in package.json for now, scoped out of this plan). - npx playwright test exits 0 (1 spec, 1.5s test runtime); npm run ci exits 0; 308/308 vitest still green. PIPE-07 satisfied end-to-end.
This commit is contained in:
+23
-9
@@ -1,16 +1,30 @@
|
||||
import { defineConfig } from '@playwright/test';
|
||||
|
||||
// Phase 1: Playwright is installed and configured but ships no specs.
|
||||
// First spec lands in Phase 2 (PIPE-07) — a smoke test that asserts the
|
||||
// "Tend the garden / Begin" gesture screen mounts and CORE-01 (game loads
|
||||
// in <5s) holds. This config exists so Plan 01 proves Playwright is wired.
|
||||
// Phase 2 Plan 02-05 — PIPE-07 smoke test landed here. The spec under
|
||||
// tests/e2e/season1-loop.spec.ts exercises the full Season-1 loop
|
||||
// (load → Begin → plant → fast-forward → harvest → reveal → journal →
|
||||
// reload → persist) using FakeClock injection via the ?devtime=fake URL
|
||||
// flag (production-guarded by import.meta.env.PROD).
|
||||
//
|
||||
// webServer.timeout bumped to 60s to absorb Vite dev server's first-time
|
||||
// transform of the entry bundle (~2.2MB; typically <8s warm but can
|
||||
// exceed 30s cold on a fresh node_modules/.vite cache).
|
||||
// Phase 2 Plan 02-05 — Port 5273 chosen to avoid colliding with another
|
||||
// Vite project on the dev machine that's bound to the default 5173.
|
||||
// reuseExistingServer is intentionally false so the webServer always
|
||||
// starts fresh against this project's vite.config.ts (or default port
|
||||
// flag below) — `--port 5273 --strictPort` ensures we fail loudly if
|
||||
// the port is also taken rather than silently latching onto another app.
|
||||
const E2E_PORT = 5273;
|
||||
const E2E_BASE_URL = `http://localhost:${E2E_PORT}`;
|
||||
|
||||
export default defineConfig({
|
||||
testDir: 'tests/e2e',
|
||||
use: { baseURL: 'http://localhost:5173' },
|
||||
use: { baseURL: E2E_BASE_URL },
|
||||
webServer: {
|
||||
command: 'npm run dev',
|
||||
url: 'http://localhost:5173',
|
||||
reuseExistingServer: true,
|
||||
timeout: 30_000,
|
||||
command: `npm run dev -- --port ${E2E_PORT} --strictPort`,
|
||||
url: E2E_BASE_URL,
|
||||
reuseExistingServer: false,
|
||||
timeout: 60_000,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user