/biloba-go:overviewfrom biloba-go
Explains the Biloba mental model for writing browser tests in Go with Ginkgo/Gomega: pragmatic simulation, poll-by-default, chromedp fallback, and visual regression against committed baselines. Start here when evaluating or onboarding to Biloba.
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.
Biloba is a browser-testing framework for Go, built on chromedp, for Ginkgo and Gomega. You don't . import it — drive everything through a *biloba.Biloba value (conventionally b). Canonical docs: https://onsi.github.io/biloba/ — pin to the version you go get'd (the API may shift pre-1.0).
1. Performance via parallelization. One shared Chrome process drives one isolated root tab (b) per Ginkgo parallel process, reused between specs via b.Prepare().
ginkgo -p. Specs must be independent; Biloba's per-tab isolation makes that cheap.b is special: never closed, reused spec-to-spec. b.NewTab() tabs and spawned tabs are closed by Prepare(). → setup2. Stability via pragmatism. Biloba prefers a good-enough simulation run atomically in the browser over a realistic emulation across async round-trips. A click is element.click() after synchronous visibility/enabled checks — no scroll-into-view, no centroid, no occlusion test. This fast track is the default b. Consequences to internalize:
offsetWidth/offsetHeight. The fast track won't catch an element hidden behind another or off-screen. Use b.HaveComputedStyle for explicit style assertions, or b.BeClickable() to assert topmost-at-its-center.b.SetValue sets the value and fires input/change — it does not type. Apps wired to real key events (search-as-you-type, rich text, hotkeys) need b.Type.b.Hover fires pointer/mouse events but does not activate CSS :hover.:hover, or real drags, opt into b.Realistic() — a view of the same tab routed through real Chrome DevTools Protocol input. Per-spec opt-in (it costs round-trips and can reintroduce timing flake). → realistic-mode3. Conciseness via Ginkgo and Gomega.
Eventually(sel).Should(b.HaveScreenshot("name")) compares the element (or the whole tab) against a committed baseline PNG, re-capturing on every poll attempt so the comparison waits out fonts and reflow. A missing baseline fails loudly rather than being written and passed. → visual-assertionsb.Click("#go"), b.GetProperty(sel, "href")) polls until the element is ready, acts/reads once, then stops. The under-applied form returns a Gomega matcher you wrap in Eventually/Consistently. This dual API is the core pattern — learn it in write-tests. (b.Immediate() opts back into act-once/fail-fast; rarely needed.)console.log streams to the GinkgoWriter; a failing console.assert fails the spec. b.AllConsoleMessages()/b.AllPageErrors() snapshot the console and the page's uncaught exceptions.Never assert on a value you read exactly once. A browser is a pile of async settles (a WS frame, a layout pass, an rAF-injected node, an optimistic→server reconciliation), and any single read can land before the thing you care about settles. Biloba's poll-by-default actions and getters handle this — the residual flake sources are the few things that don't poll. Four reflexes:
b.Run reads don't poll — wrap them. b.Run(expr, &x); Expect(x) is a single-shot read (Run stays fail-fast on purpose — a thrown JS error is usually a real bug). Write Eventually(b.Run).WithArguments(expr).Should(matcher) instead; numbers decode to float64, so use BeNumerically.b.Run either. Layout/getBoundingClientRect/computed-style reads settle after an element exists, so they must be polled even once it's there — and Biloba has layout-aware natives for nearly all of them (b.GetBoundingBox/GetScrollOffset/GetOffsetTopWithin + Have* matchers, the pairwise b.BeAbove/Encloses/Overlaps, b.BeInViewport(), b.BePrecededBy/BeFollowedBy, b.GetComputedStyle). → apib.Immediate(). The default already polls; reaching for it reintroduces the classic "raced a frame, failed downstream" flake. The few methods that genuinely can't poll (SendKeysToWindowImmediately, the *Immediately plural verbs) carry the smell in their names — gate them by hand. → flaky-specs.Capture(&x): Eventually(sel).Should(b.HaveAttribute("data-id", Not(BeEmpty())).Capture(&id)) hands you the value from the read that actually satisfied the assertion, decoded into your Go type. → write-testsIf your app renders optimistically, both obvious signals lie. The DOM shows the pre-confirmation state (the click handler wrote it synchronously), so Eventually on it just re-reads the optimistic copy; a Go-side HTTP read bypasses the browser's event loop and proves only that the server persisted something. Barrier on app state — b.GetJSValue("window.__storeLog", &log) polls a path the app writes, which can only become true if the renderer applied the response — and force the arrival order with b.HoldResponse(url) instead of hoping to hit a 1%-natural race. (GetJSValue gates on definedness, so it only barriers on a path the app creates lazily, in the handler you're waiting for; against an eagerly-created log poll the predicate: Eventually(expr).Should(b.EvaluateTo(...)).) → flaky-specs
When a spec is flaky, order-dependent, or only fails under -p/CI, go straight to flaky-specs. To find out how often specs fail, or to confirm that a fix worked, run the suite many times and read the reports → flake-hunt.
Every action/matcher takes:
#id/[data-testid] hooks, not styling classes. >>> pierces open shadow roots / same-origin iframes. A cross-origin iframe (another port counts) is reached through a frame handle instead: frame := b.Frame(b.FrameMatching().WithURL(...)) is a *Biloba scoped to that frame's document (write-tests).Locator — describes an element as a user perceives it (b.ByRole("button").WithName("Save"), b.ByText, b.ByLabel, b.ByTestID). Reach for these to assert a11y or when the visible label is the natural identifier. They compose (.ContainingText/.Containing/.And/.Or/.Within/.Nth, each accepting any selector) and pierce open shadow roots automatically. b.ByCSS(sel) takes raw CSS into that algebra (b.ByCSS(".story").Nth(1) for the 2nd match, instead of :nth-of-type).XPath — the rare power tool for axis/ordinal queries.→ write-tests, xpath
Device and environment emulation is native — reach for it before CDP:
b.SetPermissions(appURL, map[biloba.Permission]biloba.PermissionState{biloba.PermissionGeolocation: biloba.PermissionGranted})
b.SetGeolocation(biloba.Geolocation{Latitude: 48.8584, Longitude: 2.2945, Accuracy: 10})
b.SetLocale("fr-FR"); b.SetTimezone("Europe/Paris"); b.SetOffline(true)
Each is per tab, undone at spec end, and refused on a frame handle (api). Time is too: b.InstallClock(t0) fakes the page's timers and Date, so a spec can PauseAt, RunFor, or FastForward through a countdown or a debounce instead of waiting for it (write-tests).
Biloba deliberately does not hide chromedp. Every tab exposes b.Context for a CDP feature without a native wrapper:
ctx, cancel := context.WithTimeout(b.Context, 30*time.Second)
defer cancel()
_, err := chromedp.Call(ctx, emulation.SetCPUThrottlingRate, emulation.SetCPUThrottlingRateParams{Rate: 4})
Biloba uses chromedp v0.23, whose API changed in v0.17: chromedp.Run(ctx, actions...) is now chromedp.Do, a cdproto command is called as chromedp.Call(ctx, page.Navigate, page.NavigateParams{...}) (browser-level ones with chromedp.CallBrowser), ActionFunc is chromedp.Func, and ListenTarget is chromedp.Listen(ctx, fn) (every event, in order, and it returns an error) or chromedp.Events(ctx, network.ResponseReceived) (one event type per iterator). The docs' chromedp section lists the old and new forms.
An override set this way is yours to undo — Prepare() doesn't know about it.
Sibling skills are named here without a prefix; invoke one with the same plugin prefix you loaded this skill under.
| Task | Skill |
|---|---|
Wiring Biloba into a project (bootstrap, chrome-headless-shell) | setup |
| Authoring specs (dual API, locators, interactions, hermetic tests, multi-tab) | write-tests |
| Looking up a method or matcher | api |
Realistic interactions (occlusion, :hover, drag, scroll, touch) | realistic-mode |
| Asserting appearance / visual regression baselines | visual-assertions |
| Building XPath selectors | xpath |
| Testing a page/app you haven't seen | explore-unfamiliar-page |
| Looking at your own UI while you build it (light/dark, phone/desktop, states) | look-at-pages |
| A spec failed and you want to see why | debug-failures |
A spec is flaky / order-dependent / only fails under -p or CI | flaky-specs |
| Measuring failure rates or suite performance across many runs (a flake hunt) | flake-hunt |
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./debug-failuresSee why a Go/Ginkgo Biloba spec failed or flaked — the on-failure artifacts (DOM outline + screenshots + poll trajectory of the timed-out read + the visual-regression diagnosis with its .actual.png/.diff.png, the "never settled" warning an update run prints + the detached-node "matched then stopped matching" signal + the occluded-click diagnosis naming what covered the target), how Biloba auto-adapts to humans vs CI vs AI agents, the env vars and config knobs that surface them (BILOBA_SCREENSHOTS_DIR, BILOBA_SCREENSHOT_BASELINES_DIR, BILOBA_UPDATE_SCREENSHOTS, BILOBA_INLINE_SCREENSHOTS, BILOBA_OUTLINE_MAX, BILOBA_INTERACTIVE, BilobaConfig*), attaching app/store state to a failure, headless quirks (stale innerText, unscheduled requestAnimationFrame), and using b.Outline()/b.A11yOutline() to understand why a selector did not match. Use when a browser spec is failing or flaky and you need visibility, or to configure failure output for CI/agents. For *preventing* flakes (single-shot reads, avoiding b.Immediate(), optimistic-UI) see this plugin's flaky-specs skill./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.Other plugins' skills for the same job