test(e2e): further education, ISI and not-yet-inspected states (H4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TudorandClaude Opus 5.5 committed 2026-10-13 21:35:53 +01:00
1 parent 9feb37b974
commit 81de008e4a
1 file changed
+41
+41
View File
@@ -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(); 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 }) => { test('school detail page renders name and performance data', async ({ page }) => {
await searchByName(page, 'primary'); await searchByName(page, 'primary');
const firstSchool = schoolLinks(page).first(); const firstSchool = schoolLinks(page).first();