diff --git a/e2e/tests/journeys.spec.ts b/e2e/tests/journeys.spec.ts index 86bd04d..8ffe56b 100644 --- a/e2e/tests/journeys.spec.ts +++ b/e2e/tests/journeys.spec.ts @@ -474,6 +474,37 @@ test('a report-card school shows a Report Card badge in search results, not its await expect(page.getByText(/Report Card ·/).first()).toBeVisible(); }); +test('a school whose latest inspection gave no grade is not shown with an older grade', async ({ page }) => { + // Rabbsfarm (102408): Ofsted's 17 June 2025 inspection gave no overall + // grade and rated three areas Requires Improvement. The site used to carry + // a 2020 "remains Good" forward and print "Good · 2025" (audit C1). + const URN = 102408; + const res = await page.request.get(`/api/schools/${URN}`); + expect(res.ok()).toBeTruthy(); + const ofsted = (await res.json()).ofsted; + expect(ofsted.current_grade).toBeNull(); + expect(ofsted.latest_visit.date).toBe('2025-06-17'); + + await searchByName(page, 'Rabbsfarm Primary'); + const row = page.locator(`a[href*="${URN}"]`).first(); + await expect(row).toBeVisible({ timeout: 15_000 }); + await expect(page.getByText('Inspected · 2025').first()).toBeVisible(); + await expect(page.getByText(/Good · 2025/)).toHaveCount(0); + + await page.goto(`/school/${URN}`); + const section = page.locator('#ofsted'); + await expect(section.getByText('No overall grade')).toBeVisible(); + await expect(section.getByText('Requires Improvement').first()).toBeVisible(); +}); + +test('a grade confirmed at an ungraded visit says so and is dated by it', async ({ page }) => { + const URN = 104762; // Robins Lane: graded Good Jan 2020, "School remains Good" 18 July 2024 + await page.goto(`/school/${URN}`); + const section = page.locator('#ofsted'); + await expect(section).toBeVisible({ timeout: 15_000 }); + await expect(section.getByText('Confirmed at an ungraded inspection, 18 July 2024')).toBeVisible(); +}); + test('school detail page renders name and performance data', async ({ page }) => { await searchByName(page, 'primary'); const firstSchool = schoolLinks(page).first();