From c992d7f3b98fe7bad2b406c59a7fc79713ad4d17 Mon Sep 17 00:00:00 2001 From: Tudor Date: Fri, 2 Oct 2026 11:55:32 +0100 Subject: [PATCH] test(e2e): school type groups and the faith filter Co-Authored-By: Claude Opus 5.5 --- e2e/tests/journeys.spec.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/e2e/tests/journeys.spec.ts b/e2e/tests/journeys.spec.ts index c168add..15744d8 100644 --- a/e2e/tests/journeys.spec.ts +++ b/e2e/tests/journeys.spec.ts @@ -305,6 +305,30 @@ test('school type and gender switch straight to another value', async ({ page }) await expect.poll(() => type.locator('option').allTextContents()).toEqual(offered); }); +/* + * School type offers six groups a parent recognises, and Faith sits beside it. + * Data-invariant: asserts what every returned school is, never how many. + */ +test('school type groups and the faith filter narrow to what they name', async ({ page }) => { + await page.goto('/?search=school'); + const type = page.getByRole('combobox', { name: 'School type', exact: true }); + await expect(type).toBeVisible({ timeout: 15_000 }); + await type.selectOption({ label: 'Special school (SEND)' }); + await expect(page).toHaveURL(/[?&]school_type=special(&|$)/); + + await page.getByRole('button', { name: /^More filters/ }).click(); + await page.getByRole('combobox', { name: 'Faith', exact: true }).selectOption({ label: 'Roman Catholic' }); + await expect(page).toHaveURL(/[?&]faith=roman_catholic(&|$)/); + + const res = await page.request.get( + '/api/schools?search=school&school_type=special&faith=roman_catholic&page_size=100'); + expect(res.ok()).toBeTruthy(); + for (const s of (await res.json()).schools as { school_type: string; religious_denomination: string }[]) { + expect(s.school_type).toMatch(/special/i); + expect(s.religious_denomination).toMatch(/catholic/i); + } +}); + test('a phase outside primary/secondary filters to that phase, not to everything', async ({ page }) => { // The search page offers every GIAS phase, but the API only knew the grouped // ones and silently dropped the rest — so "Nursery" returned primaries.