feat: CEF mode for Electrobun E2E — CDP automation, WebGL unlocked

- 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.
This commit is contained in:
Hibryda 2026-03-22 06:13:01 +01:00
parent fea6e267b0
commit c79d489e1a
5 changed files with 189 additions and 27 deletions

View file

@ -8,6 +8,26 @@
import { browser } from '@wdio/globals';
import * as S from './selectors.ts';
/**
* Wait for a TCP port to accept connections. Used by CDP-based E2E configs
* to wait for the debugging port before connecting WebDriverIO.
*
* Polls `http://localhost:{port}/json` (CDP discovery endpoint) every 500ms.
*/
export async function waitForPort(port: number, timeout: number): Promise<void> {
const start = Date.now();
while (Date.now() - start < timeout) {
try {
const res = await fetch(`http://localhost:${port}/json`);
if (res.ok) return;
} catch {
// Port not ready yet — retry
}
await new Promise(r => setTimeout(r, 500));
}
throw new Error(`CDP port ${port} not ready after ${timeout}ms`);
}
/** Open settings panel via gear icon click */
export async function openSettings(): Promise<void> {
// Try clicking settings button — may need multiple attempts on WebKitGTK