Skip to Content
Testing

Testing — 136 Puppeteer Tests Passing

Test Suite Overview

CategoryTestsDescription
Go unit tests379Bridge translation, session management, CDP server
Juggler integration74/74End-to-end with Camoufox 146
BiDi integration62/62End-to-end with Firefox 148

Running Unit Tests

cd /path/to/foxbridge go test ./...

Run with race detector:

go test -race ./...

Run a specific package:

go test ./pkg/bridge/ go test ./pkg/cdp/ go test ./pkg/recording/

For lower-flake screenshot and snapshot captures, start foxbridge with deterministic runtime injection:

foxbridge --binary /path/to/camoufox --deterministic-time 1700000000000 --deterministic-seed 42 --headless

For reproducible protocol debugging, capture a live session and replay it later without launching Firefox:

foxbridge --binary /path/to/camoufox --record ./trace.jsonl --headless foxbridge replay --recording ./trace.jsonl --port 9222

The recording format is JSONL, one inbound or outbound CDP frame per line. The replay harness is intended for browser-level single-session traces so client regressions can be reproduced against a stable fixture.

Test Files

FileCoverage
pkg/bridge/bridge_test.goBridge routing and message dispatch
pkg/bridge/page_test.goPage navigation, screenshot, PDF, content
pkg/bridge/runtime_test.goevaluate, callFunctionOn, getProperties
pkg/bridge/dom_test.goquerySelector, describeNode, getBoxModel
pkg/bridge/input_test.goMouse, keyboard, touch dispatch
pkg/bridge/network_test.goCookies, headers, cache
pkg/bridge/fetch_test.goRequest interception, fulfill, abort
pkg/bridge/emulation_test.goViewport, geolocation, timezone
pkg/bridge/events_test.goEvent translation and session resolution
pkg/bridge/target_test.goTarget creation, auto-attach, contexts
pkg/bridge/stub_test.goStub domains return success
pkg/bridge/accessibility_test.goAX tree pass-through
pkg/bridge/console_test.goConsole event translation
pkg/bridge/testutil_test.goShared test helpers and mock backend
pkg/cdp/session_test.goSession manager CRUD
pkg/cdp/server_test.goWebSocket server and HTTP endpoints
pkg/recording/capture_test.goJSONL capture and large-frame loading
pkg/recording/replay_test.goBrowser-level CDP replay ordering

Integration Tests

Integration tests require a running browser. They use Puppeteer to connect to foxbridge and verify end-to-end behavior.

Juggler (Camoufox)

# Start foxbridge foxbridge --binary /path/to/camoufox --headless # Run Puppeteer test suite cd tests && npm test

BiDi (Firefox)

# Start foxbridge with BiDi foxbridge --backend bidi --binary /path/to/firefox --headless # Run same test suite cd tests && npm test

What’s Tested

  • Navigation (goto, reload, back/forward, setContent)
  • Screenshots (full page, element, clip region)
  • PDF generation with IO streaming
  • JavaScript evaluation (evaluate, $eval, $$eval)
  • DOM queries (querySelector, querySelectorAll, getBoxModel)
  • Input dispatch (click, type, keyboard shortcuts)
  • Cookie management (set, get, delete, cross-context isolation)
  • Request interception (continue, abort, fulfill, auth)
  • Emulation (viewport, geolocation, timezone, user agent)
  • Dialog handling (alert, confirm, prompt)
  • Frame management (attach, detach, cross-frame navigation)
  • Multiple browser contexts (isolation, cleanup)
  • Target lifecycle (create, close, auto-attach)
  • Execution context tracking (creation, destruction, navigation)

See also

Last updated on