From 0269eec9c475ba911545b29bba687f1740bc705d Mon Sep 17 00:00:00 2001 From: Tudor Date: Tue, 13 Oct 2026 21:55:32 +0100 Subject: [PATCH] test(e2e): never pick an ISI school for the not-yet-inspected journey (review) Co-Authored-By: Claude Opus 5.5 --- 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 3c529be..a750988 100644 --- a/e2e/tests/journeys.spec.ts +++ b/e2e/tests/journeys.spec.ts @@ -582,10 +582,12 @@ test('an ISI-inspected school says so instead of "Not yet inspected"', async ({ test('"Not yet inspected" appears only for a school Ofsted lists without an inspection', async ({ page }) => { const res = await page.request.get('/api/schools?phase=primary&page_size=500'); expect(res.ok()).toBeTruthy(); - type Row = { urn: number; ofsted_listed?: boolean | null; ofsted_date?: string | null; ofsted_rc_date?: string | null; ofsted_grade?: number | null }; + type Row = { urn: number; inspectorate?: string | null; ofsted_listed?: boolean | null; ofsted_date?: string | null; ofsted_rc_date?: string | null; ofsted_grade?: number | null }; const schools: Row[] = (await res.json()).schools ?? []; - const unlisted = schools.find(s => !s.ofsted_listed && !s.ofsted_date && !s.ofsted_rc_date && !s.ofsted_grade); - const listed = schools.find(s => s.ofsted_listed && !s.ofsted_date && !s.ofsted_rc_date && !s.ofsted_grade); + // No Ofsted record, and not an ISI school (whose badge names ISI instead). + const uninspected = (s: Row) => !s.ofsted_date && !s.ofsted_rc_date && !s.ofsted_grade && s.inspectorate !== 'ISI'; + const unlisted = schools.find(s => !s.ofsted_listed && uninspected(s)); + const listed = schools.find(s => s.ofsted_listed && uninspected(s)); test.skip(!listed, 'no listed, uninspected primary on this page'); await page.goto(`/school/${listed!.urn}`); await expect(page.locator('#ofsted').getByText('Not yet inspected')).toBeVisible();