test(e2e): never pick an ISI school for the not-yet-inspected journey (review)
PR Checks / Frontend Typecheck + Tests (pull_request) Waiting to run
PR Checks / Backend Smoke (pull_request) Waiting to run
PR Checks / Build Backend (no push) (pull_request) Waiting to run
PR Checks / Build Frontend (no push) (pull_request) Waiting to run
PR Checks / Build Pipeline (no push) (pull_request) Waiting to run
PR Checks / AI Code Review (Claude) (pull_request) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TudorandClaude Opus 5.5 committed 2026-10-13 21:55:32 +01:00
1 parent 81de008e4a
commit 0269eec9c4
1 file changed
+5 -3
+5 -3
View File
@@ -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();