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.
26 lines
978 B
TypeScript
26 lines
978 B
TypeScript
/**
|
|
* No console errors on any main page — a cheap tripwire for exceptions
|
|
* that unit tests (which render components in isolation) don't exercise,
|
|
* such as a page-level data-fetch/render crash only visible end-to-end.
|
|
*/
|
|
import { test, expect } from '@playwright/test'
|
|
import { MAIN_PAGES } from '../support/pages'
|
|
|
|
test.describe('no console errors on main pages', () => {
|
|
for (const mainPage of MAIN_PAGES) {
|
|
test(`${mainPage.name} (${mainPage.path}) logs no console errors`, async ({ page }) => {
|
|
const errors: string[] = []
|
|
page.on('console', (msg) => {
|
|
if (msg.type() === 'error') errors.push(msg.text())
|
|
})
|
|
page.on('pageerror', (err) => errors.push(err.message))
|
|
|
|
await page.goto(mainPage.path)
|
|
await expect(page.getByTestId(mainPage.testId)).toBeVisible()
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
expect(errors, `console errors on ${mainPage.path}:\n${errors.join('\n')}`).toEqual([])
|
|
})
|
|
}
|
|
})
|