diff --git a/e2e/tests/journeys.spec.ts b/e2e/tests/journeys.spec.ts index 614a21c..3c529be 100644 --- a/e2e/tests/journeys.spec.ts +++ b/e2e/tests/journeys.spec.ts @@ -554,6 +554,47 @@ test('a grade confirmed at an ungraded visit says so and is dated by it', async await expect(section.getByText('Confirmed at an ungraded inspection, 18 July 2024')).toBeVisible(); }); +test('a further education college shows its Ofsted result, not "Not yet inspected"', async ({ page }) => { + // Queen Mary's College (145175) is inspected under Ofsted's further education + // framework, which the site did not load: its badge said "Not yet inspected" + // (audit H4). Its result may change; the label must never be absent or wrong. + const res = await page.request.get('/api/schools/145175'); + expect(res.ok()).toBeTruthy(); + await page.goto('/school/145175'); + const ofsted = page.locator('#ofsted'); + await expect(ofsted).toBeVisible(); + await expect(ofsted.getByText('Further education and skills')).toBeVisible(); + await expect(ofsted).not.toContainText('Not yet inspected'); +}); + +test('an ISI-inspected school says so instead of "Not yet inspected"', async ({ page }) => { + const res = await page.request.get('/api/schools?school_type=independent&phase=secondary&page_size=100'); + expect(res.ok()).toBeTruthy(); + const school = ((await res.json()).schools ?? []).find( + (s: { inspectorate?: string | null; ofsted_date?: string | null; ofsted_rc_date?: string | null }) => + s.inspectorate === 'ISI' && !s.ofsted_date && !s.ofsted_rc_date); + test.skip(!school, 'no ISI school without an Ofsted record here'); + await page.goto(`/school/${school.urn}`); + await expect(page.getByText('Inspected by the Independent Schools Inspectorate (ISI)')).toBeVisible(); + await expect(page.locator('#ofsted')).not.toContainText('Not yet inspected'); +}); + +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 }; + 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); + 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(); + if (unlisted) { + await page.goto(`/school/${unlisted.urn}`); + await expect(page.getByText('Not yet inspected')).toHaveCount(0); + } +}); + test('school detail page renders name and performance data', async ({ page }) => { await searchByName(page, 'primary'); const firstSchool = schoolLinks(page).first();