Back to list
joshribakoff

visual-regression

by joshribakoff

1🍴 0📅 Jan 22, 2026

SKILL.md


name: visual-regression description: Screenshot-based regression testing with Playwright. Compares rendered pixels against baseline PNGs. Use when working with stories, *.visual.spec.ts files, or baseline screenshots. Auto-apply when editing files in stories/ or *.visual.spec.ts.

Visual Regression Skill

Orchestrates screenshot-based regression testing with Playwright. Compares rendered pixels against baseline PNGs to detect unintended visual changes.

Specialized Skills

Visual regression has two specialized skills:

SkillPurposeUse When
component-screenshot-testingReact component pixelsTesting UI components, buttons, panels
canvas-filmstrip-testingCanvas-rendered matrix progressionsTesting 8-layer filmstrip visualizations

Shared Infrastructure

Directory Structure

stories/
  01-bathymetry/
    01-bathymetry.mdx              → MDX story page
    01-bathymetry.visual.spec.ts   → Playwright visual test
    strip-bathymetry-basic.png     → Baseline screenshot (colocated)
  02-energy-field/
  ...
  components/                      → Shared story components
  visual-test-helpers.ts           → Test helper utilities
  App.tsx                          → Story viewer app

Playwright Configuration

// playwright.visual.config.js
testDir: './stories',
testMatch: '**/*.visual.spec.ts',
snapshotPathTemplate: 'stories/{testFileDir}/{arg}{ext}',

Commands

# Verify stories compile (fast, no dev server)
npm run stories:build

# Run visual regression tests
npm run test:visual:headless      # CI/agents
npm run test:visual:headed        # Debugging with browser UI

# Update baselines after intentional changes
npm run test:visual:update:headless
npm run test:visual:update:headed

# Clear test artifacts
npm run reset:visual              # Clear results/reports only
npm run reset:visual:all          # Clear results + colocated baselines

# Start stories dev server for interactive debugging
npm run stories                   # Starts on http://localhost:3001

Interactive Debugging with Chrome DevTools MCP

IMPORTANT: Always use the dev server (localhost), NOT file:// URLs. The file:// protocol triggers CORS errors.

Start Dev Server

npm run stories  # Starts on http://localhost:3001

Launch in Browser

mcp__chrome-devtools__new_page({ url: "http://localhost:3001" })

// Navigate to specific page
mcp__chrome-devtools__new_page({ url: "http://localhost:3001/?page=01-bathymetry" })

// With presentation mode and theme
mcp__chrome-devtools__new_page({ url: "http://localhost:3001/?mode=presentation&theme=light" })

Take Snapshots and Screenshots

// Get element UIDs
mcp__chrome-devtools__take_snapshot()

// Screenshot specific element
mcp__chrome-devtools__take_screenshot({ uid: "<element-uid>" })

// Reload after changes
mcp__chrome-devtools__navigate_page({ type: "reload" })

Workflow: Data Before Visual

CRITICAL: When modifying progression data, verify data first:

  1. Run data tests - npx vitest run *Progressions.test.ts
  2. Verify matrix values - Check ASCII output shows expected changes
  3. Then update visuals - Only after data tests pass
Wrong: Change coefficient → Update visual → "Looks the same"
Right: Change coefficient → Check matrix → Verify numbers → Update visual

Verifying Stories

After code changes, verify stories still build:

npm run stories:build

This catches broken imports, type errors, missing dependencies.

Do NOT start dev server just to verify - use the build.

Common Issues

Import Extensions After TS Migration

// Wrong
import { foo } from '../state/waveModel.js';

// Correct
import { foo } from '../state/waveModel';

Missing Exports

// In *Progressions.ts - ensure strips are exported
export const BATHYMETRY_STRIPS = [BATHYMETRY_STRIP_BASIC];
  • component-screenshot-testing - React component pixel testing
  • canvas-filmstrip-testing - Matrix-to-canvas filmstrip testing
  • matrix-data-model-progression-testing - Data verification before visual

Score

Total Score

45/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

0/5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon