test(e2e): school type groups and the faith filter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TudorandClaude Opus 5.5 committed 2026-10-02 11:55:32 +01:00
1 parent 17bfb4a3f7
commit c992d7f3b9
1 file changed
+24
+24
View File
@@ -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.