fix(e2e): assert the brand lockup and touch icon as they are actually built #95

Merged
tudor merged 1 commits from fix/e2e-brand-assertions into main 2026-08-14 22:28:10 +00:00
Owner

The staging E2E gate has been red since #90. #92 cleared the four AA failures; these are the last two, and both are stale test assumptions rather than product bugs.

I had earlier attributed these to the known "deploy succeeds before containers update" timing. That was wrong, and worth stating plainly: I verified the product by hand (/apple-icon.png → 200, header <img> present) and never read what the tests actually assert. They assert different things.

What was actually wrong

test asserted reality on staging
GET /apple-icon 404 — the page links /apple-icon.png?apple-icon.4e350dae.png (200)
<svg> inside the header link <picture><source><img src="/brand/mark.png"> — no svg since #90

The lockup test looked for an inline <svg>. The mark became raster artwork when the supplied logo replaced the reconstruction, so nothing matched and the locator timed out.

The asset test requested /apple-icon, which 404s. The route moved when the generated app/apple-icon.tsx became a static app/apple-icon.png — Next serves a generated icon at /apple-icon and a static one at /apple-icon.png with a content hash. The icon was present and correctly linked the whole time; the test was asking the wrong URL and reporting a missing icon.

Both tests were right to fail. They were describing something the site no longer does.

The fix

Both now read from the page rather than hardcoding the shape of the answer. The touch icon is fetched from its own <link rel="apple-touch-icon"> href — the same technique this test already uses for og:image — so it follows whatever Next emits instead of breaking again the next time the icon convention changes.

The lockup assertion also got stronger, not merely corrected. A <picture> whose sources all 404 still lays out and still satisfies toBeVisible(), so swapping svg → img alone would go green on a broken lockup. It now asserts naturalWidth > 0, which only a decoded image can satisfy.

Verification

Run against staging directly, not just parsed:

BASE_URL=https://stx.schoolcompare.co.uk npx playwright test
  41 passed (21.7s)

That is the whole gate green for the first time since #90 — which means main becomes promotable again once this lands.

Worth noting what the same run confirms, since none of it had been checked against a real deployment before: the three new hero journeys pass (artwork loads, crop switches at the breakpoint, modern format wins negotiation), and both WCAG AA journeys now pass in light and dark.

🤖 Generated with Claude Code

The staging E2E gate has been red since #90. #92 cleared the four AA failures; these are the last two, and both are stale test assumptions rather than product bugs. I had earlier attributed these to the known "deploy succeeds before containers update" timing. **That was wrong**, and worth stating plainly: I verified the *product* by hand (`/apple-icon.png` → 200, header `<img>` present) and never read what the tests actually assert. They assert different things. ## What was actually wrong | test asserted | reality on staging | |---|---| | `GET /apple-icon` | **404** — the page links `/apple-icon.png?apple-icon.4e350dae.png` (200) | | `<svg>` inside the header link | `<picture><source><img src="/brand/mark.png">` — no svg since #90 | **The lockup test** looked for an inline `<svg>`. The mark became raster artwork when the supplied logo replaced the reconstruction, so nothing matched and the locator timed out. **The asset test** requested `/apple-icon`, which 404s. The route moved when the generated `app/apple-icon.tsx` became a static `app/apple-icon.png` — Next serves a *generated* icon at `/apple-icon` and a *static* one at `/apple-icon.png` with a content hash. The icon was present and correctly linked the whole time; the test was asking the wrong URL and reporting a missing icon. Both tests were right to fail. They were describing something the site no longer does. ## The fix Both now read from the page rather than hardcoding the shape of the answer. The touch icon is fetched from its own `<link rel="apple-touch-icon">` href — the same technique this test already uses for `og:image` — so it follows whatever Next emits instead of breaking again the next time the icon convention changes. The lockup assertion also got **stronger**, not merely corrected. A `<picture>` whose sources all 404 still lays out and still satisfies `toBeVisible()`, so swapping `svg` → `img` alone would go green on a broken lockup. It now asserts `naturalWidth > 0`, which only a decoded image can satisfy. ## Verification Run against staging directly, not just parsed: ``` BASE_URL=https://stx.schoolcompare.co.uk npx playwright test 41 passed (21.7s) ``` **That is the whole gate green for the first time since #90** — which means `main` becomes promotable again once this lands. Worth noting what the same run confirms, since none of it had been checked against a real deployment before: the three new hero journeys pass (artwork loads, crop switches at the breakpoint, modern format wins negotiation), and both WCAG AA journeys now pass in light and dark. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tudor added 1 commit 2026-08-14 21:34:41 +00:00
fix(e2e): assert the brand lockup and touch icon as they are actually built
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m2s
PR Checks / Backend Smoke (pull_request) Successful in 7s
PR Checks / Build Backend (no push) (pull_request) Successful in 11s
PR Checks / Build Frontend (no push) (pull_request) Successful in 48s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 11s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 21s
e65688d600
The staging gate has been failing these two since the supplied logo artwork
replaced the reconstruction. Both tests were still asserting the previous
implementation, and both were right to fail — they were just describing
something the site no longer does.

  the header carries the schoolcompare lockup
    Looked for an <svg> inside the header link. The mark is raster now:
    <picture><source><img src="/brand/mark.png">. Nothing matched, so the
    locator timed out.

  the brand asset set is complete and served
    Requested /apple-icon, which 404s. The route moved when the generated
    app/apple-icon.tsx became a static app/apple-icon.png — generated icons
    serve at /apple-icon, static ones at /apple-icon.png with a content hash.
    The icon was present and correctly linked the whole time.

Both now read from the page instead of hardcoding the shape of the answer: the
touch icon is fetched from its own <link rel="apple-touch-icon"> href, the way
this test already handles og:image, so it follows whatever Next emits.

The lockup assertion also got stronger rather than merely corrected. A
<picture> whose sources all 404 still lays out and still satisfies
toBeVisible(), so that alone would go green on a broken lockup; it now asserts
naturalWidth, which only a decoded image can satisfy.

Verified against staging directly: 41/41 pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

🤖 AI Code Review (Claude Code)

This PR fixes two brittle e2e assertions in journeys.spec.ts: the apple-touch-icon test now reads the actual href from the page's link tag instead of hardcoding a stale /apple-icon path, and the header brand-mark test now targets an element with a naturalWidth/loaded check instead of a nonexistent inline . Both changes are test-only, well-explained via comments, and improve correctness without touching production code.

✅ No issues found.

## 🤖 AI Code Review (Claude Code) This PR fixes two brittle e2e assertions in journeys.spec.ts: the apple-touch-icon test now reads the actual href from the page's link tag instead of hardcoding a stale /apple-icon path, and the header brand-mark test now targets an <img> element with a naturalWidth/loaded check instead of a nonexistent inline <svg>. Both changes are test-only, well-explained via comments, and improve correctness without touching production code. ✅ No issues found.
tudor merged commit e373241d51 into main 2026-08-14 22:28:10 +00:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tudor/school_compare#95