qain docs

Usage documentation for qain — semantic style-regression testing for Chromium. For what the output looks like before reading anything, see the live demo, regenerated by CI from examples/.

Guides

  • Getting started — install, capture your first snapshot, read your first diff.
  • CLI reference — every command and flag: snap, diff, view, shot.
  • Recipes — snapshot a dev server, scope to one element, point at a Storybook story, extract computed styles as data, gate CI and coding agents on the exit code.
  • GitHub Action — a sticky PR comment with the semantic diff and before/after/diff screenshots whenever a committed baseline changes.
  • Snapshot & diff format — what is inside the JSON the CLI reads and writes.
  • Using @qain/core as a library — capture and diff from your own code, with Playwright, Puppeteer, or a raw CDP socket.

Test-runner integrations

Each integration is documented in its package README:

  • @qain/playwrighttoMatchStyleSnapshot for Playwright tests.
  • @qain/vitest — the same matcher for Vitest browser mode; component VRT without booting Storybook.
  • @qain/storybookmatchStyleSnapshot for the Storybook test runner; every story becomes a style test.

Design

The main README covers the ideas: why the diff stays quiet, how rule attribution works, what replay does, and what qain deliberately does not do.