It picks the first two /school/ links from a "primary" search and asserts exactly two mobile chips. But a "primary" search can return all-through schools — e.g. the first staging result is "Hessle High School and Penshurst Primary School", which has Attainment 8 data and therefore classifies as secondary. When the two picks split across phases (Primary 1 / Secondary 1), the compare view's active phase holds a single school, the chip legend is correctly gated out (it only renders for ≥2 schools in the active phase), and the canvas still shows that one line — so the canvas assertion passes but the chip assertion sees 0.
This is a test artefact, not a product bug — I reproduced the chips rendering perfectly for two same-phase schools.
Fix
Compare three schools instead of two. classifySchool always bins a school into exactly one of two phases, and the view auto-selects the strict-majority phase (ties → primary), so with three schools the active phase always holds ≥2 and the chip legend is guaranteed to render. Assert ≥2 chips (the majority may be 2 or 3) and keep the focus-toggle checks.
Verification
Ran the updated test against staging (BASE_URL=https://stx.schoolcompare.co.uk) — passes, including the aria-pressed focus toggle. This unblocks the promotion gate, which is currently red on main for every deploy because of this test.
## Problem
The `compare chart on mobile` journey (added in #11) fails on the staging gate:
```
Expected: 2 Received: 0
getByRole('group', { name: /highlight a school/i }).getByRole('button')
```
It picks the first two `/school/` links from a "primary" search and asserts exactly two mobile chips. But a "primary" search can return **all-through** schools — e.g. the first staging result is *"Hessle High School **and** Penshurst Primary School"*, which has Attainment 8 data and therefore classifies as **secondary**. When the two picks split across phases (Primary 1 / Secondary 1), the compare view's active phase holds a single school, the chip legend is correctly gated out (it only renders for ≥2 schools in the active phase), and the canvas still shows that one line — so the canvas assertion passes but the chip assertion sees 0.
This is a test artefact, not a product bug — I reproduced the chips rendering perfectly for two same-phase schools.
## Fix
Compare **three** schools instead of two. `classifySchool` always bins a school into exactly one of two phases, and the view auto-selects the strict-majority phase (ties → primary), so with three schools the active phase always holds ≥2 and the chip legend is guaranteed to render. Assert ≥2 chips (the majority may be 2 or 3) and keep the focus-toggle checks.
## Verification
Ran the updated test against staging (`BASE_URL=https://stx.schoolcompare.co.uk`) — passes, including the `aria-pressed` focus toggle. This unblocks the promotion gate, which is currently red on `main` for every deploy because of this test.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The test picked the first two /school/ links from a 'primary' search and
asserted exactly two mobile chips. But a 'primary' search can return
all-through schools (e.g. 'Hessle High School and Penshurst Primary')
that classify as secondary, so the two picks can split across phases —
the active phase then holds one school and the chips are correctly gated
out (they need ≥2 in the active phase), while the canvas still shows one
line. That's a test artefact, not a bug.
Pick three schools instead: across two phases the auto-selected majority
phase always holds ≥2, so the chip legend is guaranteed. Assert ≥2 chips
(the majority may be 2 or 3). Verified against staging.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This diff only modifies an e2e test (compare-chips journey) to use three schools instead of two, and relaxes the chip-count assertion to a lower bound instead of an exact match. It's a test-only change with no production or deploy config impact.
🟡 Minor
e2e/tests/journeys.spec.ts: The chip count assertion was weakened from an exact toHaveCount(2) to toBeGreaterThanOrEqual(2), so the test no longer verifies that exactly one chip renders per school in the active phase — a regression that adds an extra stray chip would go undetected.
## 🤖 AI Code Review (Claude Code)
This diff only modifies an e2e test (compare-chips journey) to use three schools instead of two, and relaxes the chip-count assertion to a lower bound instead of an exact match. It's a test-only change with no production or deploy config impact.
### 🟡 Minor
- **e2e/tests/journeys.spec.ts**: The chip count assertion was weakened from an exact `toHaveCount(2)` to `toBeGreaterThanOrEqual(2)`, so the test no longer verifies that exactly one chip renders per school in the active phase — a regression that adds an extra stray chip would go undetected.
tudor
merged commit 331ae8d89f into main2026-07-06 11:01:22 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
The
compare chart on mobilejourney (added in #11) fails on the staging gate:It picks the first two
/school/links from a "primary" search and asserts exactly two mobile chips. But a "primary" search can return all-through schools — e.g. the first staging result is "Hessle High School and Penshurst Primary School", which has Attainment 8 data and therefore classifies as secondary. When the two picks split across phases (Primary 1 / Secondary 1), the compare view's active phase holds a single school, the chip legend is correctly gated out (it only renders for ≥2 schools in the active phase), and the canvas still shows that one line — so the canvas assertion passes but the chip assertion sees 0.This is a test artefact, not a product bug — I reproduced the chips rendering perfectly for two same-phase schools.
Fix
Compare three schools instead of two.
classifySchoolalways bins a school into exactly one of two phases, and the view auto-selects the strict-majority phase (ties → primary), so with three schools the active phase always holds ≥2 and the chip legend is guaranteed to render. Assert ≥2 chips (the majority may be 2 or 3) and keep the focus-toggle checks.Verification
Ran the updated test against staging (
BASE_URL=https://stx.schoolcompare.co.uk) — passes, including thearia-pressedfocus toggle. This unblocks the promotion gate, which is currently red onmainfor every deploy because of this test.🤖 Generated with Claude Code
🤖 AI Code Review (Claude Code)
This diff only modifies an e2e test (compare-chips journey) to use three schools instead of two, and relaxes the chip-count assertion to a lower bound instead of an exact match. It's a test-only change with no production or deploy config impact.
🟡 Minor
toHaveCount(2)totoBeGreaterThanOrEqual(2), so the test no longer verifies that exactly one chip renders per school in the active phase — a regression that adds an extra stray chip would go undetected.