mattrguerra/cortexmainPrivate on GitHub, published here in full

e2e-linux.sh

Language Shell1.4 KB44 lines

scripts/e2e-linux.sh

  1. #!/usr/bin/env bash
  2. # The real app end to end on Linux: Xvfb + the stand-in + tauri-driver.
  3. # Needs: webkit2gtk-driver (WebKitWebDriver), tauri-driver (cargo install), xvfb.
  4. # Build first: npx tauri build --debug --no-bundle --features e2e
  5. set -euo pipefail
  6. cd "$(dirname "$0")/.."
  7. BIN="${CORTEX_BIN:-$PWD/target/debug/cortex}"
  8. WORK="$(mktemp -d)"
  9. PORT="${STANDIN_PORT:-8799}"
  10. pids=()
  11. cleanup() {
  12. for p in "${pids[@]}"; do kill "$p" 2>/dev/null || true; done
  13. # Closing the window only hides Cortex (it lives in the tray), so the app
  14. # outlives the WebDriver session: stop it, matched by its exact path.
  15. pkill -xf "$BIN" 2>/dev/null || true
  16. pkill -x WebKitWebDriver 2>/dev/null || true
  17. if [ -n "${KEEP:-}" ]; then echo "kept $WORK"; else rm -rf "$WORK"; fi
  18. }
  19. trap cleanup EXIT
  20. cargo build -q -p standin
  21. ./target/debug/standin "127.0.0.1:$PORT" >"$WORK/standin.log" 2>&1 &
  22. pids+=($!)
  23. Xvfb :99 -screen 0 1400x900x24 >/dev/null 2>&1 &
  24. pids+=($!)
  25. export DISPLAY=:99
  26. # The app inherits these through tauri-driver and WebKitWebDriver.
  27. export CORTEX_DATA_DIR="$WORK/data"
  28. export CORTEX_SEED_URL="http://127.0.0.1:$PORT/v1"
  29. export CORTEX_EXPORT_DIR="$WORK/vault"
  30. export CORTEX_BIN="$BIN"
  31. mkdir -p "$CORTEX_EXPORT_DIR"
  32. dbus-run-session -- tauri-driver >"$WORK/driver.log" 2>&1 &
  33. pids+=($!)
  34. for _ in $(seq 1 50); do
  35. curl -sf http://127.0.0.1:4444/status >/dev/null && break
  36. sleep 0.2
  37. done
  38. node e2e/tauri/app.e2e.mjs