Closes P1 #10 step 2. Adds @playwright/test@^1.60.0, playwright.config.js (CI fail-loud / dev warn-and-continue for missing VERCEL_AUTOMATION_BYPASS_SECRET, two projects partitioned by testMatch, snapshotPathTemplate aligned with workflow upload path), tests/visual/homepage.spec.ts (1 test, no baseline committed per architect Boot-the-brief Finding 7), 3 npm scripts, and 3 .gitignore entries. Smoke tests now run end-to-end against Vercel preview with x-vercel-protection-bypass header: 3/3 passed in 2.9s, total workflow 59s. Zero secret leaks in log. PR #18 architect-commit3ac527e, implementer-commitc72d006.
37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
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://<preview>.vercel.app \
|
|
* VERCEL_AUTOMATION_BYPASS_SECRET=<value> \
|
|
* 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');
|
|
});
|
|
});
|