End-to-End Testing π‘ BETA
End-to-end suites drive the real browser through Chrome DevTools Protocol and keep evidence for every case.
Overview
End-to-end suites drive the real browser through Chrome DevTools Protocol using chromiumoxide in bottest; they do not require a WebDriver binary.
Complete Platform Flow Test
bottest/tests/e2e/platform_flow.rs covers platform loading, server readiness, authentication, chat interaction and logout. Other suites cover auth flow, dashboard, desktop-local chat and the Vibe workbench.
Test Phases
| Phase | What is asserted |
|---|---|
| Platform loading | The suite shell route responds |
| botserver initialization | /health becomes ready |
| User authentication | /api/auth establishes a session |
| Chat interaction | A message produces a bot reply |
| Logout | Session state is cleared |
Phase 1: Platform Loading
Open the desktop route (/ or /drive), not a suite HTML fragment; individual app pages are HTMX partials that need the shell (root AGENTS.md, Suite Apps).
Phase 2: botserver Initialization
Wait for health on the development port 8080. The desktop sidecar waits for /api/product before showing its window.
Phase 3: User Authentication
The chat socket opens only after /api/auth answers; an earlier socket carries empty identity fields (root AGENTS.md, gbgov Edition).
Phase 4: Chat Interaction
Send one message at a time, read the reply, then decide the next message. Never batch several fields into one script.
Phase 5: Logout & Session Management
Verify that session state is gone and that a fresh session starts with start.bas only once.
Running E2E Tests
- Start the stack and wait for health.
- Run the selected suite with
cargo test -p bottest --features e2e. - Read the evidence written by the harness.
- Stop the stack.
HTTP-Only Tests (No Browser Required)
Health and route contract checks can run without Chrome; they do not prove the UI works.
Platform loading verification
A status code alone is not UI evidence; the shell must render.
botserver startup verification
curl -s http://localhost:8080/health is the readiness gate.
Complete Flow Tests (Requires WebDriver)
The repository uses Chrome DevTools Protocol directly; a WebDriver server is not part of the documented flow.
WebDriver Setup
Use an existing Chrome with remote debugging on port 9222 and connect through CDP. One tab per active issue; recycle finished tabs and never close the browser.
Option 1: Local Installation
Start Chrome with --remote-debugging-port=9222 and a profile under /tmp.
Option 2: Docker
No Docker-based WebDriver is documented here; the harness speaks CDP.
Option 3: Docker Compose
No Compose-based WebDriver is documented here.
Environment Variables
Runtime configuration comes from the repository .env and the harness; only VAULT_* variables belong in .env.
Examples
Use the suite flags in bottest/src/cli/args.rs; do not invent an environment variable.
Show browser UI for debugging
Connect to the running Chrome instance rather than launching a second browser.
Use custom WebDriver
Not applicable: CDP is the transport.
Verbose logging
RUST_LOG=info is the normal level; trace is for a single reproduction.
Run single-threaded with output
Run a single named test when diagnosing a flaky case.
Test Helpers
The harness exposes a bot runner, conversation helper, fixtures and evidence writer; service modules start PostgreSQL, Valkey, OtterIO and the browser service.
Test Context
Each case runs against an isolated stack with its own ports and data.
Common Issues
| Symptom | Check |
|---|---|
| Browser not reachable | Chrome CDP listener and tab reuse |
| Port already in use | The harness port allocator and stale processes |
| Health never ready | Bootstrap and Vault seal state |
| No bot reply | Prompt files and tool registration |
WebDriver Not Available
Start Chrome with remote debugging; the harness does not install a driver for you.
Port Already in Use
Stop stale processes; do not kill a build that another agent is running.
Test Hangs or Timeout
Split the case into one-shot steps and read state between them; do not put polling loops in a browser script.
Browser Connection Issues
Re-locate the page at the start of each step; a previous step may have closed the tab.
Debugging
Take screenshots under /tmp, one action per script, and print the observed state after each step.
View Test Output
Read the harness report and the server log together.
Watch Browser in Action
Keep one tab per active issue visible in the shared Chrome instance.
Check Server Logs
Client errors are logged with a CLIENT: prefix; drive sync with [drive_monitor].
Performance
One build at a time, jobs = 3 from .cargo/config.toml. Do not block on a build; work on other files while it runs.
CI/CD Integration
CI runs the guards and suites; boteval runs on CI only and is never invoked locally.
GitHub Actions Example
Use the job shapes in .github/workflows/ci.yml rather than a copied snippet.
Temporary Stack Architecture (Future)
Plans live in issues; this page documents the harness that exists in bottest/src/.
Writing Custom E2E Tests
Add a test under bottest/tests/e2e/, use the harness fixtures, and keep browser interaction in one-step scripts.
Best Practices
- One action per browser script; print state and stop.
- No long polling loops, no sleeps longer than a few seconds.
- Never run a paid model locally; use the LLM mock.
- Keep screenshots out of the repository.
Test Success Criteria
A case passes only when its assertions and its evidence both show the expected behaviour.
See Also
Authority: bottest/tests/e2e/, bottest/src/web/, root AGENTS.md (Mandatory Browser Testing, Fragmented CDP Control).
Limits
bottestuseschromiumoxide/ CDP, not WebDriver or WebSocket scripts.- Boteval is CI-only; no local command spends model calls.
- Individual suite HTML files are fragments and must be opened through the desktop shell.
- Only the driver restarts botserver after a build.