Files
optimclaw/tests/e2e
a1f0208956 fix(ci): persist all cargo-llvm-cov env vars for E2E coverage (#559)
* fix(ci): persist all cargo-llvm-cov env vars for E2E coverage

Newer cargo-llvm-cov versions output CARGO_ENCODED_RUSTFLAGS instead of
RUSTFLAGS from show-env. The workflow was cherry-picking specific vars
(RUSTFLAGS, LLVM_PROFILE_FILE, etc.) to persist to $GITHUB_ENV, so
CARGO_ENCODED_RUSTFLAGS was never set during the build step, producing a
non-instrumented binary and zero .profraw files.

Replace the manual echo lines with `cargo llvm-cov show-env >> $GITHUB_ENV`
to forward all vars (including CARGO_ENCODED_RUSTFLAGS, CARGO_INCREMENTAL,
etc.) regardless of cargo-llvm-cov version.

Also forward CARGO_ENCODED_RUSTFLAGS in the E2E conftest subprocess env.

[skip-regression-check]

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix(ci): address PR review — prefix-based env forwarding, split clean step

- conftest.py: replace explicit env var list with prefix-based matching
  (CARGO_LLVM_COV*, LLVM_*) plus specific vars (CARGO_ENCODED_RUSTFLAGS,
  CARGO_INCREMENTAL) to stay resilient to cargo-llvm-cov changes.
- coverage.yml: move `cargo llvm-cov clean` to its own step so the env
  vars from show-env (persisted via $GITHUB_ENV) are active when clean runs.

[skip-regression-check]

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
2026-03-05 01:44:03 +00:00
..

IronClaw E2E Tests

Browser-level end-to-end tests for the IronClaw web gateway using Python + Playwright.

Prerequisites

  • Python 3.11+
  • Rust toolchain (for building ironclaw)
  • Chromium (installed via Playwright)

Setup

cd tests/e2e
pip install -e .
playwright install chromium

Build ironclaw

The tests need the ironclaw binary built with libsql support:

cargo build --no-default-features --features libsql

Run tests

# From repo root
pytest tests/e2e/ -v

# Run a single scenario
pytest tests/e2e/scenarios/test_chat.py -v

# With visible browser (not headless)
HEADED=1 pytest tests/e2e/scenarios/test_connection.py -v

Architecture

Tests start two subprocesses:

  1. Mock LLM (mock_llm.py) -- fake OpenAI-compat server with canned responses
  2. IronClaw -- the real binary with gateway enabled, pointing to the mock LLM

Then Playwright drives a headless Chromium browser against the gateway, making DOM assertions.

Scenarios

File What it tests
test_connection.py Auth, tab navigation, connection status
test_chat.py Send message, SSE streaming, response rendering
test_skills.py ClawHub search, skill install/remove

Adding new scenarios

  1. Create tests/e2e/scenarios/test_<name>.py
  2. Use the page fixture for a fresh browser page
  3. Use selectors from helpers.py (update SEL dict if new elements are needed)
  4. Keep tests deterministic -- use the mock LLM, not real providers