feat: install @playwright/test + playwright.config.ts

This commit is contained in:
2026-05-13 08:25:54 +02:00
parent 4fa108dd48
commit f43c314156
4 changed files with 44 additions and 2 deletions

30
playwright.config.ts Normal file
View File

@@ -0,0 +1,30 @@
import { defineConfig, devices } from "@playwright/test";
/**
* Playwright config for visual regression against Storybook.
*
* Expectations:
* - Storybook is served at http://localhost:6006 BEFORE running these tests.
* The pnpm test:visual script wraps the start + run + stop dance.
* - Screenshot baselines live next to each test file in __snapshots__/.
* - One browser (chromium) is enough for v1; multi-browser comes later.
*/
export default defineConfig({
testDir: "./apps/storybook/tests",
testMatch: /.*\.spec\.ts/,
fullyParallel: false,
reporter: process.env.CI ? "github" : "list",
use: {
baseURL: "http://localhost:6006",
viewport: { width: 1280, height: 720 },
screenshot: "only-on-failure",
},
expect: {
toHaveScreenshot: {
// Tolerate up to 1% pixel difference. Tune when first real component
// lands and the noise floor is measurable.
maxDiffPixelRatio: 0.01,
},
},
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
});