test(visual): add Playwright visual regression screenshot tests
This commit is contained in:
parent
619b27103b
commit
96b4453e95
25
web/e2e/visual-regression.spec.ts
Normal file
25
web/e2e/visual-regression.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
|
||||
/**
|
||||
* Visual regression tests — capture screenshots of key pages.
|
||||
* Run with: npx playwright test visual-regression --update-snapshots (to create baselines)
|
||||
* Subsequent runs compare against baselines and fail on pixel diff.
|
||||
*/
|
||||
|
||||
const ROUTES: { path: string; name: string }[] = [{path:"/dashboard",name:"dashboard"},{path:"/workspaces",name:"workspaces"},{path:"/search",name:"search"}];
|
||||
|
||||
test.describe("Visual Regression", () => {
|
||||
for (const route of ROUTES) {
|
||||
test(\`\${route.name} matches snapshot\`, async ({ page }) => {
|
||||
await page.goto(route.path);
|
||||
await page.waitForLoadState("networkidle");
|
||||
// Allow animations to settle
|
||||
await page.waitForTimeout(500);
|
||||
await expect(page).toHaveScreenshot(\`\${route.name}.png\`, {
|
||||
fullPage: true,
|
||||
maxDiffPixelRatio: 0.01,
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user