/** * 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, }); }); });