/biloba-go:debug-failuresfrom biloba-go
Explains Biloba failure artifacts (DOM outlines, screenshots, poll trajectories, visual diffs) and env vars for debugging Go/Ginkgo browser specs in CI or agents.
Ships in biloba-go. 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.
Reading artifacts after a spec failed. To prevent flakes → flaky-specs. Docs: https://onsi.github.io/biloba/#failure-artifacts-humans-ci-and-agents. Sibling skills are named here without a prefix; invoke one with the same plugin prefix you loaded this skill under.
Biloba detects the environment in ConnectToChrome. "Automation" = CI is set or an AI coding agent is detected (CLAUDECODE/AI_AGENT/Cursor/Gemini CLI/Codex/…).
| Interactive human | CI or AI agent | |
|---|---|---|
| Failure screenshot | inline in the terminal | written to ./biloba-screenshots |
| DOM outline on failure | no | yes |
| Inline image blob | yes (if the terminal supports it) | no |
So an agent or CI run needs nothing: ginkgo -r -p, then read the outline and the screenshot files. BILOBA_SCREENSHOTS_DIR=./artifacts points the directory elsewhere.
Ginkgo prints a failed spec's Timeline first and its full failure message last. Biloba attaches its artifacts to the timeline after the spec fails, so the outline (often 100+ lines), the poll trajectory and the screenshot paths all come before the message:
• [FAILED] [3.1 seconds]
Projects editing a project [It] …
Timeline >>
[FAILED] in [It] - projects_test.go:42 @ … ← a marker, not the message
[DOM Outline for: '…'] … ← Biloba's artifacts
<< Timeline
[FAILED] Timed out after 1.000s. ← the message
Expected …
In [It] at: projects_test.go:42
Read each block from the bottom. To pull out only the messages from a long run:
ginkgo --no-color -r -p 2>&1 | grep -A12 '^ \[FAILED\] [^i]' # skips the "[FAILED] in [It]" markers
ginkgo -r -p --json-report=report.json; jq -r '.[].SpecReports[] | select(.State=="failed") | "\(.LeafNodeText)\n\(.Failure.Message)\n"' report.json
Then go to the artifacts for that spec, in the order below.
console.error/console.assert and any uncaught exception or unhandled rejection (Uncaught …) before the failure, replayed under "Console errors logged before this failure" at the top of the failure block. On a JS crash (a React error boundary) this is the root cause. Everything here (and in the streamed timeline, AllPageErrors, AllConsoleMessages, AllRequests) comes from this spec: what the previous spec's page raised as Prepare() navigated it away is dropped. Locations (app.js:12:5) are one-based, so they open at the right line in an editor. Chrome's own warnings and errors ([network] Failed to load resource: … (url), [intervention] …) appear in the streamed timeline but not in this replay; read the timeline for a failed load, or b.AllConsoleMessages() / b.AllRequests() for the full record.⚠ diagnostic notes — they name the cause outright. "Page clock paused" (or the same line at the end of a poll's timeout: This tab's page clock is paused at <t>; …) means the page's timers were stopped by the spec's own b.InstallClock/PauseAt — advance the clock before asserting (flaky-specs §9).b.HaveScreenshot: pixel counts plus the shape of the change, in words, before you open any image.Read the printed PNG path.... [truncated]? Raise the cap with BILOBA_OUTLINE_MAX — a byte count (=131072), or 0/off for the whole DOM.When an Eventually over a read that observes and compares a value (b.HaveInnerText/b.HaveCount/any value matcher, a geometry matcher, b.EvaluateTo, b.GetJSValue) times out, Biloba attaches the (elapsed, value) series of that assertion. Gomega's Timed out … Expected <120> shows only the final value; the shape is the diagnosis:
| Shape | Means | Do |
|---|---|---|
flat (one row, held ×N) | the product computed the value once and never reconciled | fix the product (flaky-specs §4) — a wider timeout won't help |
| monotone staircase | latency; it nearly made it | widen the timeout |
| dip-then-rebound | a late reflow shoved it back | settle layout before asserting |
No entry is a normal outcome, not a bug. The series is claimed by the matcher Gomega asked for a failure message, so an entry always describes the read you failed on. Reads that passed, b.Run setup lines, and failures with no value read underneath (a b.Click whose selector never matched, a getter whose value was never there — that one gets the AllowMissing enrichment instead) simply produce nothing. Don't read a missing trajectory as a signal; go to the outline and the screenshot. To get a trajectory for an arbitrary expression, poll it with b.EvaluateTo/b.GetJSValue rather than wrapping b.Run in your own Eventually — Biloba only records reads it owns.
On by default; BilobaConfigPollTrajectory(false) disables it (and the detached-node signal). Don't disable it for speed. Recording takes a lock and renders the value per poll sample, so it isn't free — but on a 1,558-spec suite that leans hard on the instrumented matchers, turning it off saved under a second across the whole run, inside that suite's own run-to-run spread.
b.HaveScreenshot) → visual-assertionsTwo extra PNGs land in the screenshots dir — <name>.actual.png (what Biloba saw) and <name>.diff.png (the actual, washed out, differing pixels in magenta) — and the failure message says what moved:
screenshot "home-desktop" differs from baseline
38,160 of 1,017,600 pixels differ (3.75%), max channel delta 221
changed region: one box, (0,14)-(1272,44) [100% of the width, 4% of the height, at its top edge]
unchanged: everything below y=44
baseline: /Users/you/app/biloba-baselines/home-desktop.png
actual: /Users/you/app/biloba-screenshots/home-desktop.actual.png
diff: /Users/you/app/biloba-screenshots/home-desktop.diff.png
The shape line (one box, changed regions: N boxes, scattered, uniform shift, a size change) and what to do about each → visual-assertions. When every differing pixel is off by only a few levels Biloba says a rasterisation or compositing difference, not a content change — nothing moved, so look for a shadow or gradient compositing into the capture. A missing baseline is a different failure: it says to re-run with BILOBA_UPDATE_SCREENSHOTS=1; never script your way past it. Read the .diff.png when the words aren't enough (inline images are off under an agent, so you get the path).
"never settled" is printed during an update run, not on a failure. The run stays green, but the baseline it just wrote was captured from a page still changing and the next normal run will fail against it. Mask the moving region (or stop it moving) and re-run the update; re-running alone changes nothing. → visual-assertions
"Failed to restore the tab's prefers-color-scheme" — a dropped b.InColorSchemes teardown. The override is target-level and survives navigation, so b.Prepare() clears the leak before the next spec; the spec that printed the warning, though, finished rendering in the emulated scheme. Read any odd-looking screenshot from that spec with that in mind.
⚠ diagnostic notes"Selector matched, then stopped matching" — the detached node. The selector resolved, then its node was replaced (list re-key, portal migration) or its identifying attribute swapped in place. Silent when the selector genuinely never matched.
⚠ Selector "#row-4" matched 6× during this poll (+0.00s to +0.41s) then stopped matching
— the node was likely replaced, or its identifying attribute changed in place.
"Click dispatched onto a covered element" — fast Click stays occlusion-blind by design and still succeeds through an overlay, but records a hit-test so the downstream failure points somewhere. Diagnostic only; never changes whether a spec passes.
⚠ Click on "#submit" was dispatched while <div#overlay.modal-scrim> was the topmost
element at its centre — the click may have been swallowed.
Consider Eventually("#submit").Should(b.BeClickable()) or b.Realistic().Click("#submit").
"Network handler never ran (shadowed by an earlier handler)" — handlers are first-match-wins, so one registered for a URL an earlier handler claims is dead code. Deadly across an Ordered container, where Prepare() doesn't run between Its. Both call sites are named.
⚠ A ModifyResponse handler registered at network_test.go:231 never ran — an earlier ModifyResponse
handler (registered at network_test.go:223) claimed 1 matching response(s) first.
Reported only when a handler never fired and was shadowed at least once. Limit: it's a failure artifact, so it cannot surface shadowing's other presentation — a leftover stateful handler claiming the response, passing it through untouched, spec green. Only your own Eventually(hold.Count).Should(Equal(1)) catches that (flaky-specs §6).
"Network handler could not read a response body" — Chrome refuses to hand over some response bodies (a redirect's, notably), so a ModifyResponse/HoldResponse handler that matched never gets to run Using, apply a static override, or hold the response; Biloba continues it unmodified. Any other read failure (a timeout, a lost reply, a body over the limit) fails the request instead, since the body may already be gone. Either way the handler still counts the dispatch (Count() ticks at selection, before the read), and the note names the handler, its registration site, the URL, and which of the two Biloba did.
⚠ A ModifyResponse handler registered at checkout_test.go:42 could not read the response body for http://localhost:8080/login (status 302):
Can only get response body on requests captured after headers received. (-32000)
Biloba continued the response unmodified.
The same note reports a handler whose resolved response Chrome refused (an out-of-range status, say) as could not deliver its response; Biloba fails that request.
Every command Biloba sends Chrome runs under a deadline, so an unresponsive browser produces a failing spec instead of a hung suite. Each of these failures names its cause on the first line:
| First line | Means | Do |
|---|---|---|
deadline_exceeded: Chrome did not <command> within 30s | Chrome accepted the command and never answered | Chrome is wedged or the box is badly overloaded — look for a long synchronous script in the page, or too many parallel processes for the machine |
page_crashed: this tab's renderer crashed | Chrome reported the crash (promptly on macOS, several seconds later on Linux). From then on every command on the tab but a navigation fails at once with this, and a command waiting on the renderer when the report arrives is interrupted with it | usually the page itself (OOM, a bad WASM/canvas path). Recoverable: navigate once you've seen page_crashed (a navigation sent before the announcement can leave the tab dead on Linux), or move to b.NewTab() |
tab_closed: this tab was closed | Chrome detached the tab: the page closed itself (window.close()), its opener closed it, or Close() did. Every command on it fails at once with this, a navigation included, and one already waiting when it closes is interrupted | not recoverable: a spec that closes a popup on purpose should stop using that tab (its Close() still succeeds); otherwise find what closed it, and run the rest of the spec on another tab |
frame_detached: the document this frame handle was found in is gone | the frame handle's iframe was removed or navigated, or its tab navigated or Prepare()d, since b.Frame found it | a handle belongs to one document: call b.Frame(...) again after whatever replaces the frame, and don't carry a handle across that change |
browser_gone: the connection to Chrome is closed | the browser process exited — crashed, OOM-killed, or reaped | not recoverable; the rest of the suite will fail too. Check the machine's memory and whether anything is killing Chrome |
The deadline is generous on purpose (a healthy command answers in milliseconds), so hitting it is a real signal, not a tight-timeout artifact. WithTimeout doesn't move it: that knob bounds how long Biloba keeps retrying, which is a different question from whether Chrome is alive.
A suite that ends on Ginkgo's --timeout with no failing spec is a command blocked inside a poll's callback, where Gomega can't interrupt it. Biloba's own commands can't do that, so look for a chromedp call of your own on b.Context without a deadline.
b.AllowMissing("disabled") to paste (flaky-specs §5).BePrecededBy/BeFollowedBy reports the order actually observed (Actually: #o-first comes BEFORE #o-second.) — enough to spot an inverted assertion.fmt.Println(b.Outline()) // indented DOM
fmt.Println(b.A11yOutline()) // accessibility tree: role + accessible name per node
AddReportEntry("DOM before click", b.Outline(), ReportEntryVisibilityFailureOrVerbose)
b.Run("document.querySelectorAll('.card').length") // quick count probe
b.A11yOutline() is not auto-attached — call it explicitly. It's often more useful than raw HTML for reasoning about what a page means.
Attach app/store state to every failure. For a state-heavy or optimistic-UI app the store beats the DOM (which may be the pre-confirmation copy):
ReportAfterEach(func(report SpecReport) {
if !report.Failed() { return }
AddReportEntry("app state", b.Run(`JSON.stringify(window.__APP_STATE__ ?? null)`))
})
Keep the ?? null so a crashed page doesn't turn the snapshot itself into a failure. (That's a snapshot. To wait on app state as part of a spec, use b.GetJSValue — flaky-specs §3.)
Page console.* streams to the GinkgoWriter, each argument rendered space-separated, and so do uncaught page errors (in red, with their stack). b.AllConsoleMessages()/b.AllPageErrors() hand you the same as data. Objects come from CDP's shallow preview, so nested/large objects log lossily. Build the string yourself when you need the whole value: console.log('state ' + JSON.stringify(obj)).
HaveInnerText/GetInnerText timing out on text that's plainly in the outline. innerText is computed from layout and can return a stale/partial value before a paint settles. Switch to HaveTextContent/GetTextContent (reads textContent off the tree) or to a plain existence assertion.requestAnimationFrame never firing. On a fully static page, chrome-headless-shell can leave rAF unscheduled after the first scroll (nothing animating ⇒ no frames), wedging app code driven off an rAF loop. Shape: a hang/timeout only in the default headless lane. Confirm with a counter read through a coalescing b.Run — b.Run("window.__rafTicks ?? 0"), not b.GetJSValue, which would sit waiting for a counter that never appears. Fix: drive the work off a real event, or run that spec under HighFidelityHeadless()/BILOBA_INTERACTIVE=true.b.ScrollIntoView returns once the page has scrolled, but the page's scroll handlers run in its next frame, and under load Chrome can hold a tab to about one frame a second. Wait on what the page does in response, with a timeout that allows for a second or more, not on a fixed delay after the scroll.(hover: …) and (pointer: …) from the machine's input devices, and a CI runner with no mouse can report (hover: none). SetMedia can't change them. Pin a mouse at launch with biloba.ChromeFlags(chromedp.Flag("blink-settings", "primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4")), and test the no-hover layout with b.TouchScreen().| Var | Effect |
|---|---|
BILOBA_SCREENSHOTS_DIR=./artifacts | where failure screenshots — and the visual .actual.png/.diff.png artifacts — are written |
BILOBA_SCREENSHOT_BASELINES_DIR=./baselines | where b.HaveScreenshot's committed baselines live (default ./biloba-baselines) |
BILOBA_UPDATE_SCREENSHOTS=1 | capture and (re)write every visual baseline the run touches instead of comparing; prints what changed. Accepts 1/t/true/y/yes/on (off: 0/f/false/n/no/off), case-insensitive; any other value warns and is treated as off. Suite-wide — scope it with --focus. Never set it in CI: every visual assertion then passes unconditionally |
BILOBA_OUTLINE_MAX=131072 | raise the outline byte cap; 0/off = no truncation |
BILOBA_INLINE_SCREENSHOTS=iterm|kitty|sixel|none | force an inline-image protocol, or none to disable the blob (the file path is still printed — use none in CI and in Claude Code, where base64 is noise) |
BILOBA_PROBE_TERMINAL=true | actively query the TTY for Sixel support when env detection finds nothing |
BILOBA_INTERACTIVE=true | headful high-fidelity run that pauses on failure until ^C |
Inline images are auto-detected (Kitty, iTerm2, Sixel/VS Code) and only emitted when the terminal supports them.
ConnectToChrome)Each boolean takes an optional bool (no arg = true). Explicit settings win, per knob — automation only fills knobs you left untouched.
BilobaConfigScreenshotsToDir(dir) — write each tab's failure screenshot there (prints the absolute path).BilobaConfigFailureOutlines(...bool) / BilobaConfigInlineScreenshots(...bool) — force on/off.BilobaConfigFailureScreenshots(...bool) (default on) / BilobaConfigPollTrajectory(...bool) (default on) / BilobaConfigProgressReportScreenshots(...bool) (default on).BilobaConfigFailureScreenshotsSize(w,h) / BilobaConfigProgressReportScreenshotSize(w,h). The progress-report size resizes each tab under the running spec, which the page can observe, and the report says so. Leave it unset unless you need it.BilobaConfigDebugLogging(...bool) — stream all CDP traffic to the GinkgoWriter (verbose).BilobaConfigScreenshotBaselinesDir(dir) — where b.HaveScreenshot reads/writes committed baselines (default ./biloba-baselines; commit that dir, gitignore the screenshots dir).BilobaConfigScreenshotTolerance(fraction) / BilobaConfigScreenshotChannelTolerance(delta) — suite-wide visual-comparison defaults, both 0 (exact) by default; b.Tolerance(...)/b.ChannelTolerance(...) override per assertion. → visual-assertions// CI that only redirects the directory still keeps the automation default of outlines-on:
b = biloba.ConnectToChrome(GinkgoT(), biloba.BilobaConfigScreenshotsToDir("./artifacts"))
BILOBA_INTERACTIVE=true ginkgo --focus="..."
Headful, high fidelity, prints the failure and waits for ^C. Use a small handful of focused specs, in serial. (SpinUpChrome(GinkgoT(), biloba.ChromeFlags(chromedp.Flag("headless", false))) does the same in code.)
Biloba screenshots Ginkgo progress reports — on a spec timeout, a PollProgressAfter spec, or on demand: ^T (SIGINFO) on macOS, SIGUSR2 on Linux. Each screenshot shows the tab's viewport, not the whole page, so the report can't disturb the spec it is reporting on.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub onsi/biloba --plugin biloba-go12 skills in this plugin
/apiOne-line reference for every Biloba Go method and matcher, grouped by area — selectors/locators, lifecycle, poll-config (WithTimeout/WithPolling/WithContext/Immediate), capturing a matcher's observed value (.Capture), navigation (GetLocation/GetTitle), cookies/storage, tabs, cross-origin iframes (b.Frame frame handles), DOM existence/visibility/contents/properties/forms, clicking and interactions (incl. drag/scroll/tap/modifiers/text-selection), realistic mode, keyboard, uploads, element JS, dialogs, downloads, arbitrary JS (incl. the GetJSValue app-state barrier), network stubbing/aborting/modifying/observing/holding (HoldResponse + Limit/ReleaseNext), screenshots/screencasts/outline/window, the page clock (InstallClock/Clock + PauseAt/Resume/RunFor/FastForward/SetFixedTime/SetSystemTime), and visual regression (HaveScreenshot + Mask/Tolerance/ChannelTolerance/Animated/InColorSchemes). Use to look up the exact Go method or matcher name and shape. Methods marked (dual) poll until they succeed when fully applied and return a pollable matcher when under-applied./explore-unfamiliar-pageOrient to an unfamiliar page, then draft a starter Go/Ginkgo Biloba spec from its DOM outline, accessibility tree, and screenshot. Use when writing browser tests against a URL or fixture you have not seen. Covers the orient-author-cleanup loop and accepts a URL or fixture argument when invoked explicitly./flake-huntRun a flake hunt on a Biloba Ginkgo suite — run the whole browser suite many times (60 by default), every run to completion with its own JSON report, then read each spec's failure rate, the seeds, and Biloba's failure evidence out of those reports instead of re-running. Covers the hunt script (compile once, --procs at the measured knee, --randomize-all, --poll-progress-after, a per-run BILOBA_SCREENSHOTS_DIR), why --repeat and --until-it-fails can't measure a rate, 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, wedges, a long tail that clusters by run), and the performance record a hunt produces (spec timing, parallel efficiency, per-spec 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-specsDiagnose and prevent flaky Go/Ginkgo Biloba specs — specs that pass locally but fail in CI, fail intermittently under `-p` or load, or fail somewhere other than the line that is actually wrong. Biloba polls by default, so the headline rule is "don't reach for b.Immediate()". Covers the residual smells — single-shot `b.Run(expr,&x)` reads and gate-then-re-read pairs (fix with .Capture); the non-polling SendKeysToWindowImmediately and `*Immediately` verbs; optimistic-UI and server-reconciliation traps (barrier on app state with b.GetJSValue, force the arrival order with b.HoldResponse + Limit/ReleaseNext); async-settling geometry, layout, and document-order reads; AllowMissing for properties absent on the element type; network handlers accumulating across an Ordered container; vacuous assertions that can never fail (an unresolved locator scope, BeNetworkIdle before the request starts, an empty Current*ForEach under a negation, a visual baseline written without ever being reviewed, a screenshot tolerance widened until nothing can fail, BILOBA_UPDATE_SCREENSHOTS left set in CI); gating on a DOM anchor instead of the URL; 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 (b.InstallClock, PauseAt/RunFor/FastForward), including why a poll never advances a paused clock. Use when a browser spec is flaky, nondeterministic, order-dependent, load-sensitive, or CI-only, or when reviewing a suite for latent races./look-at-pagesLook at your own UI while you iterate on it, with Go/Ginkgo Biloba — a throwaway spec that screenshots a page across colour schemes (light/dark via b.SetMedia) and viewport sizes (phone via b.SetWindowSize + b.Mobile()/b.TouchScreen()), plus the text views an agent can read without an image (b.Outline, b.A11yOutline, GetBoundingBox, GetComputedStyle, AllConsoleMessages/AllPageErrors), the states worth capturing (focus, open menus, dialogs, CSS :hover via b.Realistic(), error states via StubResponse, long content), and turning what you saw into assertions (Encloses and the other layout matchers, HaveScreenshot with InColorSchemes). Use when asked to look at, review, or screenshot a page or design (light/dark, phone/desktop) rather than to test it. For drafting a first spec against a page you haven't seen, see explore-unfamiliar-page./overviewThe Biloba mental model for writing browser tests in a Go Ginkgo/Gomega suite — pragmatic simulation, poll-by-default, dropping to chromedp, and visual regression against committed baselines. Use first when starting with Biloba or deciding whether it fits a Go browser-testing task. Routes to the other skills in this plugin.Other plugins' skills for the same job