From 21c4add408638fd55d7c2cd38c7a0cc332365a9d Mon Sep 17 00:00:00 2001 From: Tudor Date: Mon, 20 Jul 2026 18:18:52 +0100 Subject: [PATCH] fix(e2e): assert all-through phases via visible sub-headings, not tooltip-colliding text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Batch E all-through journey used `#results getByText('Attainment 8').first()`, which matched 14 nodes — mostly hidden MetricTooltip labels — so `.first()` landed on a visibility:hidden node and `toBeVisible()` failed on staging. Assert instead on the unique, visible all-through sub-headings ("Primary — KS2 SATs" / "Secondary — GCSEs"), which directly prove each phase block rendered. Full suite green against staging (17/17). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_0146VHeLAWjDVE2B5uU67jCB --- e2e/tests/journeys.spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/e2e/tests/journeys.spec.ts b/e2e/tests/journeys.spec.ts index 4df77d7..c89f3b1 100644 --- a/e2e/tests/journeys.spec.ts +++ b/e2e/tests/journeys.spec.ts @@ -172,11 +172,13 @@ test('an all-through school shows BOTH its KS2 SATs and its GCSE results, not ju // Labelled as all-through in the hero meta. await expect(page.getByText(/All-through/i).first()).toBeVisible(); - // The combined results section carries both phases. + // The combined results section carries both phases, each under its own + // all-through sub-heading (a unique visible node — unlike "Attainment 8", + // which also appears in hidden MetricTooltip labels). const results = page.locator('#results'); await expect(results.getByText(/SATs & GCSE Results/)).toBeVisible(); - await expect(results.getByText('Reading, Writing & Maths combined')).toBeVisible(); // KS2 - await expect(results.getByText('Attainment 8').first()).toBeVisible(); // KS4 + await expect(results.getByRole('heading', { name: /Primary.*KS2 SATs/ })).toBeVisible(); // KS2 block + await expect(results.getByRole('heading', { name: /Secondary.*GCSEs/ })).toBeVisible(); // KS4 block }); test('school with no performance data still gets a working detail page', async ({ page }) => {