Quality Checks
Console errors, smoke tests, accessibility and visual regression.
Quality Checks
page.assertNoConsoleErrors()
.assertNoSmoke( [ "/", "/about", "/pricing" ] )
.assertNoAccessibilityIssues( { impact : "serious" } )
.assertScreenshotMatches( "home" )
Console errors and smoke tests
consoleErrors()returnsconsole.error()messages and uncaught exceptions.assertNoConsoleErrors( ignore = [] )fails if there are any (ignore by substring).assertNoSmoke( urls, { ignore, waitUntil } )visits every URL and fails on HTTP 400+ or JavaScript errors, listing every problem at once.
Accessibility
Powered by axe-core (bundled).
violations = page.accessibility( { tags : [ "wcag2a", "wcag2aa" ] } )
page.assertNoAccessibilityIssues( { exclude : [ "color-contrast" ], impact : "moderate" } )
Options: tags, exclude (rule ids), include (a CSS selector to audit), impact (minimum that fails: minor, moderate, serious, critical).
Visual regression
page.assertScreenshotMatches( "dashboard", { fullPage : true, mask : [ "@clock" ] } )
page.locator( "@chart" ).assertScreenshotMatches( "sales-chart", { maxDiffPixelRatio : 0.01 } )
- The first run writes the baseline (
tests/snapshots/<name>.pngby default, see thesnapshotssetting). - A mismatch fails and writes
<name>-actual.pngand<name>-diff.png(differences in red). - Update baselines with
BX_PLAYWRIGHT_UPDATE_SNAPSHOTS=trueor{ update : true }. - Options:
threshold(color tolerance, 0.2),maxDiffPixels,maxDiffPixelRatio,mask,fullPage,directory. - Use the
screenshotprofile for stable images across machines.