Files
F-r-ldraledigplannerare/frontend/e2e/support/fixture.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

32 lines
987 B
TypeScript

import { readFileSync } from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
/** Written once by `global-setup.ts` after seeding, read by every spec that
* needs the seeded workspace/child/parent ids or the deterministic
* multi-week band it created — see that file for how each value is
* derived. */
export const FIXTURE_PATH = path.join(__dirname, '../.auth/fixture.json')
export interface SeedFixture {
workspaceId: string
childId: string
personalDataUuid: string
childBirthDate: string
band: {
/** ISO date of the band's true first day. */
startDate: string
/** ISO date of the band's true last day. */
endDate: string
parentPersonalDataUuid: string
dayType: 'sjukpenning' | 'lagsta' | 'vacation'
}
}
export function loadSeedFixture(): SeedFixture {
const raw = readFileSync(FIXTURE_PATH, 'utf-8')
return JSON.parse(raw) as SeedFixture
}