Files
F-r-ldraledigplannerare/frontend/e2e/tests/no-uuids.spec.ts
T
jacobh2 ed5680253e Check in a browser what the unit tests cannot see
Every serious defect in this project was found by opening the app, most
recently a feature that rendered blank cards to every user while its tests
passed, and a progress bar labelled in the wrong unit. Five checks now run
without a person: that the age-four figures on screen match what the API
computed, that a multi-week period draws as one bar rather than fragments,
that Sundays and holidays are red where Saturdays are not, that no identifier
leaks into visible text, and that no page logs an error.

Three of them were confirmed by reintroducing the original bug and watching
the right test fail. Dates are derived rather than written down: Easter is
computed independently instead of asked of the system under test, and the
fixture period is placed relative to today, so the suite does not expire.

It runs as its own job and does not block a merge until it has proved itself
stable.
2026-09-17 19:46:17 +02:00

26 lines
1.1 KiB
TypeScript

/**
* No raw UUID should ever leak into visible copy where a name belongs (the
* historical bug: "3d6c6b2e-… has a large surplus" instead of a parent's
* name — see the surplus-advice/name-resolver code in
* `src/components/planning/PlanResults.tsx` and `src/utils/parentNames.ts`).
* Cheap to guard forever; scans the rendered text of every main page.
*/
import { test, expect } from '@playwright/test'
import { MAIN_PAGES } from '../support/pages'
const UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i
test.describe('no raw UUIDs in visible copy', () => {
for (const mainPage of MAIN_PAGES) {
test(`${mainPage.name} (${mainPage.path}) never shows a raw id where a name belongs`, async ({ page }) => {
await page.goto(mainPage.path)
const root = page.getByTestId(mainPage.testId)
await expect(root).toBeVisible()
const text = await root.innerText()
const match = text.match(UUID_PATTERN)
expect(match?.[0] ?? null, `found a raw UUID in visible text on ${mainPage.path}`).toBeNull()
})
}
})