/** * Visual regression testing with Playwright screenshots. * * Run: npx playwright test --config=e2e/visual.config.ts */ import { defineConfig, devices } from '@playwright/test' export default defineConfig({ testDir: '.', testMatch: 'visual.spec.ts', timeout: 30000, expect: { toHaveScreenshot: { maxDiffPixelRatio: 0.05, threshold: 0.2, }, }, use: { baseURL: 'http://localhost:6006', // Storybook screenshot: 'on', }, projects: [ { name: 'desktop', use: { ...devices['Desktop Chrome'] } }, { name: 'mobile', use: { ...devices['iPhone 13'] } }, ], webServer: { command: 'npx storybook dev -p 6006 --no-open', port: 6006, reuseExistingServer: true, timeout: 60000, }, })