- electrobun.config.ts: AGOR_CEF=1 enables bundleCEF + chromiumFlags (remote-debugging-port=9222). Production stays on WebKitGTK. - wdio.electrobun.conf.js: rewritten for CDP via devtools protocol. Spawns app, waits for CDP port, kills on complete. - helpers/actions.ts: waitForPort() polls CDP /json endpoint - docs/testing.md: CEF mode docs, CI setup, troubleshooting - npm script: test:e2e:electrobun prepends AGOR_CEF=1 CEF also enables: WebGL xterm.js addon (unlimited terminals), WebGPU, full Chrome DevTools — all for dev/test only.
2.5 KiB
E2E Testing — CEF Mode
Overview
The Electrobun build supports two rendering backends:
| Backend | Use case | E2E automation | WebGL | xterm limit |
|---|---|---|---|---|
| WebKitGTK (default) | Production | None (no WebDriver) | No | 4 instances |
| CEF (opt-in) | Dev/test | CDP via port 9222 | Yes | Unlimited |
Production always ships with WebKitGTK — lighter footprint, no Chromium dependency, system-native rendering. CEF mode is for development and CI testing only.
Enabling CEF Mode
Set the AGOR_CEF environment variable before building or running:
# Build with CEF
AGOR_CEF=1 electrobun build --env=dev
# Dev mode with CEF
AGOR_CEF=1 electrobun dev
This does three things in electrobun.config.ts:
- Sets
bundleCEF: true— downloads and bundles CEF libraries - Sets
defaultRenderer: "cef"— uses CEF instead of WebKitGTK - Adds
chromiumFlags— enables--remote-debugging-port=9222and--remote-allow-origins=*
Running E2E Tests
# Run Electrobun E2E tests (sets AGOR_CEF=1 automatically)
npm run test:e2e:electrobun
# Run both Tauri and Electrobun E2E suites
npm run test:e2e:both
# Full test suite including E2E
npm run test:all:e2e
The test runner (wdio.electrobun.conf.js):
- Creates an isolated test fixture (temp dirs, test groups.json)
- Builds the app if no binary exists
- Launches the app with
AGOR_CEF=1andAGOR_TEST=1 - Waits for CDP port 9222 to respond
- Connects WebDriverIO via
automationProtocol: 'devtools' - Runs all shared spec files
- Kills the app and cleans up fixtures
CI Setup
- name: E2E (Electrobun + CEF)
run: xvfb-run AGOR_CEF=1 npm run test:e2e:electrobun
env:
AGOR_TEST: '1'
CEF requires a display server. Use xvfb-run on headless CI.
Port Assignments
| Port | Service |
|---|---|
| 9222 | CDP remote debugging (CEF) |
| 9760 | Vite dev server (HMR) |
| 9761 | Reserved (was WebKitWebDriver) |
Troubleshooting
"CDP port 9222 not ready after 30000ms" — The app failed to start or CEF was not bundled. Check that the build used AGOR_CEF=1. Look for [LAUNCHER] ERROR: CEF libraries found but LD_PRELOAD not set in stderr.
"No binary found" — The test runner falls back to electrobun dev, which builds and launches in one step. This is slower but works without a pre-built binary.
Tests pass with CEF but fail with WebKitGTK — Expected. WebKitGTK has no WebDriver/CDP support in Electrobun. E2E tests only run against CEF. Manual testing covers WebKitGTK.