Skip to content

VisualCI tests itself: screenshots, component and JSON snapshots from a visual CI job (sc-8336) - #1

Merged
ndbroadbent merged 3 commits into
mainfrom
sc-8336-dogfood
Dec 1, 2026
Merged

ndbroadbent merged 3 commits into
mainfrom
sc-8336-dogfood

Conversation

@ndbroadbent

Copy link
Copy Markdown
Member

VisualCI's own CI sends one build to the docspring/visualci project, from a new visual job after test:

  • Screenshots (106): the landing page and 17 app pages at 1440 and 390 px, light and dark. The 19 docs pages are taken at 1440 light and 390 dark. They're taken against a server filled by the new screenshots:seed task, platform chrome-linux.
  • Component snapshots (21): Vitest + Testing Library on the presentational components (pills, build result, stat counts, the text/JSON diff, the CI strip, the docs page). __snapshots__/ is gitignored; CI runs vitest run -u and sends them with visualci upload --from vitest.
  • JSON snapshots (38): with VISUALCI_JSON_SNAPSHOTS set, the request tests write every MCP tool call (arguments and result), the tools list for each kind of token, and four REST responses. Values that change every run (UUIDs, test org slugs, tokens, fb_ ids, timestamps, presigned signatures) become numbered placeholders before writing. The test job passes them on as an artifact.
  • Site files: llms.txt, docs/quick-start.md, and visualci.schema.json once the server serves it.

Determinism

  • The seed runs builds through the real pipeline (register, finalize, process). PDF renders are stored as done, with pages drawn in the task. Then PIDs, token prefixes and timestamps are fixed by SQL.
  • The browser's Date is frozen at the seed's NOW (not Playwright's fake timers, which stall requestAnimationFrame). Animations and transitions are off. Each shot waits for network idle, fonts, every image (lazy ones forced eager) and the loading spinners.
  • Chrome runs with software raster on one thread, sRGB and no LCD text. With the GPU, small SVG icons differed by 6 to 24 px between runs.
  • scripts/screenshots/stable.mjs on docspring-dev: 106 of 106 identical across 5 runs.

Other changes

  • month_start() reads VISUALCI_NOW, so the seeded month's credit usage shows on the billing pages. It's never set in production.

Checked

  • cargo fmt, clippy -D warnings and cargo test --workspace pass on docspring-dev; vitest run passes; scripts/ci/visual.sh capture runs end to end there in about 90 s, also after rebasing on the sc-8188 host split.
  • Not checked yet: the upload into production. That's what this PR's CI run does.

Story: sc-8336

… and JSON snapshots, sent from a visual CI job

- screenshots:seed task: a fixed dataset (two orgs on Free and Team, builds with image, PDF, JSON, HTML and
  text changes, an approved and a failed build) run through the real pipeline, with fixed ids and timestamps
- scripts/screenshots: Playwright capture of the landing page, docs and app at 1440 and 390, light and dark;
  stable.mjs checks five runs give identical bytes (106 of 106 on docspring-dev)
- Vitest + Testing Library snapshots of the presentational components, gitignored, uploaded with --from vitest
- Request tests write MCP and REST answers as JSON snapshots when VISUALCI_JSON_SNAPSHOTS is set, with run-to-run
  noise replaced by numbered placeholders
- month_start() reads VISUALCI_NOW, for the seeded month's usage

Story: sc-8336
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