Runs the browser tests in CI on the client output

The build artifact is now dist/client, so only that goes to the deploy jobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 19:06:41 +01:00
co-authored by Claude Opus 5.5
parent 8bf0000531
commit 8867c7833c
3 changed files with 11 additions and 4 deletions
+9 -2
View File
@@ -99,7 +99,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: dist
path: web/dist/
path: web/dist/client/
retention-days: 7
# Test wacht niet op Lighthouse: test is om te testen, de rapporten zie je
@@ -192,7 +192,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: dist
path: web/dist
path: web/dist/client
- name: Install Chromium
run: |
@@ -202,6 +202,13 @@ jobs:
echo "CHROME_PATH=$CHROME_PATH" >> "$GITHUB_ENV"
"$CHROME_PATH" --version
# Browsertests tegen de gebouwde site (preview-server op dist/client). Chrome
# komt uit de stap hierboven; dezelfde containerflags als bij Lighthouse.
- name: Browsertests
env:
LIGHTHOUSE_CHROME_FLAGS: '--no-sandbox --headless=new --disable-dev-shm-usage'
run: pnpm e2e
# Chrome in een container (gelezen door lighthouserc.cjs, zie daar waarom
# niet via LHCI_*):
# --no-sandbox: als root weigert Chrome anders te starten
@@ -433,7 +433,7 @@ Disjoint from B2 and B4. Runs only targeted `vitest run` commands. The editing o
- `interaction.e2e.ts`: mobile menu opens and closes (`nav-menu-toggle`), one client-side navigation works, the e-mail link (`footer-email-link`) is absent in raw HTML and present after hydration, focus moves to `main` after a client navigation but not on first load (V14), the contact page's tidy navigation still ends at `/contact` without extra history entries (V14), `/?pakket=...#contact` scrolls to the contact section, JSON-LD blocks cause no CSP violation (BR-SCR-22), styles present in the raw HTML and a screenshot comparison with JavaScript disabled versus enabled for `/over-mij` at widths 390 and 1280 saved under the scratch folder and reviewed by you (V15: no visible jump; describe in the log).
- Done when: `pnpm build && pnpm e2e` passes; verification log rows V8, V9, V11, V12, V14, V15, V16, V17 filled with evidence. Failures that point to the design (for example V12 hydration error on the 404 page) are STOP cases.
### Step 28: CI changes [ ]
### Step 28: CI changes [x]
- Executor: Haiku.
- Implements: BR-BLD-10; BR-TST-05 (CI run); NFR-PR-Q-03; V18. No deployment steps are touched or run.
@@ -42,7 +42,7 @@ Notes:
| V15 | Emotion/Chakra flicker | 4 (styles in HTML), 27 (screenshots) | Styles are in the HTML: `<style data-emotion` x69 in `/over-mij`, x120 on `/`, plus the bundled stylesheet `<link rel="stylesheet" href="/assets/index-*.css">` (fonts and Chakra base). After hydration in Chrome `/over-mij` has 70 emotion style tags (one added by the client); no console warning. Step 27 screenshots (`/over-mij`, JavaScript off versus on, 390 and 1280 px; reviewed by eye): without JavaScript the header, navigation (desktop links or hamburger), eyebrow "Andrea Slop Fotografie" and the heading "Over mij" are fully styled, with the Jost and Marcellus fonts, in the same positions as with JavaScript; below the heading the page is empty (the `Reveal` content is hidden in the HTML, by design until unit 2) and with JavaScript the photo and text appear in that space (390 px: photo 237 to 499, then text; 1280 px: photo and two-column text). No unstyled flash, no moved header or heading; measured: position and width of `h1` and the top of `main` are equal within 0.5 px with and without JavaScript at both widths. No console warning about styles. | `scripts.mjs`; Chrome probe; `e2e/interaction.e2e.ts` "stijlen zonder en met JavaScript (V15)"; screenshots in the scratch folder (`shots/over-mij-{390,1280}-{zonder,met}-js.png`). | OK |
| V16 | `Intl` price text | 27 | The text nodes containing a euro sign are identical in the server HTML (JavaScript off) and after hydration in Chrome (production build) for `/` and the five shoot pages, and non-empty; no hydration error. Node and Chrome ICU give the same `nl-NL` text including the non-breaking space. | `e2e/hydration.e2e.ts` "prijstekst (V16)", 6 tests, pass. | OK |
| V17 | No `on*=` or `javascript:` | 13, 27 | Step 13 on the runner output: 0 HTML files with an `on*=` attribute and 0 HTML files with `javascript:`. The only `javascript:` in `dist/client` is two strings in `assets/index-*.js`: React's own guard text (`javascript:throw new Error('React has blocked a javascript: URL...`), which is not markup and not a URL in a page. Step 27: no attribute starting with `on` and no `javascript:` attribute value in any of the 11 pages or `404.html` (parsed with `DOMParser`), and no `securitypolicyviolation` on any of the 48 hydration page loads, the interaction flows and `/contact` with the reveal script, under `securityHeaders('production')`. | Scratch run counts (`onAttrFiles: 0`); `grep -l javascript:` over the HTML and the bundle; `e2e/rawHtml.e2e.ts` and `e2e/hydration.e2e.ts`. | OK |
| V18 | CI artifact layout | 28 | open | | open |
| V18 | CI artifact layout | 28 | The upload of `web/dist/client/` puts `index.html` at the artifact root; the download to `web/dist/client` (lighthouse job) and the deploy steps' copy of the artifact contents (`dist/*` with dotglob, `web/dist` in the deploy jobs) put `index.html` at the destination root. `dist/server` is a sibling of `dist/client`, not inside it, so it never ends up in the artifact. | Build output (`pnpm build` in this step's CP4 run): `web/dist/client/index.html` and `web/dist/server/` exist side by side. Scratch emulation (`scratchpad/v18`): copy of `dist/client/.` as artifact root, `dotglob` copy of `./*` into a destination; `index.html` at destination root, no `server` and no `dist` in it. | OK |
V11 step 27: in `e2e/rawHtml.e2e.ts` all 11 pages have exactly one `<title>` equal to `pageHead`, one `description`, one canonical; `404.html` has one `<title>` ("Pagina niet gevonden \| Andrea Slop Fotografie") and one `<meta name="robots" content="noindex">`, no `data-fallback`. In `e2e/hydration.e2e.ts` the same counts hold after hydration, at 390 and 1280 px, for the 11 pages and `/404`, `/404.html`, `/onbekend`, `/soorten-fotoshoots/onbekend` (one title; robots 1 on the 404 pages and `/privacyverklaring`, 0 elsewhere). The two titles and two robots metas seen on `/soorten-fotoshoots/onbekend` before Step 16 are gone. Status: OK. (Not covered: a URL the router matches but the server does not, see BR-404-07 below, ends with two titles.)