# openlatch-e2e
E2E test orchestrator for openlatch-client. Python CLI tool that validates the daemon, hooks, performance, and npm install path.
## Quick Start
### Local mode (against a running daemon)
```bash
# Terminal 1: start daemon
cargo run -- daemon start --foreground
# Terminal 2: run tests
cd tools/e2e
uv sync
# Token is auto-discovered from ~/.openlatch/daemon.token
uv run openlatch-e2e smoke
uv run openlatch-e2e hooks
uv run openlatch-e2e benchmark -n 100
```
### Docker mode (isolated containers)
```bash
# Build release binaries first
cargo build --release --bin openlatch
cargo build --release --bin openlatch-hook --no-default-features
# Run full suite
cd tools/e2e
docker compose run --build runner all --p95-gate 10
# Cleanup
docker compose down -v
```
### Live mode (real Claude Code, requires API key)
```bash
# No pre-build needed — the container compiles openlatch from source
# Run live test (costs ~$0.01 per run)
cd tools/e2e
ANTHROPIC_API_KEY=sk-ant-... docker compose --profile live run --build live
# Cleanup
docker compose --profile live down -v
```
This profile builds openlatch from source, installs Claude Code, and runs both in the same container. It executes `openlatch init` to wire up hooks, then runs Claude Code headless to trigger a real tool call. The test verifies that hook events flow through the daemon into the JSONL audit log. Cost is ~$0.01 per run (capped at $0.05).
## Commands
| `doctor` | Check prerequisites (Docker, ports, binaries) | No |
| `smoke` | Health, auth, content-type, body limit tests | Yes |
| `hooks` | Simulate all 3 Claude Code hook event types | Yes |
| `simulate` | Fire events from all 8 agent platforms | Yes |
| `benchmark` | Latency measurement with p95 gate | Yes |
| `install` | Verify npm package structure and JS shims | No |
| `all` | Run all commands sequentially | Yes |
## Global Flags
| `--container` | Running inside a container (targets `daemon:7443` instead of `localhost:7443`) |
| `--daemon-url URL` | Custom daemon URL |
| `--token TOKEN` | Bearer token (auto-discovered from `~/.openlatch/daemon.token`) |
| `--json` | JSON output for CI |
| `--verbose` | Show request/response details |
| `--quiet` | Pass/fail summary only |
## Adding a New Command
1. Create `openlatch_e2e/commands/mycommand.py` inheriting `BaseCommand`
2. Implement `name`, `help`, `configure_parser`, `execute`
3. Add to `ALL_COMMANDS` in `openlatch_e2e/commands/__init__.py`
4. Add to `COMMAND_SEQUENCE` in `openlatch_e2e/commands/all.py` if it should run in `all`
## CI
The `e2e-docker` job in `.github/workflows/pr-checks.yml` runs the full suite via Docker Compose on every PR. Results are uploaded as a GitHub Actions artifact.