Skip to content

feat: self hosted visual regression#2522

Open
balzss wants to merge 5 commits intomasterfrom
feat/self-hosted-visual-regression
Open

feat: self hosted visual regression#2522
balzss wants to merge 5 commits intomasterfrom
feat/self-hosted-visual-regression

Conversation

@balzss
Copy link
Copy Markdown
Contributor

@balzss balzss commented Apr 21, 2026

Summary

Replaces the Chromatic-based visual regression flow with a self-hosted pipeline that runs entirely on GitHub infrastructure.

What changed

  • New ui-scripts visual-diff command (packages/ui-scripts/lib/commands/visual-diff.ts) compares screenshot directories with pixelmatch and generates a self-contained HTML report.
  • .github/workflows/visual-regression.yml runs on every PR: builds InstUI, builds and serves the regression-test Next.js app, captures screenshots with Cypress, fetches baselines from the new visual-baselines branch, diffs, and publishes the report to gh-pages under visual-regression/pr-<N>/.
  • .github/workflows/visual-baselines.yml runs on every push to master and force-pushes the fresh capture set to the visual-baselines branch. No manual review step — merging is the approval.
  • regression-test now uses next build with output: 'export' and is served by http-server. No SSR, no hydration mismatches, byte-deterministic captures.
  • Captures are full-page at a fixed 1280×800 viewport, with timers and animations disabled.
  • Sticky PR comment summarizes the run and inlines each changed row's diff image inside a collapsed <details> block.
  • Report UI: lightbox viewer with Baseline/Actual/Diff toggle, draggable slider overlay, 1:1/Fit zoom, prev/next navigation, highlighted active filter, debounced search, per-row source-file link to the component page.
  • docs/testing/visual-regression.md documents the pipeline, local dev loop, CLI flags, report controls, and tuning advice. testing-overview.md updated, regression-test/README.md rewritten.
  • Chromatic deps (chromatic, @chromatic-com/cypress) removed from regression-test/package.json. CHROMATIC_APP_CODE secret is no longer used.

Not merged to master

  • .github/workflows/seed-baselines-temp.yml — throwaway workflow that seeds the visual-baselines branch before this PR lands, so diffing can be exercised end-to-end. Delete before merge.
  • regression-test/src/app/button/page.tsx contains a visible test change to trigger the Changed state. Revert before merge.

Test plan

  • Capture, diff, and publish report job runs and publishes to https://instructure.design/visual-regression/pr-2522/.
  • Sticky PR comment lists ⚠️ Changes detected, Changed: 1, Unchanged: 31, and the collapsed Diff images block shows the inline diff for button-and-derivatives.png.
  • Open the report URL — confirm:
    • Top bar shows PR #2522 link back to this PR.
    • Filter buttons (All / Changed / New / Removed / Unchanged) highlight the active one when clicked.
    • Search box filters rows live (debounced ~150ms) and combines with the active filter.
    • Each row header shows a GitHub link to the corresponding page.tsx in this PR's branch.
    • Click a thumbnail — lightbox opens, Baseline/Actual/Diff tabs switch correctly, Slider mode overlays with an aligned drag handle, 1:1/Fit zoom toggle works, prev/next navigate between visible rows.
  • Revert the test-break commit locally; push again — diff count returns to 0 and the check goes green.
  • Cypress component tests, Vitest unit tests, Lint commit msg + code, Analyze (javascript), CodeQL pass.

Follow-ups before merging

  • Delete .github/workflows/seed-baselines-temp.yml.
  • Revert test: break button to exercise diffing.

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2522/

Built to branch gh-pages at 2026-04-21 21:07 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

Visual regression report

⚠️ Changes detected.

Status Count
Unchanged 31
Changed 1
New 0
Removed 0

📊 View full report

Diff images (1)

button-and-derivatives.png — 5595 pixels differ

Baselines come from the visual-baselines branch. They refresh on every merge to master.

github-actions Bot pushed a commit that referenced this pull request Apr 21, 2026
@balzss balzss force-pushed the feat/self-hosted-visual-regression branch from ff20f5f to 2f0b68d Compare April 21, 2026 12:51
github-actions Bot pushed a commit that referenced this pull request Apr 21, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 21, 2026
@balzss balzss force-pushed the feat/self-hosted-visual-regression branch 3 times, most recently from 848eb46 to cbb6006 Compare April 21, 2026 14:27
@balzss balzss self-assigned this Apr 21, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 21, 2026
@balzss balzss force-pushed the feat/self-hosted-visual-regression branch 2 times, most recently from 5695bb0 to c47f0a5 Compare April 21, 2026 14:50
balzss and others added 3 commits April 21, 2026 16:59
…eplacing Chromatic

Capture full-page screenshots via cy.screenshot() in an afterEach hook,
record each test's visited URL via a cy.task for source-file linking,
diff against baselines stored on a visual-baselines branch using a new
`ui-scripts visual-diff` command, and publish an HTML report per PR to
gh-pages with a sticky PR comment linking to it.

The regression-test Next.js app now uses `output: 'export'` with
`trailingSlash: true`, serving a fully static site through http-server
— no SSR and no hydration so captures are byte-deterministic.

The report has a lightbox viewer with baseline/actual/diff mode toggle,
a draggable slider overlay, fit-to-window and 1:1 zoom, prev/next
navigation, a PR number link in the header, per-row source-file links
back to the GitHub blob URL, a debounced live search box, and
highlighted active filter buttons. The sticky PR comment includes a
collapsed <details> block with inline diff images for every changed row.

Documentation added at docs/testing/visual-regression.md.

Removes the Chromatic integration; CHROMATIC_APP_CODE secret is no
longer used. Baselines are seeded automatically by the new
visual-baselines workflow on every merge to master.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…re branch

DO NOT MERGE TO MASTER. Delete this file after seeding is no longer needed.
@balzss balzss force-pushed the feat/self-hosted-visual-regression branch from c47f0a5 to 128326b Compare April 21, 2026 14:59
github-actions Bot pushed a commit that referenced this pull request Apr 21, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 21, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant