Free, open-source CLI and Node.js library

Check any web page in a real Chrome.

brokit opens your pages in a headless Chrome, uses them as a person would (clicks, typing, touch), checks what they show and compares screenshots. On your computer, in CI, or run by your AI agent.

$ npx brokit run index.html
Read the docs

Needs Node.js 22.4+ and Chrome, Chromium or Edge · no npm dependencies · MIT or Apache-2.0

$ brokit run signup.html --steps steps.json
brokit run http://127.0.0.1:45541/signup.html
  ready (load + network idle) in 609 ms
  ✓ click #email
  ✓ type "ana@example.com"
  ✓ key Enter
  ✓ expect greeting.textContent equals "Welcome, ana"
  ✓ screenshot signed-in → brokit-out/signed-in.png (1280×800)
ok in 0.8 s

At a glance

What brokit is, and who it's for.

What it is
A command-line tool and a Node.js library. It drives a headless Chrome: it opens your pages, clicks, types and taps, reads what they show, and compares screenshots with ones you approved.
Who it's for
Web developers checking their own pages, teams that want those checks to run in CI, and AI coding agents that need to see and use what they build.
Where it runs
On your computer (Linux; macOS and Windows not tested yet), in CI (GitHub Actions, GitLab CI, Docker), and anywhere an agent can run a command.
What it needs
Node.js 22.4 or newer, and Chrome, Chromium or Edge, which it finds on its own. No Chrome? brokit install-chrome gets one. Installing brokit adds one package, a 51 kB download (about 160 kB on disk): it has no npm dependencies.
Where to get it
From npm: npm install --save-dev brokit. Until it's published there, from GitHub: npm install --save-dev github:radufarcas10/brokit, or from a clone (how). Free and open source, under MIT or Apache-2.0.
How to start
npx brokit doctor checks your setup, npx brokit run index.html opens a page; the docs cover steps, checks, baselines and CI.

Light to install

One npm package, a 51 kB download, with no npm dependencies to audit: it's built on Node's own modules. It drives the Chrome you already have; brokit install-chrome fetches one if you don't.

Input a person would give

Mouse, wheel, keys, touch and input methods go through Chrome's own input pipeline. Your page can't tell them from a person's, so what passes here works there.

Safe by default

Pages on your computer only, unless you name a host. A throwaway profile, Chrome's sandbox on, and every file it reads treated as untrusted.

Steps

Steps anyone can read. Or write.

A check is a short JSON list: click here, type this, press that, look. A teammate can review it, and an AI agent can write it without learning an API.

  • Point anywhere: coordinates, a CSS selector, a spot inside a canvas, or a JS expression.
  • No guessing at timing: after each input the page gets a frame, and expect waits for the page to catch up.
  • Read the page back: eval or expect any expression; its value lands in the report.
[
  { "click": { "selector": "#email" } },
  { "type": "ana@example.com" },
  { "key": "Enter" },
  { "expect": "greeting.textContent", "equals": "Welcome, ana" },
  { "screenshot": "signed-in" }
]

Any page

DOM or canvas. Desktop or phone.

brokit doesn't care what made the page. If Chrome can show it, brokit can click it, read it and take its picture.

Plain HTML and every framework

Point at a file and brokit serves its folder, or point at your dev server.

brokit run index.html

Canvas, WebGL, WebGPU

No DOM to query? Click a spot inside the canvas and read the pixels it drew.

"from": "document.querySelector('canvas')"

Phones, light and dark

Screen size, pixel density, touch, taps, swipes and flicks, the notch, dark mode.

--size 393x852 --dpr 3 --mobile

Every language

Input methods compose and commit as they do for Japanese, Chinese or Korean users.

{ "ime": "かな" }

Pixel diffs

See exactly what changed.

A new price, and a button three pixels lower and one shade darker, which pushes the card's edge down with it. Easy to miss by eye, impossible to miss here.

A pricing card: Team, $12 per seat per month, three features and a Start free trial button.
Before
The same card with the price $14 and the button slightly lower and darker.
After
The difference: the card faded to gray, with the changed price, the moved button and the card's lower edge in red.
Difference
$ brokit diff before.png after.png diff.png
before.png vs after.png
  760×940, 714400 pixels compared
  identical 87.298 %   ≤2 4.968 %   ≤8 0.347 %   ≤32 5.431 %   >32 1.956 %
  mean 4.2574, worst 243
  difference image → diff.png
  FAILED: 90745 pixels differ (up to 243)

Allow what doesn't matter: --tolerance '{"max": 2}' for antialiasing, '{">8": "0.1%"}' for a few stray pixels, --ignore for a clock.

Checks

Run them all. Remember how it looked.

brokit check runs every *.check.json in your project in one Chrome. Screenshots marked as baselines are compared with the approved ones, kept next to your checks and reviewed in git like code.

  • One browser for the suite: ten checks took 3.1 s of CPU, against 8.2 s with a browser for each.
  • Mistakes fail fast: every check is read before Chrome starts, so a typo costs milliseconds.
  • Changes on purpose: --update approves them. In CI, a missing baseline fails instead of quietly passing.
$ brokit check
brokit check: 3 scenarios, Chrome 155.0.8059.39, software drawing
✗ checks/card  1 step, 1.1 s
    ✗ screenshot card → brokit-out/checks/card/card.png (760×940)  391 ms
        differs from checks/baselines/card/card.png: 55252 pixels differ by more than 2 (up to 243)
        difference → brokit-out/checks/card/card.diff.png
✓ checks/signup-phone  5 steps, 0.4 s
✓ checks/signup  5 steps, 0.3 s
3 scenarios: 2 passed, 1 FAILED in 1.7 s

CI & agents

Made for pipelines and for agents.

Every run ends in an exit code your CI understands and, with --json, a result a script or an AI agent can read: each step, its value, the console, every error.

  • Plain answers: 0 when everything worked, 1 when the page failed, 2 when brokit was run wrong.
  • Same pixels everywhere: --gpu software draws identically on a laptop and a CI runner.
  • Safe to hand to an agent: local pages only, a sandboxed throwaway browser, files written only where you say.
{
  "url": "http://127.0.0.1:44993/signup.html",
  "ok": true,
  "ready": { "by": "load + network idle", "ms": 618 },
  "steps": [
    { "label": "click #email", "ok": true, "ms": 33 },
    { "label": "expect greeting.textContent equals \"Welcome, ana\"", "ok": true, "value": "Welcome, ana", "ms": 1 }
  ],
  "console": [],
  "errors": []
}

Install

Start in a minute.

brokit comes from npm. It needs Node.js 22.4 or newer, and Chrome, Chromium or Edge, which it finds on its own (or brokit install-chrome downloads one).

  1. Add it to your project

    $ npm install --save-dev brokit
  2. Check your setup

    $ npx brokit doctor
  3. Open a page

    $ npx brokit run index.html --out shot.png
  4. Give it steps

    $ npx brokit run index.html --steps steps.json
  5. Check everything

    $ npx brokit check

Not on npm yet. Until it is, add it from GitHub instead, and the rest works the same: npm install --save-dev github:radufarcas10/brokit. To run it from a clone, see Before brokit is on npm.

Read the docs every step, expectations, baselines, CI and containers