Visual regression tests capture screenshots of your resources and compare them against saved baselines. This catches unintended visual changes across themes, display modes, and hosts.Screenshot comparisons only run when you pass --visual. Without it, result.screenshot() calls are silently skipped, so you can include them in your regular e2e tests without affecting normal runs.
By default, screenshot() captures the app content inside the double-iframe. Use the target option to capture the full inspector page, or pass a specific element locator:
// Screenshot just the app (default)await result.screenshot('app-view');// Screenshot the full inspector page (host chrome + app)await result.screenshot('full-page', { target: 'page' });// Screenshot a specific elementawait result.screenshot('album-card', { element: result.app().locator('button:has-text("Summer Slice")'),});
All Playwright toHaveScreenshot options (threshold, maxDiffPixelRatio, maxDiffPixels, animations, etc.) are supported. The snapshotPathTemplate controls where baseline images are stored.