Testing
Unit, browser and accessibility tests that are cheap enough to keep running.
2026
- Choose jsdom or Browser Mode in Vitest 4Keep DOM assertions in jsdom and move layout checks to a Chromium project in Vitest 4, using one toolbar test to see the difference.
- Verify a Playwright healer locator fixInitialize Playwright Test Agents, run the healer on a renamed button, and verify the repaired test still fails when saving breaks.
- Run one Vitest test by file lineTarget a single Vitest case from its editor location by passing the full test file path and declaration line.
- Snapshot page structure with ARIA snapshotsUse a Playwright ARIA snapshot to check navigation roles and link names while letting layout markup change.
- Run changed Playwright tests first in CIRun Playwright’s changed-test selection against the pull request base for quick feedback, then run the full suite to cover browser-only dependencies.
- Control time in Playwright with page.clockFreeze browser time in Playwright, test a five-minute session timeout without waiting, and choose whether interval callbacks should run for each tick.
2025
- Mock fetch with MSW 2 in VitestTest fetch with MSW 2 in Vitest, override a handler for a 404, and fail requests that match no handler.
- Shard Playwright in CI, merge one reportRun Playwright in four CI jobs, keep each blob report, and turn them into one HTML report even when tests fail.
- Debug a failing Playwright test with UI modeInspect the page before and after each action in a failing Playwright test using UI mode or a trace file.
- Pick the right Testing Library queryUse accessible roles and names to query React components and diagnose a mismatch from Testing Library's error.
- Test debounce and retries with fake timersUse Vitest fake timers to assert debounce and promise-based retry behaviour without waiting on the real clock.
- Record a Playwright test with codegenPoint npx playwright codegen at your app, click through it, and save the recording as a first test you can run and edit.
- Give one Playwright step its own timeoutPass a timeout option to test.step so a slow step fails in seconds with its own name, instead of burning the whole test timeout.
- Fix React Testing Library 16 install errorsDeclare the DOM peer dependency to fix React Testing Library 16’s missing module error.