Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(e2e): run native driver under xvfb

Steven Enamakele9e8f94d3e2e
diff --git a/app/scripts/e2e-run-session.sh b/app/scripts/e2e-run-session.sh
index 9acc8bb15b..bd2540a793 100755
--- a/app/scripts/e2e-run-session.sh
+++ b/app/scripts/e2e-run-session.sh
@@ -313,7 +313,14 @@ if [ "$OS" = "Linux" ] && [ "${E2E_USE_TAURI_DRIVER:-0}" = "1" ]; then
TAURI_DRIVER_PORT="${TAURI_DRIVER_PORT:-4444}"
TAURI_DRIVER_LOG="${RUNNER_TEMP:-${TMPDIR:-/tmp}}/tauri-driver-${LOG_SUFFIX}.log"
echo "[runner] Starting tauri-driver on port $TAURI_DRIVER_PORT"
- tauri-driver --port "$TAURI_DRIVER_PORT" --native-driver "${WEBKIT_WEBDRIVER:-/usr/bin/WebKitWebDriver}" \
+ # Keep the native GUI process under Xvfb in a headless Linux environment.
+ # WDIO itself must not be wrapped: its local runner uses an IPC descriptor
+ # that xvfb-run does not retain (see autoXvfb: false in wdio.conf.ts).
+ DRIVER_COMMAND=(tauri-driver --port "$TAURI_DRIVER_PORT" --native-driver "${WEBKIT_WEBDRIVER:-/usr/bin/WebKitWebDriver}")
+ if [ -z "${DISPLAY:-}" ] && [ -z "${WAYLAND_DISPLAY:-}" ]; then
+ DRIVER_COMMAND=(xvfb-run --auto-servernum --server-args="-screen 0 1280x800x24" -- "${DRIVER_COMMAND[@]}")
+ fi
+ "${DRIVER_COMMAND[@]}" \
> "$TAURI_DRIVER_LOG" 2>&1 &
APP_PID=$!
export TAURI_DRIVER_PORT
diff --git a/app/test/wdio.conf.ts b/app/test/wdio.conf.ts
index 930dcbc99f..e31af51293 100644
--- a/app/test/wdio.conf.ts
+++ b/app/test/wdio.conf.ts
@@ -84,6 +84,10 @@ export const config: Options.Testrunner & Record<string, unknown> = {
path: '/',
specs: [testSpecsPath],
rootDir: projectRoot,
+ // `tauri-driver` owns the native WebKit display lifecycle. WDIO's automatic
+ // `xvfb-run` wrapper drops the local-runner IPC descriptor, so workers exit
+ // before they can create a WebDriver session when $DISPLAY is absent.
+ autoXvfb: false,
// Single session — the app is one instance.
maxInstances: 1,
capabilities: [