e2e-linux.sh
Language Shell1.4 KB44 lines
#!/usr/bin/env bash# The real app end to end on Linux: Xvfb + the stand-in + tauri-driver.# Needs: webkit2gtk-driver (WebKitWebDriver), tauri-driver (cargo install), xvfb.# Build first: npx tauri build --debug --no-bundle --features e2eset -euo pipefailcd "$(dirname "$0")/.."BIN="${CORTEX_BIN:-$PWD/target/debug/cortex}"WORK="$(mktemp -d)"PORT="${STANDIN_PORT:-8799}"pids=()cleanup() {for p in "${pids[@]}"; do kill "$p" 2>/dev/null || true; done# Closing the window only hides Cortex (it lives in the tray), so the app# outlives the WebDriver session: stop it, matched by its exact path.pkill -xf "$BIN" 2>/dev/null || truepkill -x WebKitWebDriver 2>/dev/null || trueif [ -n "${KEEP:-}" ]; then echo "kept $WORK"; else rm -rf "$WORK"; fi}trap cleanup EXITcargo build -q -p standin./target/debug/standin "127.0.0.1:$PORT" >"$WORK/standin.log" 2>&1 &pids+=($!)Xvfb :99 -screen 0 1400x900x24 >/dev/null 2>&1 &pids+=($!)export DISPLAY=:99# The app inherits these through tauri-driver and WebKitWebDriver.export CORTEX_DATA_DIR="$WORK/data"export CORTEX_SEED_URL="http://127.0.0.1:$PORT/v1"export CORTEX_EXPORT_DIR="$WORK/vault"export CORTEX_BIN="$BIN"mkdir -p "$CORTEX_EXPORT_DIR"dbus-run-session -- tauri-driver >"$WORK/driver.log" 2>&1 &pids+=($!)for _ in $(seq 1 50); docurl -sf http://127.0.0.1:4444/status >/dev/null && breaksleep 0.2donenode e2e/tauri/app.e2e.mjs