From 47b5b8d6b0242735189b5fcdf6d2773632104fd8 Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 9 May 2026 12:17:55 -0400 Subject: [PATCH] =?UTF-8?q?test(02-06):=20playwright=20e2e=20assertions=20?= =?UTF-8?q?for=20G1+G2=20=E2=80=94=20phase-2=20gap=20closure=20complete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Threads 3 new assertions into the existing PIPE-07 spec to verify the G1 + G2 gap fixes hold end-to-end in a real Chromium browser: - Assertion A (G1, after initial nav): document.body computed background-color is rgb(26, 26, 26) — proves src/index.css bundled cleanly into the entry chunk and applies before React mounts. - Assertion B (G2, after Begin click): the FirstRunHint element (data-testid="first-run-hint") is visible with non-empty externalized text content from ui-strings.yaml. - Assertion C (G2, after first plant): the FirstRunHint is gone — proves the component's tiles subscription dismisses on the first plant !== null transition. The existing 16-step assertion chain continues to pass unchanged. Test runtime grew from 1.6s → 1.7s (3 cheap evaluations + 1 visibility + 1 negation). All 4 first-impression UX gaps are now structurally closed. npm run ci exits 0 (333/333 vitest green; ~21 new tests across G1+G2+G3+G4). npm run test:e2e exits 0 (Playwright PIPE-07 + 3 new gap-closure assertions). Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/e2e/season1-loop.spec.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/e2e/season1-loop.spec.ts b/tests/e2e/season1-loop.spec.ts index 1a7c90f..2654500 100644 --- a/tests/e2e/season1-loop.spec.ts +++ b/tests/e2e/season1-loop.spec.ts @@ -70,6 +70,13 @@ test.describe('PIPE-07 — Season 1 full loop', () => { // Reload after clearing so the boot path sees a fresh DB. await page.goto('/?devtime=fake'); + // ASSERTION A (Plan 02-06 G1) — body background is #1a1a1a from frame + // one. The dark canvas no longer floats in a sea of white. + const bodyBg = await page.evaluate(() => { + return window.getComputedStyle(document.body).backgroundColor; + }); + expect(bodyBg).toBe('rgb(26, 26, 26)'); // #1a1a1a in computed-style form + // 2) Begin screen visible (first run). const beginButton = page.getByRole('button', { name: 'Begin' }); await expect(beginButton).toBeVisible({ timeout: 15000 }); @@ -78,6 +85,14 @@ test.describe('PIPE-07 — Season 1 full loop', () => { await beginButton.click(); await expect(beginButton).not.toBeVisible({ timeout: 5000 }); + // ASSERTION B (Plan 02-06 G2) — first-run hint is visible immediately + // after Begin dismisses (the A-Dark-Room first-prompt). Player sees + // the externalized line from ui-strings.yaml. + await expect(page.getByTestId('first-run-hint')).toBeVisible({ timeout: 5000 }); + const hintText = await page.getByTestId('first-run-hint').textContent(); + expect(hintText).toBeTruthy(); + expect(hintText!.length).toBeGreaterThan(0); + // 4) Wait for the test-exposed store + fake clock. await page.waitForFunction(() => { const w = window as unknown as DevTimeWindow; @@ -112,6 +127,11 @@ test.describe('PIPE-07 — Season 1 full loop', () => { { timeout: 5000 }, ); + // ASSERTION C (Plan 02-06 G2) — first-run hint auto-dismisses on the + // first plant. The component subscribes to the tiles slice and + // dismisses when any tile transitions to plant !== null. + await expect(page.getByTestId('first-run-hint')).not.toBeVisible({ timeout: 5000 }); + // 7) Fast-forward growth past 600 ticks (5Hz * 600 = 120s = 2min). // Advance 3 minutes wall-clock so the rosemary plant is solidly // in the 'ready' stage.