/biloba-vitest:visual-assertionsfrom biloba-vitest
Creates and maintains Biloba screenshot assertions in TypeScript/Vitest. Covers page/locator captures, baselines, update mode, masks, pixel/channel tolerances, animation freezing, color schemes, diff artifacts, and visual diagnosis.
Ships in biloba-vitest. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Call expectScreenshot() on a session or locator:
await session.getByTestId("chart").expectScreenshot("revenue-chart", {
mask: [session.getByTestId("last-updated")],
colorSchemes: ["light", "dark"],
pixelTolerance: 0.001,
});
Nothing needs asserting on the result: it resolves only when the screenshot matched or, in update mode, when the baseline was written, and its match is true either way. updated says whether the call wrote a baseline; each schemes[i].status is matched, created, updated, or unchanged.
The first run must fail when the baseline is missing. Review the actual image, enable update mode deliberately (BILOBA_UPDATE_SCREENSHOTS=1, or updateScreenshots: true on connect), write the baseline, then commit it. Never leave update mode enabled in CI: it turns comparisons into writes and makes the suite pass without checking regressions.
channelTolerance for small rasterization deltas spread across many pixels.pixelTolerance only when evidence supports allowing a bounded changed area.expectScreenshot(), animations, transitions, and the caret freeze automatically. CSS animations on a scroll or view timeline keep running, since they depend only on the scroll position. Opt into animated capture only when motion is the subject. A plain captureScreenshot() is not frozen unless you pass frozen: true.prefers-color-scheme; a stored/manual override can make both baselines identical.A mismatch throws BilobaError. Read its visual diagnosis and artifactPaths before opening the PNGs: the pixel count and amplitude verdict distinguish rendering noise from a real content or color change. The baseline is committed evidence; .actual.png and .diff.png are disposable failure artifacts.
Failure handling → biloba-vitest:debug-failures. Flake prevention → biloba-vitest:flaky-tests. Docs: https://onsi.github.io/biloba/vitest.html#screenshots-and-visual-assertions.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
7 skills in this plugin
/debug-failuresDiagnose Biloba failures in TypeScript/Vitest — BilobaError codes and fields, polling trajectories, DOM outlines, screenshots and visual artifacts, context-wide session.captureDiagnostics(), console/warning streams, debug logs, Vitest hooks, and renderer/browser/daemon crash distinctions. Use when a Biloba Vitest test fails, hangs, flakes, or needs CI/agent artifact configuration./flake-huntRun a flake hunt on a Biloba Vitest suite — run the whole browser suite many times (60 by default), every run to completion with its own JSON report, then read each test's failure rate, the seeds, and the failure evidence out of those reports instead of re-running. Covers the hunt script (vitest run with shuffle and a recorded seed, maxWorkers at the measured knee, no retry or bail, a per-run BILOBA_SCREENSHOTS_DIR, and the seed, wall clock, and exit status the JSON reporter doesn't record), the runs the JSON reports as clean when they aren't (unhandled errors, failed beforeAll hooks, killed runs), logging BilobaError's code and trajectory, what keeps a hunt a valid measurement (one hunt at a time on an idle machine, nothing editing the tree, focused hunts for iterating only, stale visual baselines), how many clean runs it takes to call a flake dead, reading the results (one systemic race behind many names, stalled tabs, a long tail that clusters by run), and the performance record a hunt produces (test timing, the longest file, per-test cost, drift between hunts). Use before declaring a flake fixed, after changing shared test helpers or fixtures, at the end of a batch of work, or to measure a suite's performance./flaky-testsDiagnose and prevent flaky Biloba TypeScript/Vitest tests — redundant client-side retry loops, immediate mode, single-shot evaluate reads, optimistic UI, async layout, first-match-wins network handlers, held responses, vacuous assertions, visual update/tolerance hazards, lifecycle leakage, never waiting out a clock for a fact you can observe (durations clustered at one timer's period give it away), and timer-driven UI (debounces, countdowns, expiries) taken off real time with the page clock, including why polling never advances a paused clock. Use when a Biloba Vitest test is intermittent, order-dependent, load-sensitive, or only fails in CI/parallel workers./overviewExplain Biloba's TypeScript/Vitest mental model — one shared Chrome, one bilobad process per Vitest worker, isolated reusable root sessions, server-side polling, fast versus realistic input, and structured diagnostics. Use first when adopting biloba or deciding how to structure a Vitest browser suite. Route to the other biloba-vitest:* skills./setupWire Biloba's TypeScript client into Vitest — install biloba and its platform package, install chrome-headless-shell, start one shared Chrome in global setup, provide its connection to workers, create one daemon and reusable root Session per test file, prepare between tests, close cleanly, and choose launch modes/options. Use when installing biloba or changing suite-level browser/daemon lifecycle./write-testsAuthor Biloba browser tests in TypeScript/Vitest — sessions, tabs, frames, CSS/semantic/XPath locators, polling actions and assertions, realistic input, cookies/storage, dialogs/downloads/network, time-dependent UI with the page clock (installClock + pauseAt/runFor/fastForward), screenshots, and structured failures. Use when writing or reviewing tests against biloba. For wiring the daemon and shared Chrome, use biloba-vitest:setup.npx claudepluginhub onsi/biloba --plugin biloba-vitestOther plugins' skills for the same job