Adds browser tests and fixes hydration of the 404 page

The prerendered 404 page is served for other URLs, so its dehydrated match id
differs and the router renders the catch-all's pending component first. Without
one that render was empty, which gave React error 418 and duplicate head tags.
The tests run the built output in a real browser under the production CSP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 19:03:07 +01:00
co-authored by Claude Opus 5.5
parent 0c5d8b8f40
commit 8bf0000531
15 changed files with 1216 additions and 48 deletions
@@ -402,7 +402,7 @@ Disjoint from B2 and B4. Runs only targeted `vitest run` commands. The editing o
- Done when: **CP3**: `pnpm build` succeeds, the runner prints its success line (this requires Steps 17 and 21 done, otherwise EMAIL_IN_OUTPUT fails the build, which is the check working). Port 4173 and CPU rules of Step 2 apply to item 5.
- Record: verification log notes under V5, V7, and the lighthouse finding.
### Step 25: Prerender-safety test (BR-TST-07) [ ]
### Step 25: Prerender-safety test (BR-TST-07) [x]
- Executor: Sonnet.
- Implements: BR-TST-07; FR-PR-05; NFR-PR-Q-03 (fast feedback).
@@ -410,7 +410,7 @@ Disjoint from B2 and B4. Runs only targeted `vitest run` commands. The editing o
- Do: for every key of `sitePages` plus an unknown path, create a router with memory history from `routerOptions()`, await `router.load()`, render with `react-dom/server` inside `ChakraProvider`, and expect no throw and a non-empty string containing the page's `<h1>`. This catches `window`/`document` use in render paths. If it cannot be made to work with the shell, drop the shell from the test as in Step 5. Feasibility is the open point: if the Chakra provider or the router cannot render in a Node environment at all, record "not feasible, the build's own prerender is the guard" in the verification log and replace the test by a documented skip-free alternative (a test that scans nothing is not acceptable): in that case STOP and report instead of deleting the step. Add the assertion that the server HTML of `/contact` has no assembled address.
- Done when: `pnpm exec vitest run src/prerender.test.tsx` passes.
### Step 26: e2e harness and smoke test [ ]
### Step 26: e2e harness and smoke test [x]
- Executor: Sonnet.
- Implements: BR-TST-05 (harness); D11; NFR-PR-Q-03; V1 (browser side), V8 early.
@@ -422,7 +422,7 @@ Disjoint from B2 and B4. Runs only targeted `vitest run` commands. The editing o
- `smoke.e2e.ts`: `/` and `/contact` and `/onbekend`: page loads under the production CSP, the heading is visible, zero console errors/warnings and zero CSP violations. This is the first real-browser proof; if it fails with hydration or CSP errors, analyse; failures that need a design change: STOP.
- Done when: `pnpm build && pnpm e2e` passes locally (Chrome must be installed or `CHROME_PATH` set; if no browser is available on this machine, STOP and ask the main session instead of skipping).
### Step 27: Full e2e tests (BR-TST-05, BR-TST-06; V8, V9, V10, V11, V12, V14, V15, V16, V17) [ ]
### Step 27: Full e2e tests (BR-TST-05, BR-TST-06; V8, V9, V10, V11, V12, V14, V15, V16, V17) [x]
- Executor: Sonnet.
- Implements: BR-TST-05, 06; BR-HYD-17, 20, 21; BR-LZY-01, 05; BR-404-03, 04, 05, 07; BR-ENT-06; BR-MAIL-10; FR-PR-05 to 08, 14, 15, 22; NFR-PR-S-02, SEC-01, Q-03, Q-04; PBT: "No PBT properties identified" (browser flows).