Skip to content

ci: keep visual-regression baselines refreshing and surface Cypress failures - #2669

Open
balzss wants to merge 5 commits into
masterfrom
fix/visual-regression-baseline-pipeline
Open

ci: keep visual-regression baselines refreshing and surface Cypress failures#2669
balzss wants to merge 5 commits into
masterfrom
fix/visual-regression-baseline-pipeline

Conversation

@balzss

@balzss balzss commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Repairs the self-hosted visual-regression pipeline and makes the report far more useful for triage. Two related concerns, in separate commits:

1. Baseline pipeline fix (ci)

  • visual-baselines.yml: decouple baseline capture from the a11y/console gate — Cypress runs with continue-on-error, screenshots always flatten + push (if: always()), and a trailing step fails the job for visibility if Cypress failed. Fixes the silent baseline freeze: the visual-baselines branch had stopped updating on every merge since the dark/light theme suite landed (Cypress aborted the job before the push step).
  • visual-regression.yml: the sticky PR comment now leads with a "Cypress assertions (a11y + console errors)" ✅/❌ line, so failures are visible even when the visual diff is clean.
  • Removed the leftover TEMP inject diff-demo fixture step and regression-test/cypress/diff-demo/.

2. A11y in the visual-diff report (feat)

  • The suite already ran axe per page/theme but discarded the results. A new recordA11y Cypress task now persists them to cypress/a11y.json, keyed by <slug>-<theme> (mirrors meta.json).
  • ui-scripts visual-diff gains a --a11y flag that renders a per-page ⚠ N a11y badge, an ⚠ A11y filter chip, a header count, and a collapsible violation list (rule linked to its axe helpUrl, impact, offending selector, contrast summary). a11yPages/a11yViolations added to summary.json. Additive — without --a11y the report is unchanged.
  • Wired --a11y cypress/a11y.json into the diff step.

Test Plan

  • Unit: visual-diff suite (34 tests, incl. new esc/a11yFor).
  • Verified end-to-end against a real suite run: the spec emits a11y.json (15 flagged page/theme entries) and the report renders badges/filter/list with the real axe contrast data.
  • On merge: confirm Update visual baselines publishes to visual-baselines even while the suite is red, and ends red with the ::error:: annotation.
  • Note: 13 dark/light-theme color-contrast violations remain (tracked in INSTUI-5137) — the suite stays red-but-visible until those are fixed by design/component work.

Fixes INSTUI-5137

🤖 Generated with Claude Code

…ailures

The baseline job ran Cypress without continue-on-error, so failing a11y/console
assertions aborted the job before the "Push baselines" step — silently freezing
the visual-baselines branch on every merge since the dark/light theme suite
landed. Decouple baseline capture from the assertion gate: Cypress runs with
continue-on-error, the screenshots always flatten and push (if: always()), and a
trailing step fails the job for visibility if Cypress failed. Baselines now
refresh on every merge regardless of the a11y/console outcome.

Also add a "Cypress assertions" pass/fail line to the sticky PR comment so
failures are visible even when the visual diff is clean, and remove the leftover
TEMP diff-demo fixture step and regression-test/cypress/diff-demo/.

Refs: INSTUI-5137

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@balzss balzss self-assigned this Jul 30, 2026
@balzss
balzss requested a review from joyenjoyer July 30, 2026 10:42
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

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

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

github-actions Bot pushed a commit that referenced this pull request Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Visual regression report

Cypress suite:Failing — see the run logs.

Visual diff: ⚠️ Changes detected.

Status Count
Unchanged 0
Changed 0
New 96
Removed 32

Accessibility (axe): ⚠️ 15 violations on 7 screenshots.

Impact Issue Rule Elements Screenshots
serious Text contrast is too low 15 7

📊 View full report — click a screenshot's ⚠ badge to see each violation boxed on the image, with the offending element named and contrast failures shown as color swatches.

Diff images (32)

alert.png — baseline no longer produced

avatar.png — baseline no longer produced

badge.png — baseline no longer produced

billboard.png — baseline no longer produced

breadcrumb.png — baseline no longer produced

button-and-derivatives.png — baseline no longer produced

byline.png — baseline no longer produced

calendar.png — baseline no longer produced

checkbox.png — baseline no longer produced

checkboxgroup.png — baseline no longer produced

colorpicker.png — baseline no longer produced

contextview.png — baseline no longer produced

custom-and-lucide-icons.png — baseline no longer produced

dateinput-dateinput2.png — baseline no longer produced

datetimeinput.png — baseline no longer produced

drilldown.png — baseline no longer produced

filedrop.png — baseline no longer produced

form-errors.png — baseline no longer produced

heading.png — baseline no longer produced

img.png — baseline no longer produced

link.png — baseline no longer produced

menu.png — baseline no longer produced

metric-pill-tag-timeselect-text.png — baseline no longer produced

options.png — baseline no longer produced

pagination.png — baseline no longer produced

progressbar.png — baseline no longer produced

select-simpleselect.png — baseline no longer produced

table.png — baseline no longer produced

tabs.png — baseline no longer produced

tooltip.png — baseline no longer produced

treebrowser.png — baseline no longer produced

view.png — baseline no longer produced

Baselines come from the visual-baselines branch. They refresh on every merge to master. The Cypress suite line covers the a11y and console-error assertions — a ❌ there means the suite found real issues even if the visual diff is clean.

The regression suite already ran axe per page and theme, but the violations were
only printed to the Cypress log and discarded. Persist them and render them in
the report so designers can triage accessibility issues alongside the pixels.

- regression-test: a new recordA11y Cypress task writes cypress/a11y.json keyed
  by "<slug>-<theme>" (mirroring meta.json); the spec records each violation's
  rule id, impact, help text, helpUrl, and offending node selector/summary.
- ui-scripts visual-diff: a new --a11y flag reads that file and adds a per-row
  "a11y" badge, an "A11y" filter chip, a header count, and a collapsible list of
  violations (rule linked to its axe helpUrl, impact, selector, contrast
  summary) per screenshot. a11yPages/a11yViolations are added to summary.json.
- visual-regression.yml passes --a11y cypress/a11y.json to the diff step.

Additive: without --a11y the report is unchanged. Unit-tested esc() and
a11yFor(), and verified end to end against a real suite run (15 flagged pages).

Refs: INSTUI-5137

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
github-actions Bot pushed a commit that referenced this pull request Jul 30, 2026
… HTML view

Builds on the a11y report data: make the violations visible without hunting.

- Expand each row's violation list by default (Tier 1 was collapsed).
- In the lightbox HTML view, outline the offending nodes inside the live iframe
  using the recorded axe selectors, and add a legend that lists each violation
  and scrolls/flashes its element on click.
- Embed the a11y data as a JSON block for the client; same-origin iframe access
  means no pixel math. Runtime-generated selectors (Emotion hashes, generated
  ids) resolve because the iframe app and the axe run share one build; if they
  ever diverge the outline no-ops but the legend and text details still show.

Refs: INSTUI-5137

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The a11y section of the visual-diff report was a nested list of axe rule ids, CSS
selectors, and raw failureSummary prose, repeated per theme. Nothing was anchored to
the image, so the artifact designers actually read - the screenshot - carried no
accessibility information at all.

Capture: while the page is still rendered, record each violating element's bounding
box, a human-readable name, and the contrast numbers axe already computed. a11y.json
gains a per-screenshot page size so boxes can be positioned as percentages and hold at
any rendered scale.

Report: numbered boxes over each offending element on the "Actual" image, colored and
ordered by impact; a card per finding leading with plain language, the element's name,
a suggested fix, and - for contrast - swatches with the measured and required ratios;
a run-level overview grouped by rule that collapses the three themes into one line;
impact and rule filters that narrow boxes and cards together; and a lightbox A11y mode
pairing the full-size screenshot with its findings. Raw axe output moves behind a
Technical details disclosure.

The PR comment now names the failing rules in a table instead of pointing at the run
logs.

Reports generated from a11y.json captured before this change still render: the boxes
are omitted, and contrast is recovered by parsing axe's prose.
github-actions Bot pushed a commit that referenced this pull request Jul 31, 2026
github-actions Bot pushed a commit that referenced this pull request Jul 31, 2026
Feedback on the first pass: the report showed the same findings three times over -
boxes on every "Actual" thumbnail, a card list under each row, and outlines in the
HTML view - which buried the image comparison the report exists for.

Findings now live in one place, the lightbox's A11y view, reached by clicking a row's
badge. The row is back to a three-up comparison plus a "N a11y" pill colored by worst
impact.

Removed: the a11y overlay and legend from the HTML view (it iframes the live page
again, nothing more), the impact filter chips, the "Show markers on screenshots"
toggle, and the embedded a11y JSON payload that only the HTML view's legend needed.

Boxes and cards are rendered into an inert <template> per row and cloned when the A11y
view opens, keeping one renderer. Markers carry their own rule so the overview's rule
filter no longer needs a rendered card to consult.

Also fixes the contrast violations the report surfaced in the test pages themselves -
403 violating elements down to 15. Two causes, both in the pages rather than the
library: custom-icons styled its labels with Tailwind literals (text-gray-500 /
text-gray-700) that ignore the theme and failed on light and dark alike, and eleven
pages had bare text nodes inheriting the browser default black, unreadable on the dark
theme's near-black surface. Both now use Text/Heading, which take their color from the
active theme.

The 15 remaining are deliberate: inverse/on-color text demos rendered on the page
background, text on View's colored alert/success/danger/warning surfaces, a
color="inherit" demo, a raw input in a FormField demo, and FileDrop's own renderLabel -
that last one is a library finding, not a page one.

These twelve pages will show as Changed on the next run; baselines refresh on merge.
@balzss
balzss force-pushed the fix/visual-regression-baseline-pipeline branch from c85621b to dc057df Compare July 31, 2026 13:37
github-actions Bot pushed a commit that referenced this pull request Jul 31, 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