feat: integrate visual regression testing via Storybook test-runner + MCP screenshot tool#1640
Conversation
… MCP screenshot tool Agent-Logs-Url: https://github.com/jumpinjackie/mapguide-react-layout/sessions/8badf0ba-c860-4488-9c63-889363ddd622 Co-authored-by: jumpinjackie <563860+jumpinjackie@users.noreply.github.com>
…stories to exclude them from visual regression testing and fix icon sprite story Co-authored-by: Copilot <copilot@github.com>
|
@copilot Update PR description in light of my changes added on top |
Updated the PR description to reflect your follow-up commit ( Your changes on top:
The PR description now reflects the full combined state of both commits. |
|
@copilot Add a new .md or update an exising relevant one to cover how to use the MCP integration |
…guide; add to sidebar Agent-Logs-Url: https://github.com/jumpinjackie/mapguide-react-layout/sessions/44c5c457-b6aa-43d8-b682-e603a07a4e18 Co-authored-by: jumpinjackie <563860+jumpinjackie@users.noreply.github.com>
Updated
Also added |
Bundle Size Report ✅ PASS
Top Changes
Generated by build-size-diff Commit: 50d3cf1 |
…configurations and updated test scripts Co-authored-by: Copilot <copilot@github.com>
|
@copilot Disable (by commenting, not removing) the visual regression test step/job for CI. I cannot fathom why CI produces a different set of results and I don't want to waste anymore credits finding out why. I will manually visual regression test locally as needed. |
…vironments) Agent-Logs-Url: https://github.com/jumpinjackie/mapguide-react-layout/sessions/88d04b55-1623-454d-893b-7e6fed353e48 Co-authored-by: jumpinjackie <563860+jumpinjackie@users.noreply.github.com>
Done in commit |
Establishes a self-hostable visual regression baseline ahead of the Blueprint.js replacement, so any component-level visual regressions are caught automatically. Also adds an MCP-callable screenshot tool so an agent can "see" a story in real time.
Visual regression testing (
@storybook/test-runner+jest-image-snapshot).storybook/test-runner.js—postVisithook captures#storybook-rootper story and compares against stored PNGs viajest-image-snapshot. Waits for DOM attachment + shortnetworkidlewindow (2 s, soft timeout) before snapping.visual-snapshots/— Baseline PNGs committed for all stable stories; these are the comparison targets for every visual regression run.Story exclusions via
no-visual-regressiontagStories that require a live MapGuide backend, WebGL, or external assets are tagged with
tags: ['no-visual-regression']and automatically skipped via--excludeTags no-visual-regression:compact-viewer.stories.tsx— requires a real map tile servermap.stories.tsx— requires WebGL / live MapGuidemapguide.stories.tsx— requires a live MapGuide backendThe
_ImageIconSpritestory was also fixed to use correct sprite class names (zoom-in,zoom-out-fixed, etc.) so it produces a stable baseline.npm scripts
yarn test:visualno-visual-regressionstories)yarn test:visual:ciyarn test:visual:update-u; excludesno-visual-regressionstories)MCP / agent screenshot tool (
tools/capture-story.ts)Dual-mode TypeScript script:
yarn capture:story --story "Common Elements/Button Variants"— navigates the Storybook iframe, waits for#storybook-root, saves PNG to/tmp/, prints path.yarn mcp:storybook— stdio JSON-RPC server exposing acapture_storytool that returns the screenshot as an inline base64 PNG image. Register in your MCP client config:{ "storybook-screenshot": { "command": "yarn", "args": ["mcp:storybook"], "cwd": "/path/to/mapguide-react-layout" } }Full MCP integration documentation (CLI flags, story path format, client registration snippets for Claude Desktop and VS Code/Copilot, tool parameter reference, and troubleshooting) is in
docs_dev/content/VISUAL_REGRESSION.md.CI (
playwright.config.ts+.github/workflows/main.yml)The
visual-regressionCI job has been commented out in.github/workflows/main.yml. CI produces inconsistent rendering results across environments, making automated baseline comparisons unreliable. Visual regression tests should be run locally as needed usingyarn test:visualoryarn test:visual:update. The job definition is preserved in the workflow file (commented) so it can be re-enabled in the future.