Skip to content

Add Playwright Storybook visual gate for post-kit-editor #143

Description

@patoperpetua

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:
    1. builds Storybook
    2. runs test:visual
    3. runs test:visual:gate
    4. uploads test-results/visual artifact
    5. 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

  • pnpm --filter @singleton-sd/post-kit-editor build-storybook works
  • pnpm --filter @singleton-sd/post-kit-editor test:visual writes screenshots + manifest.json
  • test:visual:gate fails on changed/new vs baseline when not accepted
  • CI exposes a visual-review check
  • README documents local + CI acceptance flow

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions