import { test, expect } from '@playwright/test'; /** * Visual baseline for the public homepage. * * FIRST RUN (no committed baseline yet): * The Screenshot diff workflow runs `playwright test --project=visual * --update-snapshots=none` (per .github/workflows/visual-diff.yml). With * no baseline file at `tests/visual/__screenshots__/home.png` AND the * `none` flag, this test FAILS — and that's the documented end state of * the `adopt-playwright-smoke` convoy (Decision 4 in * `.convoys/adopt-playwright-smoke.md`). The workflow's * `continue-on-error: true` swallows the failure and the comment-on-PR * step posts "Visual Diff — view run" with empty artifacts. * * SEEDING THE BASELINE (post-merge follow-up): * Run `npm run test:visual:update` in a Linux environment so the * generated PNG matches what CI will produce. The cleanest path is the * Playwright Docker image: * * docker run --rm -v "$PWD":/work -w /work \ * mcr.microsoft.com/playwright:v1.60.0-noble \ * sh -c "npm ci && BASE_URL=https://.vercel.app \ * VERCEL_AUTOMATION_BYPASS_SECRET= \ * npm run test:visual:update" * * Then commit `tests/visual/__screenshots__/home.png`. This is tracked * as the `seed-visual-baselines-on-linux` follow-up convoy. */ const BASE = process.env.BASE_URL ?? 'http://localhost:3000'; test.describe('visual: public homepage', () => { test('home renders consistently against baseline', async ({ page }) => { await page.goto(BASE); await expect(page).toHaveScreenshot('home.png'); }); });