deckhearth/tests/visual/homepage.spec.ts

48 lines
2.1 KiB
TypeScript
Raw Normal View History

import { test, expect } from '@playwright/test';
/**
* Visual baseline for the public homepage.
*
chore(docs): sweep stale visual-baseline references + queue gate-hardening convoy (#135) PR #58 (83a358b, 2026-06-02) committed the first Linux visual baseline, resolving the seed-visual-baselines-on-linux convoy. But the cleanup sweep across docs that referenced the convoy as "queued / not yet done" never landed. Three files still describe the world as if PR #58 hadn't happened, which confuses any agent reading the codebase to understand the visual-diff pipeline: 1. tests/visual/homepage.spec.ts module docblock — described "FIRST RUN (no committed baseline yet)" and "SEEDING THE BASELINE (post-merge follow-up)" as the active state. 2. playwright.config.js snapshotPathTemplate comment — said "Per Decision 4, we don't commit baselines this convoy" and pointed at the queued seed convoy as future work. 3. AGENTS.md § Testing § Visual baselines + § CI behavior § Screenshot diff — claimed "none committed yet" and that the first visual-diff run "will fail at the test step because no baseline exists yet." Sweeping all three to describe the current reality. The Mac-vs-Linux platform footgun (snapshotPathTemplate has no {platform} token) is still live, so that warning stays — just rephrased from "don't have baselines yet" to "don't regenerate them on a Mac." Also surfaces a separate finding the seed work left behind: visual-diff.yml's screenshot capture step still carries `continue-on-error: true`, making the diff advisory rather than gating. Flipping it requires re-seeding the baseline against post-glass-redesign main first (the PR #58 baseline predates unify-glass-panel-surfaces + cleanup-card-item-list-and-share-modal-palette + migrate-button-input-mobilenav-to-glass-primitive). New convoy seed at .convoys/harden-visual-diff-gate.md captures the two-step shape (re-seed baseline, then flip the gate) plus the recommended workflow_dispatch approach for repeatable re-seeding on CT 111. No code behavior changes. Documentation + .md convoy seed only. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 21:30:34 -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).
*
chore(docs): sweep stale visual-baseline references + queue gate-hardening convoy (#135) PR #58 (83a358b, 2026-06-02) committed the first Linux visual baseline, resolving the seed-visual-baselines-on-linux convoy. But the cleanup sweep across docs that referenced the convoy as "queued / not yet done" never landed. Three files still describe the world as if PR #58 hadn't happened, which confuses any agent reading the codebase to understand the visual-diff pipeline: 1. tests/visual/homepage.spec.ts module docblock — described "FIRST RUN (no committed baseline yet)" and "SEEDING THE BASELINE (post-merge follow-up)" as the active state. 2. playwright.config.js snapshotPathTemplate comment — said "Per Decision 4, we don't commit baselines this convoy" and pointed at the queued seed convoy as future work. 3. AGENTS.md § Testing § Visual baselines + § CI behavior § Screenshot diff — claimed "none committed yet" and that the first visual-diff run "will fail at the test step because no baseline exists yet." Sweeping all three to describe the current reality. The Mac-vs-Linux platform footgun (snapshotPathTemplate has no {platform} token) is still live, so that warning stays — just rephrased from "don't have baselines yet" to "don't regenerate them on a Mac." Also surfaces a separate finding the seed work left behind: visual-diff.yml's screenshot capture step still carries `continue-on-error: true`, making the diff advisory rather than gating. Flipping it requires re-seeding the baseline against post-glass-redesign main first (the PR #58 baseline predates unify-glass-panel-surfaces + cleanup-card-item-list-and-share-modal-palette + migrate-button-input-mobilenav-to-glass-primitive). New convoy seed at .convoys/harden-visual-diff-gate.md captures the two-step shape (re-seed baseline, then flip the gate) plus the recommended workflow_dispatch approach for repeatable re-seeding on CT 111. No code behavior changes. Documentation + .md convoy seed only. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 21:30:34 -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:
*
* 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"
*
chore(docs): sweep stale visual-baseline references + queue gate-hardening convoy (#135) PR #58 (83a358b, 2026-06-02) committed the first Linux visual baseline, resolving the seed-visual-baselines-on-linux convoy. But the cleanup sweep across docs that referenced the convoy as "queued / not yet done" never landed. Three files still describe the world as if PR #58 hadn't happened, which confuses any agent reading the codebase to understand the visual-diff pipeline: 1. tests/visual/homepage.spec.ts module docblock — described "FIRST RUN (no committed baseline yet)" and "SEEDING THE BASELINE (post-merge follow-up)" as the active state. 2. playwright.config.js snapshotPathTemplate comment — said "Per Decision 4, we don't commit baselines this convoy" and pointed at the queued seed convoy as future work. 3. AGENTS.md § Testing § Visual baselines + § CI behavior § Screenshot diff — claimed "none committed yet" and that the first visual-diff run "will fail at the test step because no baseline exists yet." Sweeping all three to describe the current reality. The Mac-vs-Linux platform footgun (snapshotPathTemplate has no {platform} token) is still live, so that warning stays — just rephrased from "don't have baselines yet" to "don't regenerate them on a Mac." Also surfaces a separate finding the seed work left behind: visual-diff.yml's screenshot capture step still carries `continue-on-error: true`, making the diff advisory rather than gating. Flipping it requires re-seeding the baseline against post-glass-redesign main first (the PR #58 baseline predates unify-glass-panel-surfaces + cleanup-card-item-list-and-share-modal-palette + migrate-button-input-mobilenav-to-glass-primitive). New convoy seed at .convoys/harden-visual-diff-gate.md captures the two-step shape (re-seed baseline, then flip the gate) plus the recommended workflow_dispatch approach for repeatable re-seeding on CT 111. No code behavior changes. Documentation + .md convoy seed only. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 21:30:34 -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`.
*/
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');
});
});