The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(e2e-testing): add e2e testing guide
Steven Enamakel4ecf8742ec86
diff --git a/gitbooks/developing/e2e-testing.md b/gitbooks/developing/e2e-testing.mdindex 8544acfa71..5bfa1ae3a3 100644--- a/gitbooks/developing/e2e-testing.md+++ b/gitbooks/developing/e2e-testing.md@@ -1,26 +1,23 @@---description: >-- The desktop and web end-to-end suites: the WDIO and tauri-driver harness,- how to run a spec locally or in Docker, the environment variables each lane- reads, and which lanes actually execute in CI.+ How to run the end-to-end suites: the WDIO and tauri-driver harness, a spec+ locally or in Docker, the environment variables, and which lanes run in CI.icon: vials---# E2E testing-End-to-end coverage runs in three lanes: a Rust mock-backend suite, a-Playwright web suite, and a desktop suite driven through `tauri-driver`. Only-the Linux desktop harness runs on a schedule; macOS and Windows are manual.+End-to-end coverage runs in three lanes: a Rust mock-backend suite, a Playwright web suite, and a desktop suite driven through `tauri-driver`. Only the Linux desktop harness runs in CI. macOS and Windows are manual.## Overview-Desktop E2E tests use **WebDriverIO (WDIO)** to drive the app through a single `tauri-driver` (WebDriver) session against its native Wry/WebKit webview:+Desktop E2E tests use WebDriverIO (WDIO) to drive the app through a single `tauri-driver` (WebDriver) session against its native Wry/WebKit webview:| Platform | Driver | Port | App format | Selectors || --------- | ------------------------------ | ---- | ------------ | --------- |-| **Linux** | tauri-driver + WebKitWebDriver | 4444 | Debug binary | CSS / DOM |+| Linux | tauri-driver + WebKitWebDriver | 4444 | Debug binary | CSS / DOM |-The app moved from CEF to Tauri's native Wry webview in #5456. The old Appium Chromium-driver backend attached over CEF's remote-debugging port; CDP only exists under a Chromium engine, so that backend was removed in #5478 along with CEF itself. Linux CI now drives the debug binary under Xvfb through `tauri-driver`. macOS and Windows have no automated desktop E2E coverage until a native driver (Appium Mac2 / WinAppDriver) replaces the removed one; that work is tracked in #5485. `pnpm --filter openhuman-app test:e2e:build` still produces a `.app` bundle on macOS for manual testing, but there is no supported automated session there yet.+Linux CI drives the debug binary under Xvfb through `tauri-driver`. macOS and Windows have no automated desktop E2E coverage yet. The Chromium-based driver they used is gone, and a native driver (Appium Mac2 on macOS, WinAppDriver on Windows) would have to replace it. `pnpm --filter openhuman-app test:e2e:build` still produces a `.app` bundle on macOS for manual testing, but there is no supported automated session there.---@@ -45,15 +42,15 @@ bash app/scripts/e2e-run-spec.sh test/e2e/specs/smoke.spec.ts smoke`app/scripts/e2e-run-session.sh` starts `tauri-driver` on `TAURI_DRIVER_PORT`(default `4444`) with `WebKitWebDriver` as its native driver, waits for its`/status` endpoint, then runs WDIO against `app/test/wdio.conf.ts`. On-headless Linux the app itself runs under **Xvfb** for a virtual display; the+headless Linux the app itself runs under Xvfb for a virtual display; thedriver process does not need one.### Docker on macOS (Linux harness locally)-Run the same Linux-based harness from macOS using Docker.+To run the same Linux harness from macOS, use Docker.```bash-# Build + run all E2E flows+# Build and run all E2E flowsdocker compose -f e2e/docker-compose.yml run --rm e2e# Build the app first (if needed)@@ -73,17 +70,11 @@ Requires Docker Desktop or Colima. The repo is bind-mounted so builds persist be### Platform detection-`app/test/e2e/helpers/platform.ts` now exports two functions, both hardcoded-to `true`: `isTauriDriver()` and `supportsExecuteScript()`. They date from an-earlier harness split between an accessibility-tree macOS driver and a-DOM-based Linux driver. Every session today exposes the WebView DOM and-supports `browser.execute()`, so specs that still branch on either check-always take the DOM-capable path. Treat them as compatibility shims, not-active platform detection.+`app/test/e2e/helpers/platform.ts` exports two functions, both hardcoded to `true`: `isTauriDriver()` and `supportsExecuteScript()`. Every session exposes the webview DOM and supports `browser.execute()`, so specs that still branch on either check always take the DOM path. Treat them as compatibility shims, not as platform detection.### Element helpers-`app/test/e2e/helpers/element-helpers.ts` provides a unified API over the WebView DOM:+`app/test/e2e/helpers/element-helpers.ts` provides one API over the webview DOM:| Helper | Behavior || ------------------------- | -------------------------------------------- |@@ -114,14 +105,14 @@ Use `waitForTestId(testId)` and `clickTestId(testId)` from `element-helpers.ts``app/test/e2e/helpers/deep-link-helpers.ts` handles auth deep links:-- **Primary path**: `browser.execute(window.__simulateDeepLink(url))`, which works against the WebView on every platform tauri-driver supports.-- **macOS-only fallbacks** (unexercised by CI today, since macOS has no automated desktop session): the `macos: deepLink` extension command, then `open -a ...`.-- Linux has no shell fallback: `xdg-open openhuman://...` needs a `.desktop` file registering the URL scheme, which the CI container does not have, so `triggerDeepLink` throws immediately if the WebView simulate call fails there.+- Primary path: `browser.execute(window.__simulateDeepLink(url))`. It works against the webview on every platform tauri-driver supports.+- macOS-only fallbacks: the `macos: deepLink` extension command, then `open -a ...`. CI does not exercise these, because macOS has no automated desktop session.+- Linux has no shell fallback. `xdg-open openhuman://...` needs a `.desktop` file that registers the URL scheme, and the CI container does not have one. If the webview simulate call fails there, `triggerDeepLink` throws immediately.-For release candidates, also run one manual secondary-instance smoke on Linux-or macOS when touching single-instance or deep-link startup code (this-exercises `tauri-plugin-single-instance`, which OpenHuman registers with the-`deep-link` feature):+For release candidates, also run one manual secondary-instance smoke test on Linux+or macOS when you touch single-instance or deep-link startup code. It exercises+`tauri-plugin-single-instance`, which OpenHuman registers with the+`deep-link` feature.1. Launch OpenHuman normally and leave it running.2. Trigger `openhuman://auth?token=e2e-token&key=auth` through the OS opener.@@ -129,20 +120,17 @@ exercises `tauri-plugin-single-instance`, which OpenHuman registers with thesecond app instance starting.4. Confirm the secondary process exits cleanly.-This catches regressions where a second instance starts (or exits with an-error) before Tauri's deep-link forwarding path is installed.+This catches a second instance that starts, or exits with an+error, before Tauri's deep-link forwarding path is installed.### Writing cross-platform specs-1. **Use helpers** from `element-helpers.ts`, never use raw `XCUIElementType*` selectors in specs-2. **Use `clickNativeButton(text)`** instead of inline button-clicking code-3. **Use `hasAppChrome()`** instead of checking for `XCUIElementTypeMenuBar`-4. **Use `waitForWebView()`** instead of checking for `XCUIElementTypeWebView`-5. For macOS-only tests, use `process.platform` guards or separate spec files-6. Use `navigateViaHash(route)` for hash routes; it waits for the hash,- `document.readyState`, and a mounted React root before returning. After- onboarding, `walkOnboarding()` also waits for `#/home` plus a Home-page- marker before specs navigate elsewhere.+1. Use the helpers in `element-helpers.ts`. Never use raw `XCUIElementType*` selectors in specs.+2. Use `clickNativeButton(text)` instead of inline button-clicking code.+3. Use `hasAppChrome()` instead of checking for `XCUIElementTypeMenuBar`.+4. Use `waitForWebView()` instead of checking for `XCUIElementTypeWebView`.+5. For macOS-only tests, use `process.platform` guards or separate spec files.+6. Use `navigateViaHash(route)` for hash routes. It waits for the hash, `document.readyState` and a mounted React root before it returns. After onboarding, `walkOnboarding()` also waits for `#/home` and a Home-page marker before specs navigate elsewhere.---@@ -160,13 +148,7 @@ error) before Tauri's deep-link forwarding path is installed.| `DEBUG_E2E_DEEPLINK` | (verbose) | Set to `0` to silence deep link logs || `E2E_FORCE_CARGO_CLEAN` | unset | Force cargo clean before E2E build |-Two web E2E sessions on one machine need separate ports. The lane refuses to-start when any of its three ports is already listening, because its readiness-probes are ordinary HTTP GETs that the other session's mock, core and web host-answer just as happily, and `openhuman-core run` falls back to a neighbouring-port rather than exiting, so it would stay alive on a port nothing probes-(#5918). Set `E2E_PORT_BASE` for the build and the run alike: the mock and core-ports are compiled into the bundle and cannot be changed afterwards (#6478).+Two web E2E sessions on one machine need separate ports. The lane refuses to start when any of its three ports is already listening. Its readiness probes are ordinary HTTP GETs that another session's mock, core and web host would answer just as happily, and `openhuman-core run` falls back to a neighboring port instead of exiting, so it could stay alive on a port nothing probes. Set `E2E_PORT_BASE` for the build and the run alike. The mock and core ports are compiled into the bundle and cannot be changed afterwards.```bashE2E_PORT_BASE=31000 pnpm --filter openhuman-app test:e2e:web@@ -191,16 +173,9 @@ on every push to it, and carries three E2E lanes:| Playwright web | `playwright-e2e` | Linux || Desktop | `e2e-desktop`, via `e2e-reusable.yml` | Linux only |-The desktop lane calls the reusable workflow with `run_linux: true`,-`run_macos: false` and `run_windows: false`, so only the Linux harness-executes. The job's "3 OS" title names the matrix the reusable workflow is-able to run, not the one CI Full asks for.+The desktop lane calls the reusable workflow with `run_linux: true`, `run_macos: false` and `run_windows: false`, so only the Linux harness runs. The job's "3 OS" title names the matrix the reusable workflow can run, not the one CI Full asks for.-macOS and Windows desktop E2E therefore have no scheduled coverage on any-branch. `.github/workflows/e2e.yml` is a manual dispatch whose `run_macos` and-`run_windows` inputs default to `false` as well, so someone has to opt in-explicitly to get cross-platform desktop signal before a promotion. Both stay-off until #5485 lands a native driver for each platform.+macOS and Windows desktop E2E therefore have no scheduled coverage on any branch. `.github/workflows/e2e.yml` is a manual dispatch whose `run_macos` and `run_windows` inputs also default to `false`. To get cross-platform desktop signal before a promotion, someone has to opt in. Both stay off until a native driver exists for each platform.---@@ -208,7 +183,7 @@ off until #5485 lands a native driver for each platform.### Linux: "WebView not ready" timeout-This usually means `tauri-driver` never reached its `/status` endpoint, or the app crashed before mounting its WebView. Use `app/scripts/e2e-run-session.sh`, which starts `tauri-driver` and waits on that endpoint before invoking WDIO, rather than driving the app by hand.+This usually means `tauri-driver` never reached its `/status` endpoint, or the app crashed before mounting its webview. Use `app/scripts/e2e-run-session.sh`, which starts `tauri-driver` and waits on that endpoint before invoking WDIO, rather than driving the app by hand.Ensure `DISPLAY` is set and Xvfb is running:@@ -217,7 +192,7 @@ export DISPLAY=:99Xvfb :99 -screen 0 1280x1024x24 &```-Also ensure dbus is started (required by webkit2gtk):+Also make sure dbus is running (webkit2gtk needs it):```basheval $(dbus-launch --sh-syntax)@@ -225,7 +200,7 @@ eval $(dbus-launch --sh-syntax)### Linux: `tauri-driver` or `WebKitWebDriver` not found-Install `tauri-driver` with `cargo install tauri-driver`, and make sure `WebKitWebDriver` is on `PATH` (on Debian/Ubuntu it ships in `webkit2gtk-driver`) or point `WEBKIT_WEBDRIVER` at its location; `e2e-run-session.sh` defaults to `/usr/bin/WebKitWebDriver`.+Install `tauri-driver` with `cargo install tauri-driver`, and make sure `WebKitWebDriver` is on `PATH` (on Debian and Ubuntu it ships in `webkit2gtk-driver`) or point `WEBKIT_WEBDRIVER` at its location. `e2e-run-session.sh` defaults to `/usr/bin/WebKitWebDriver`.### macOS: Deep links not working in `tauri dev`@@ -233,13 +208,11 @@ Deep links require a `.app` bundle. Use `pnpm tauri build --debug --bundles app`### Docker: Build is slow on first run-The first Docker build compiles Rust and installs the E2E harness dependencies. Subsequent runs use cached layers. Cargo registry and git sources are cached via Docker volumes.+The first Docker build compiles Rust and installs the E2E harness dependencies. Subsequent runs use cached layers. Docker volumes cache the Cargo registry and git sources.-## Spec: Notifications+## Spec: notifications-**File**: `app/test/e2e/specs/notifications.spec.ts`--Tests notification RPC methods via the in-process core and the Notifications UI page:+The spec `app/test/e2e/specs/notifications.spec.ts` tests notification RPC methods through the in-process core and the Notifications UI page:- `notification_ingest`, creates a new notification via core RPC- `notification_list`, verifies the ingested notification is returned@@ -248,13 +221,13 @@ Tests notification RPC methods via the in-process core and the Notifications UI- UI: Notifications page renders the integration notifications section (`[data-testid="integration-notifications-section"]`)- UI: Notifications page shows the System Events section (`[data-testid="system-events-section"]`)-**Run**:+Run it with:```bashbash app/scripts/e2e-run-spec.sh test/e2e/specs/notifications.spec.ts notifications```-**Platform note**: both the RPC calls and the UI assertions in this spec run inside the same `tauri-driver` session, which supports `browser.execute()`.+Both the RPC calls and the UI assertions in this spec run inside the same `tauri-driver` session, which supports `browser.execute()`.---@@ -279,13 +252,13 @@ For a canonical, inspectable run that drops screenshots, page-source dumps, andbash app/scripts/e2e-agent-review.sh```-Artifacts land in `app/test/e2e/artifacts/<timestamp>-agent-review/`. Full details + helper API: [`agent-observability.md`](agent-observability.md). Any failing test triggers `wdio.conf.ts`'s `afterTest` hook, which writes `failure-*.png` + `failure-*.source.xml` into the same run dir.+Artifacts land in `app/test/e2e/artifacts/<timestamp>-agent-review/`. Full details and the helper API: [`agent-observability.md`](agent-observability.md). Any failing test triggers `wdio.conf.ts`'s `afterTest` hook, which writes `failure-*.png` and `failure-*.source.xml` into the same run dir.---## Rust inference provider E2E-These tests (`tests/inference_provider_e2e.rs`) use **wiremock** to mock HTTP upstreams and require no live LLM API calls. They cover OpenAI-compat chat, Anthropic auth style, per-model temperature suppression, Ollama local provider, and the `/v1` HTTP endpoint auth layer.+These tests (`tests/inference_provider_e2e.rs`) use wiremock to mock HTTP upstreams and require no live LLM API calls. They cover OpenAI-compat chat, Anthropic auth style, per-model temperature suppression, Ollama local provider, and the `/v1` HTTP endpoint auth layer.```bash# Local:@@ -302,4 +275,4 @@ docker compose -f e2e/docker-compose.yml run --rm inference-e2e- [Testing strategy](testing-strategy.md): which layer a given test belongs in.- [Agent observability](agent-observability.md): the artifact flow the review run writes to.- [Tauri shell](architecture/tauri-shell.md): the Wry webview `tauri-driver` attaches to.-- [Building and installing OpenHuman](getting-set-up.md): toolchain and submodules a local E2E build needs.+- [Getting set up](getting-set-up.md): toolchain and submodules a local E2E build needs.