test(tst-020): visual regression baseline tests — home + mobile viewport

This commit is contained in:
admin-valentin 2026-07-31 15:18:39 +00:00
parent 30c33042b8
commit 9314d0a8f5

36
tests/visual/home.spec.ts Normal file
View file

@ -0,0 +1,36 @@
/**
* TST-020: Visual Regression Home / Dashboard
* Snapshots are committed as baselines; CI fails on pixel diff.
*/
import { test, expect } from '@playwright/test';
test.describe('Visual Regression — Core Screens', () => {
test('landing / login page renders correctly', async ({ page }) => {
await page.goto('/');
await page.waitForLoadState('networkidle');
await expect(page).toHaveScreenshot('home.png', {
fullPage: true,
maxDiffPixelRatio: 0.02,
});
});
test('login page has no console errors', async ({ page }) => {
const errors: string[] = [];
page.on('console', (msg) => {
if (msg.type() === 'error') errors.push(msg.text());
});
await page.goto('/');
await page.waitForLoadState('networkidle');
expect(errors).toHaveLength(0);
});
test('mobile viewport — landing page', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto('/');
await page.waitForLoadState('networkidle');
await expect(page).toHaveScreenshot('home-mobile.png', {
fullPage: true,
maxDiffPixelRatio: 0.02,
});
});
});