A Capybara driver that speaks CDP to
Lightpanda, a headless browser built for automation. Same Capybara DSL,
same page.driver surface; only the binary at the other
end of the WebSocket changes.
Run your system tests on
capybara-lightpanda.Stop fighting flaky Turbo Drive specs.Only the driver changes.
One Gemfile line, one driven_by, one env var to switch
over — and you roll back by unsetting
BROWSER=lightpanda. Honest numbers from a real Rails 8
suite below.
capybara-lightpanda is a Capybara driver, not a new way to write tests: same DSL, same Capybara semantics, same page.driver surface. Your specs stay as they are.
# Gemfilegroup:testdogem"capybara-lightpanda"end
Wire the driver in your test setup. In Rails 7+ / Rails 8 with system tests:
If your specs already call into page.driver (cookies, network, debug, headers), most of those calls work as you’d expect from a CDP driver:
# Cookies — same names, same shapepage.driver.set_cookie("session_id",value,domain:"127.0.0.1",httpOnly:true)page.driver.clear_cookiespage.driver.remove_cookie("session_id")page.driver.browser.cookies["session_id"]# typed Cookie; the collection is Enumerable# Navigationpage.driver.go_backpage.driver.go_forwardpage.driver.refresh# JS — Capybara's standard methods route through the V8 engineexecute_script"window.example = 'hi'"evaluate_script"document.title"
In your test suite
Honest numbers from a Rails 8.1 app — Turbo + Stimulus, 24 DOM-only system tests on an M-series laptop:
Driver
Tests
Time
RSS / worker
Lightpanda
24 / 24
6.89s
~17 MB
Chrome
24 / 24
7.09s
~280 MB
Identical results. On a 24-test suite the wall-clock margin is small — Capybara’s own wait time dominates, just as it does on Chrome — so don’t read the 3% as “the speed claim.” The win that pays for itself is the right column:
Memory headroom. A 2 GB CI runner that hosts one Chromium can host 8–10 lightpanda processes. Parallelism scales where it didn’t before.
Cold start. No Skia, no Blink, no GPU process, no compositor — the binary is resident in milliseconds.
Less flake. Removing the Chromium boot removes one of the loudest sources of CI noise.
The upstream 9× / 16× numbers on this page are reproduced from lightpanda.io — a 933-page synthetic crawl on AWS m5.large. They show the ceiling at scale; the table above shows the floor on a real Rails suite.
03
Help us ship 1.0
capybara-lightpanda is in public beta. Real Rails
suites are how we find the edges. The cost to try it is one Gemfile
line and one env var — the cost to abandon it is unsetting that env
var.
i
Try it in 5 minutes
1
Add to your Gemfile, in the
:test group.
gem"capybara-lightpanda"
2
Gate it on an env var so your existing driver stays the
default.
# spec/support/capybara.rb · or test/support/...ifENV["BROWSER"]=="lightpanda"require"capybara-lightpanda"Capybara.javascript_driver=:lightpandaend
3
Run one suite. Decide.
$BROWSER=lightpanda bundle exec rails test test/system/
↺Rollback in 30 s. Drop the env var — your
suite goes back to your current driver. Gemfile.lock is the only
persistent change.