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();