Documentation Index
Fetch the complete documentation index at: https://sunpeak.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
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.
Running Visual Tests
- pnpm
- npm
- yarn
Writing Visual Tests
Useresult.screenshot() in any e2e test. It accepts an optional name and Playwright toHaveScreenshot options:
Screenshot Targets
By default,inspector.renderTool() hides the inspector sidebars, and screenshot() captures the app content inside the double-iframe. This keeps visual baselines stable when the inspector UI changes. Pass a specific element locator to narrow the capture further:
Configuring Visual Defaults
Pass avisual option to defineConfig() to set project-wide defaults for screenshot comparison:
toHaveScreenshot options (threshold, maxDiffPixelRatio, maxDiffPixels, animations, etc.) are supported. The snapshotPathTemplate controls where baseline images are stored.
See Also
E2E Testing
Full E2E testing guide with the mcp fixture.
Inspector
The runtime that powers visual tests.