Files
sisi/verifiers/regression/ui-structure-snapshot.md
T
swaitsandClaude Fable 5.2 2fc1fe9c2d
ci / tests (macos-latest, python 3.11) (push) Canceled after 0s
ci / tests (macos-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.9) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.11) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.13) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.9) (push) Canceled after 0s
sisi 0.1.0: a shared rulebook and verification tool for AI coding agents
Contracts with a ladder of checks, an end-of-turn gate, retrospectives and
shared lessons, time-to-delivery measurement, a library of 140 verification
techniques and 20 recipes, personal data kept outside the clone, and
releases with rollback. Standard library only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 22:29:02 -07:00

2.7 KiB

id, title, answers, rung, section, languages, kinds, cost, detect, ran_here, verified
id title answers rung section languages kinds cost detect ran_here verified
ui-structure-snapshot Accessibility-tree and DOM-structure snapshots Is the page's structure (headings, buttons, labels, order) the same as before, regardless of pixels? 4 regression javascript, typescript, python ui low npx playwright --version yes ran

Use when

  • You want a UI check that does not break on fonts, antialiasing or colour shifts.
  • You are refactoring markup or components and the screen must keep the same elements and labels.
  • You want a companion to visual-regression-web: structure first, pixels second.

Do not use when

  • The claim is about appearance (spacing, colour, alignment). Structure snapshots cannot see it.
  • You have not decided what the structure should be; you would just record whatever exists.

Set up

npm i -D @playwright/test && npx playwright install chromium

Python has the same API: expect(locator).to_match_aria_snapshot("...") in pytest-playwright.

Minimal example

import { test, expect } from '@playwright/test';
test('main structure', async ({ page }) => {
  await page.goto('/');
  await expect(page.locator('main')).toMatchAriaSnapshot(`
    - heading "Shop" [level=1]
    - paragraph
    - button "Buy"
    - navigation "Main":
      - link "Home"
  `);
});

Take the snapshot BEFORE editing. Scope the locator to the region you are touching, and keep a second snapshot of the rest of the page, so only the intended region may change. Use npx playwright test --update-snapshots to write the expectations into the test file or .aria.yml files when you mean to change them (flag --update-source-method picks patch or overwrite).

Run

npx playwright test

Passing looks like: N passed, exit 0. Failure shows a diff such as - button "Buy" against + button "Buy now" and exit 1.

As a contract check

{"id": "ui-structure", "claim": "The accessibility tree of the main regions is unchanged", "kind": "ui", "rung": 4,
 "cmd": "npx playwright test tests/aria.spec.ts", "expect": {"exit": 0}, "tier": "deep", "timeout_s": 300}

What a pass does not prove

  • Nothing about appearance. A button can keep its label and become invisible.
  • Matching is partial by default: extra elements not listed may exist. Write the whole subtree you care about, or check the Playwright aria-snapshot docs for the /children setting (not run here).
  • Accessible names come from text, so copy changes fail it; that is often the signal you want.
  • Check the check: edit a label and see the diff appear (done here with Playwright 1.57).
  • Other tools (Testing Library getByRole, Cypress snapshots) give the same kind of check; the claim is the same, the rung is 4.