diff --git a/e2e/tests/journeys.spec.ts b/e2e/tests/journeys.spec.ts index fafc79c..d850ab5 100644 --- a/e2e/tests/journeys.spec.ts +++ b/e2e/tests/journeys.spec.ts @@ -3396,3 +3396,31 @@ test('a selective school is flagged Selective, on its page and in search', async const tags = await rowTags(page, school); await expect(tags.getByText('Selective', { exact: true })).toBeVisible(); }); + +/* + * The Admissions section repeated the search rows' old tag logic: "selective" + * matched inside "Non-selective", and "None" counted as a faith, so Burntwood + * read "this school has a faith-based admissions priority (None)". The + * Selective half stayed hidden only because the school page's API did not + * send admissions_policy. Data-invariant: the school comes from the API, and + * must have an Admissions section to read. + */ +test('a non-selective school with no faith makes neither claim in its Admissions section', async ({ page }) => { + const res = await page.request.get( + '/api/schools?search=school&phase=secondary&faith=none&admissions_policy=non-selective&page_size=20'); + expect(res.ok()).toBeTruthy(); + let urn: number | null = null; + for (const s of ((await res.json()).schools ?? []).slice(0, 8)) { + if (s.religious_denomination !== 'None') continue; + const detail = await (await page.request.get(`/api/schools/${s.urn}`)).json(); + if (detail.admissions) { urn = s.urn; break; } + } + test.skip(urn == null, 'no non-selective, no-faith secondary with admissions data here'); + + await page.goto(`/school/${urn}`); + const admissions = page.locator('section#admissions'); + await expect(admissions).toBeVisible({ timeout: 15_000 }); + await expect(admissions.getByText('Selective:', { exact: true })).toHaveCount(0); + await expect(admissions.getByText('Faith priority:', { exact: true })).toHaveCount(0); + await expect(admissions.getByText(/\(None\)/)).toHaveCount(0); +});