ed5680253e
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.
24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
import { expect } from '@playwright/test'
|
|
|
|
// Swedish labels from src/i18n/sv/calendar.ts — the suite pins
|
|
// `locale: 'sv-SE'` in playwright.config.ts so these are stable.
|
|
const MONTH_SELECT_LABEL = 'Välj månad'
|
|
const YEAR_SELECT_LABEL = 'Välj år'
|
|
|
|
/** Navigate the Calendar page to the month containing `date` (UTC). */
|
|
export async function goToCalendarMonth(page: Page, date: Date): Promise<void> {
|
|
await page.goto('/calendar')
|
|
await expect(page.getByTestId('calendar')).toBeVisible()
|
|
|
|
await page.getByLabel(YEAR_SELECT_LABEL).selectOption(String(date.getUTCFullYear()))
|
|
await page.getByLabel(MONTH_SELECT_LABEL).selectOption(String(date.getUTCMonth()))
|
|
}
|
|
|
|
/** The exact `data-testid="calendar-day"` cell for an ISO date, wherever it
|
|
* falls in the currently-displayed grid (including a leading/trailing day
|
|
* from an adjacent month). */
|
|
export function calendarDayCell(page: Page, isoDate: string) {
|
|
return page.locator(`[data-testid="calendar-day"][aria-label^="${isoDate}"]`)
|
|
}
|