From c6ff77f05bb062570d277c62d56bcdd437af0866 Mon Sep 17 00:00:00 2001 From: Tudor Date: Tue, 6 Oct 2026 12:37:02 +0100 Subject: [PATCH] test(e2e): 2023/24 results and no LA gap for independents (C2, H2) Co-Authored-By: Claude Opus 5.5 --- e2e/tests/journeys.spec.ts | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/e2e/tests/journeys.spec.ts b/e2e/tests/journeys.spec.ts index 8ffe56b..5bc91d6 100644 --- a/e2e/tests/journeys.spec.ts +++ b/e2e/tests/journeys.spec.ts @@ -422,7 +422,7 @@ test('a secondary search row compares its Attainment 8 with the LA average', asy const school = ((await res.json()).schools ?? []).find( (s: { attainment_8_score?: number | null; local_authority?: string; school_type?: string }) => s.attainment_8_score != null && s.local_authority != null && averages[s.local_authority] != null - && !/special|pupil referral|alternative provision/i.test(s.school_type ?? '')); + && !/special|pupil referral|alternative provision|independent/i.test(s.school_type ?? '')); test.skip(!school, 'no mainstream secondary with an LA average here'); await searchByName(page, school.school_name); @@ -433,6 +433,40 @@ test('a secondary search row compares its Attainment 8 with the LA average', asy await expect(stats.getByText(/vs LA avg/)).toBeVisible(); }); +test('an independent secondary shows its Attainment 8 without an LA comparison', async ({ page }) => { + // DfE's LA averages cover state-funded schools, and an independent school's + // Attainment 8 leaves out IGCSEs, so a gap would mislead (audit H2). + const res = await page.request.get('/api/schools?school_type=independent&phase=secondary&page_size=50'); + expect(res.ok()).toBeTruthy(); + const school = ((await res.json()).schools ?? []).find( + (s: { attainment_8_score?: number | null; school_type?: string }) => + s.attainment_8_score != null && !/special/i.test(s.school_type ?? '')); + test.skip(!school, 'no independent secondary with an Attainment 8 here'); + + const averagesLoaded = page.waitForResponse(r => r.url().includes('/la-averages')); + await searchByName(page, school.school_name); + await averagesLoaded; + const link = page.locator(`a[href^="/school/${school.urn}-"]`).first(); + await expect(link).toBeVisible({ timeout: 15_000 }); + const stats = link.locator('xpath=ancestor::div[contains(@class, "__rowContent")][1]') + .locator('[class*="__line3"]'); + await expect(stats.getByText(school.attainment_8_score.toFixed(1))).toBeVisible(); + await expect(stats.getByText(/vs LA avg/)).toHaveCount(0); +}); + +test('a secondary shows its 2023/24 GCSE results, the last year DfE published Progress 8', async ({ page }) => { + // DfE re-issued its 2023/24 file under older column names, and every + // school's 2023/24 row loaded empty (audit C2). These are DfE's final + // figures for Bishop Stopford School, so they do not change. + await page.goto('/school/137086'); + const history = page.locator('#history'); + await history.getByText('View raw year-by-year data').click(); + const row = history.getByRole('row', { name: /2023\/24/ }); + await expect(row).toContainText('64.1'); + await expect(row).toContainText('+1.0'); + await expect(row).toContainText('91.7%'); +}); + test('a phase outside primary/secondary filters to that phase, not to everything', async ({ page }) => { // The search page offers every GIAS phase, but the API only knew the grouped // ones and silently dropped the rest — so "Nursery" returned primaries.