Parent: #138
Goal
Add an InkAds-marketing-style Playwright visual capture + review gate for @singleton-sd/post-kit-editor Storybook stories so PRs that change the admin/canvas UI fail a dedicated visual-review check until a human accepts diffs.
Pattern (from poc-inkads-marketing)
InkAds uses:
pnpm test:visual — Playwright screenshots + pixelmatch vs baseline → test-results/visual/ (+ manifest.json)
pnpm test:visual:gate — fails when manifest has changed/new unless VISUAL_ACCEPTED=1 / label visual-accepted
- CI job named
visual-review (human gate, not infra failure)
Adapt for PostKit editor:
- Capture Storybook static stories (not a marketing site)
- Baseline: committed baselines under the package or compare PR Storybook build vs base SHA Storybook build (InkAds preferred local
VISUAL_BASE_DIR)
- Keep scope small: key stories only (
Admin/EmailTemplateAdmin/FullAdmin, Editor/EmailBuilderCanvas/Editable, maybe Editor/EmailTemplateEditor/FullEditor)
Scope
- Scripts on
@singleton-sd/post-kit-editor: build-storybook, test:visual, test:visual:gate, playwright:install
packages/post-kit-editor/tests/visual.mjs + visual-gate.mjs (+ thin report HTML if practical)
- GitHub Actions job
visual-review (can be in ci.yml or a dedicated workflow) that:
- builds Storybook
- runs
test:visual
- runs
test:visual:gate
- uploads
test-results/visual artifact
- honors
visual-accepted label / VISUAL_ACCEPTED like InkAds
- Document how to update baselines and accept intentional diffs in package README
- Seed initial baselines from a green local capture
Constraints
- Do not require Azure Static Web Apps hosting for v1 (artifact + gate is enough; hosted report can be follow-up)
- Synthetic fixtures only — no secrets
- Do not block the existing
Lint / test / build job on visual flakiness beyond the dedicated visual-review job
- Work in the existing
#139 worktree/PR branch if open, or a new worktree from origin/main after merge
Acceptance criteria
Agent implementation notes
Read ~/src/inkads/marketing/poc-inkads-marketing/main/tests/visual.mjs and visual-gate.mjs plus .github/workflows/preview.yml visual-review job. Adapt Storybook iframe/story URLs (iframe.html?id=...). Branch: feat/<N>-editor-visual-gate or continue on feat/139-email-builder-mui-canvas if this is stacked on #142.
Parent: #138
Goal
Add an InkAds-marketing-style Playwright visual capture + review gate for
@singleton-sd/post-kit-editorStorybook stories so PRs that change the admin/canvas UI fail a dedicatedvisual-reviewcheck until a human accepts diffs.Pattern (from poc-inkads-marketing)
InkAds uses:
pnpm test:visual— Playwright screenshots + pixelmatch vs baseline →test-results/visual/(+manifest.json)pnpm test:visual:gate— fails when manifest haschanged/newunlessVISUAL_ACCEPTED=1/ labelvisual-acceptedvisual-review(human gate, not infra failure)Adapt for PostKit editor:
VISUAL_BASE_DIR)Admin/EmailTemplateAdmin/FullAdmin,Editor/EmailBuilderCanvas/Editable, maybeEditor/EmailTemplateEditor/FullEditor)Scope
@singleton-sd/post-kit-editor:build-storybook,test:visual,test:visual:gate,playwright:installpackages/post-kit-editor/tests/visual.mjs+visual-gate.mjs(+ thin report HTML if practical)visual-review(can be inci.ymlor a dedicated workflow) that:test:visualtest:visual:gatetest-results/visualartifactvisual-acceptedlabel /VISUAL_ACCEPTEDlike InkAdsConstraints
Lint / test / buildjob on visual flakiness beyond the dedicatedvisual-reviewjob#139worktree/PR branch if open, or a new worktree fromorigin/mainafter mergeAcceptance criteria
pnpm --filter @singleton-sd/post-kit-editor build-storybookworkspnpm --filter @singleton-sd/post-kit-editor test:visualwrites screenshots +manifest.jsontest:visual:gatefails on changed/new vs baseline when not acceptedvisual-reviewcheckAgent implementation notes
Read
~/src/inkads/marketing/poc-inkads-marketing/main/tests/visual.mjsandvisual-gate.mjsplus.github/workflows/preview.ymlvisual-reviewjob. Adapt Storybook iframe/story URLs (iframe.html?id=...). Branch:feat/<N>-editor-visual-gateor continue onfeat/139-email-builder-mui-canvasif this is stacked on #142.