Quality Checks

Console errors, smoke tests, accessibility and visual regression.

On this page

Quality Checks

One-line checks for problems users notice: JavaScript errors, broken pages, accessibility issues and visual changes. Each one is an assertion, so it chains and fails with Playwright.AssertionFailed.

page.assertNoConsoleErrors()
	.assertNoSmoke( [ "/", "/about", "/pricing" ] )
	.assertNoAccessibilityIssues( { impact : "serious" } )
	.assertScreenshotMatches( "home" )

Console errors and smoke tests

  • consoleErrors() returns the console.error() messages and uncaught exceptions of the page.
  • assertNoConsoleErrors( ignore ) fails if there are any. ignore is an array of substrings, such as [ "favicon.ico" ].
  • assertNoSmoke( urls, { ignore, waitUntil } ) visits every URL and fails on HTTP 400+ or JavaScript errors, listing every problem at once.

Accessibility

Audits run with axe-core, bundled with the module.

violations = page.accessibility( { tags : [ "wcag2a", "wcag2aa" ] } )
page.assertNoAccessibilityIssues( { exclude : [ "color-contrast" ], impact : "moderate" } )
OptionMeaning
tagsRule sets to run, such as wcag2a, wcag2aa
excludeRule ids to skip
includeA CSS selector to audit instead of the whole page
impactThe minimum impact that fails: minor (default, everything), moderate, serious, critical

accessibility() returns the violations: { id, impact, description, help, helpUrl, nodes }.

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>.png by default, see the snapshots setting.
  • A mismatch fails and writes <name>-actual.png and <name>-diff.png (differences in red) next to it.
  • Update baselines with BX_PLAYWRIGHT_UPDATE_SNAPSHOTS=true or { update : true }.
  • Animations are disabled and the caret hidden; the image is taken once it stops changing.
  • Use the screenshot profile for stable images across machines.
OptionMeaning
thresholdPer pixel color tolerance, 0 to 1 (default 0.2)
maxDiffPixels, maxDiffPixelRatioHow many pixels, or which share of them, may differ (default 0)
maskSelectors or locators painted over before comparing
fullPage, clip, omitBackgroundScreenshot options
directory, updateWhere baselines live, and overwrite them
Edit this page Download Markdown Last updated Oct 23, 2026, 3:55:59 PM Report an issue