2026-05-24 20:25:18 -04:00
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Visual baseline for the public homepage.
|
|
|
|
|
*
|
2026-06-12 21:20:33 -04:00
|
|
|
* The Screenshot diff workflow runs `playwright test --project=visual
|
|
|
|
|
* --update-snapshots=none` (per .github/workflows/visual-diff.yml). The
|
|
|
|
|
* `none` flag means "use the existing baseline; do not write a new one"
|
|
|
|
|
* — drift between the rendered page and the committed PNG fails the
|
|
|
|
|
* test. The committed Linux baseline lives at
|
|
|
|
|
* `tests/visual/__screenshots__/home.png` (seeded by PR #58 `83a358b`,
|
|
|
|
|
* 2026-06-02).
|
2026-05-24 20:25:18 -04:00
|
|
|
*
|
2026-06-12 21:20:33 -04:00
|
|
|
* NOTE: as of this writing, `visual-diff.yml`'s screenshot capture step
|
|
|
|
|
* still carries `continue-on-error: true` — failures surface as
|
|
|
|
|
* artifacts + PR comments but do not gate merge. Flipping that to a
|
|
|
|
|
* hard gate is the `harden-visual-diff-gate` follow-up; it depends on
|
|
|
|
|
* the baseline being re-seeded against the post-glass-redesign main
|
|
|
|
|
* (the seeded PR-#58 PNG predates the `unify-glass-panel-surfaces` /
|
|
|
|
|
* `cleanup-card-item-list-and-share-modal-palette` /
|
|
|
|
|
* `migrate-button-input-mobilenav-to-glass-primitive` work).
|
|
|
|
|
*
|
|
|
|
|
* RE-SEEDING THE BASELINE (when the homepage changes intentionally):
|
|
|
|
|
* Run on Linux — Mac-generated PNGs do not match CT 111 Linux output
|
|
|
|
|
* because `playwright.config.js`'s `snapshotPathTemplate` has no
|
|
|
|
|
* `{platform}` token. Recommended path is the Playwright Docker image:
|
2026-05-24 20:25:18 -04:00
|
|
|
*
|
|
|
|
|
* 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"
|
|
|
|
|
*
|
2026-06-12 21:20:33 -04:00
|
|
|
* …or dispatch the (queued) `seed-visual-baselines` workflow on
|
|
|
|
|
* CT 111 directly, which uses the same Linux toolchain as the
|
|
|
|
|
* diff workflow so byte-equivalence is guaranteed.
|
|
|
|
|
*
|
|
|
|
|
* Commit the regenerated `tests/visual/__screenshots__/home.png`.
|
2026-05-24 20:25:18 -04:00
|
|
|
*/
|
|
|
|
|
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');
|
|
|
|
|
});
|
|
|
|
|
});
|