mission-control/tests
HonzysClawdbot 2fe7785433
test: add gateway health history e2e + utility unit tests
* fix: show all agents in command select, disable those without active session

Previously the agent select in the OrchestrationBar only listed agents
with a session_key set (agents.filter(a => a.session_key)), causing the
dropdown to appear completely empty when agents exist but none have an
active session. This was confusing — users thought no agents were
registered.

Fix: show all registered agents in the dropdown. Agents without an
active session_key are shown as disabled with a '— no session' suffix
and a tooltip explaining why they can't be messaged. The 'No agents
registered' placeholder is shown only when the agents array is truly
empty.

The send button remains correctly disabled when no valid agent is
selected.

Fixes #321

* test: add gateway health history e2e + utility unit tests

- Add tests/gateway-health-history.spec.ts: Playwright e2e tests for
  GET /api/gateways/health/history and POST /api/gateways/health
  covering auth guards, response shape validation, chronological
  ordering, and gateway name resolution.

- Add src/app/api/gateways/health/health-utils.test.ts: 30 vitest
  unit tests for the pure utility functions in the health probe route:
  ipv4InCidr, isBlockedUrl (SSRF protection), buildGatewayProbeUrl,
  parseGatewayVersion, and hasOpenClaw32ToolsProfileRisk.

All 30 unit tests pass. Covers the health history feature introduced
in feat(gateways): add health history logging and timeline (#300).
2026-03-14 16:39:02 +07:00
..
fixtures/openclaw merge: resolve PR conflicts and add OpenClaw offline E2E harness 2026-03-04 23:11:59 +07:00
README.md merge: resolve PR conflicts and add OpenClaw offline E2E harness 2026-03-04 23:11:59 +07:00
actor-identity-hardening.spec.ts fix(security): enforce server-side actor identity (#224) 2026-03-06 01:28:15 +07:00
agent-api-keys.spec.ts fix(security): enforce server-side actor identity (#224) 2026-03-06 01:28:15 +07:00
agent-attribution.spec.ts fix(agents): enforce attribution scope and add e2e coverage 2026-03-05 12:39:53 +07:00
agent-comms.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
agent-costs.spec.ts feat(costs): add task-level token attribution and task-cost rollups 2026-03-05 14:04:29 +07:00
agent-diagnostics.spec.ts fix(agents): enforce diagnostics self-scope and validation 2026-03-05 12:12:32 +07:00
agent-evals.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
agent-model-config.spec.ts fix(ui): null-safe trim calls in agent model config (#329) 2026-03-14 14:18:03 +07:00
agent-optimize.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
agent-self-register.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
agents-crud.spec.ts test: add 94 E2E tests covering all CRUD routes + fix middleware location 2026-03-02 02:21:10 +07:00
alerts-crud.spec.ts test: add 94 E2E tests covering all CRUD routes + fix middleware location 2026-03-02 02:21:10 +07:00
api-index.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
auth-guards.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
channels-api.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
chat-session-prefs.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
cron-operations.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
csrf-validation.spec.ts feat: scope workflows and webhooks to workspace (#132) 2026-03-04 09:28:43 +07:00
delete-body.spec.ts test: add 52 Playwright E2E tests covering all critical fixes 2026-02-27 15:38:49 +07:00
device-identity.spec.ts feat: Ed25519 device identity for WebSocket challenge-response handshake (#85) 2026-03-03 14:30:25 +07:00
device-management.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
diagnostics-api.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
direct-cli.spec.ts feat: aggregate token usage from db with stable agent grouping 2026-03-03 21:06:54 +07:00
docs-knowledge.spec.ts feat(docs): add docs knowledge APIs for issue 189 2026-03-05 15:06:06 +07:00
exec-approval-allowlist.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
gateway-config.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
gateway-connect.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
gateway-health-history.spec.ts test: add gateway health history e2e + utility unit tests 2026-03-14 16:39:02 +07:00
github-sync.spec.ts feat: add GitHub Issues sync (Phase 1, Issue #58) 2026-03-02 12:45:39 +07:00
helpers.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
i18n-language-switcher.spec.ts feat: full i18n — 1752 keys across 10 languages, all panels translated (#326) 2026-03-14 14:27:25 +07:00
injection-guard-endpoints.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
legacy-cookie-removed.spec.ts test: add 52 Playwright E2E tests covering all critical fixes 2026-02-27 15:38:49 +07:00
limit-caps.spec.ts test: add 94 E2E tests covering all CRUD routes + fix middleware location 2026-03-02 02:21:10 +07:00
local-agent-sync.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
login-flow.spec.ts fix(session-cookie): migrate to __Host- prefix for secure contexts (#294) 2026-03-12 12:32:53 +07:00
memory-knowledge.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
mentions.spec.ts feat: add validated @mentions for tasks and comments 2026-03-04 23:37:45 +07:00
notifications.spec.ts test: add 94 E2E tests covering all CRUD routes + fix middleware location 2026-03-02 02:21:10 +07:00
onboarding-api.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
openapi.spec.ts feat: add OpenAPI 3.1 documentation with Scalar UI 2026-03-02 11:03:16 +07:00
openclaw-harness.spec.ts merge: resolve PR conflicts and add OpenClaw offline E2E harness 2026-03-04 23:11:59 +07:00
project-agents.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
projects-crud.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
quality-review.spec.ts test: add 94 E2E tests covering all CRUD routes + fix middleware location 2026-03-02 02:21:10 +07:00
rate-limiting.spec.ts feat: scope workflows and webhooks to workspace (#132) 2026-03-04 09:28:43 +07:00
search-and-export.spec.ts test: add 94 E2E tests covering all CRUD routes + fix middleware location 2026-03-02 02:21:10 +07:00
security-audit.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
security-scan-api.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
session-controls.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
sessions-continue.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
skills-crud.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
skills-registry.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
task-comments.spec.ts fix(security): enforce server-side actor identity (#224) 2026-03-06 01:28:15 +07:00
task-outcomes.spec.ts feat(tasks): add outcome tracking and feedback analytics 2026-03-05 14:17:21 +07:00
task-queue.spec.ts feat(tasks): add agent queue polling endpoint 2026-03-05 13:22:12 +07:00
task-regression.spec.ts feat(metrics): add task regression trend endpoint 2026-03-05 18:49:05 +07:00
tasks-crud.spec.ts test(tasks): replace external repo fixture with neutral local slug 2026-03-12 15:15:55 +07:00
tenant-workspaces.spec.ts feat(refactor): ready for manual QA after main sync (#274) 2026-03-11 19:09:24 +07:00
timing-safe-auth.spec.ts test: add 52 Playwright E2E tests covering all critical fixes 2026-02-27 15:38:49 +07:00
user-management.spec.ts feat: audit hardening, webhook retry, and local Claude session tracking (#68) 2026-03-02 22:17:35 +07:00
webhooks-crud.spec.ts test: add 94 E2E tests covering all CRUD routes + fix middleware location 2026-03-02 02:21:10 +07:00
workflows-crud.spec.ts test: add 94 E2E tests covering all CRUD routes + fix middleware location 2026-03-02 02:21:10 +07:00
workload-signals.spec.ts fix(workload): harden signal recommendations and add route e2e coverage 2026-03-05 12:35:01 +07:00

README.md

E2E Tests

Playwright end-to-end specs for Mission Control API and UI.

Running

# Start the dev server first (or let Playwright auto-start via reuseExistingServer)
pnpm dev --hostname 127.0.0.1 --port 3005

# Run all tests
pnpm test:e2e

# Run offline OpenClaw harness (no OpenClaw install required)
pnpm test:e2e:openclaw

# Run a specific spec
pnpm exec playwright test tests/tasks-crud.spec.ts

Test Environment

Tests require .env.local with:

  • API_KEY=test-api-key-e2e-12345
  • MC_DISABLE_RATE_LIMIT=1 (bypasses mutation/read rate limits, keeps login rate limit active)

OpenClaw Offline Harness

The harness runs Mission Control against fixture data and mock binaries/gateway:

  • fixtures: tests/fixtures/openclaw/
  • mock CLI: scripts/e2e-openclaw/bin/{openclaw,clawdbot}
  • mock gateway: scripts/e2e-openclaw/mock-gateway.mjs

Profiles:

  • pnpm test:e2e:openclaw:local - local mode (gateway not running)
  • pnpm test:e2e:openclaw:gateway - gateway mode (mock gateway running)

Spec Files

Security & Auth

  • auth-guards.spec.ts — All API routes return 401 without auth
  • csrf-validation.spec.ts — CSRF origin header validation
  • legacy-cookie-removed.spec.ts — Old cookie format rejected
  • login-flow.spec.ts — Login, session, redirect lifecycle
  • rate-limiting.spec.ts — Login brute-force protection
  • timing-safe-auth.spec.ts — Constant-time API key comparison

CRUD Lifecycle

  • tasks-crud.spec.ts — Tasks POST/GET/PUT/DELETE with filters, Aegis gate
  • agents-crud.spec.ts — Agents CRUD, lookup by name/id, admin-only delete
  • task-comments.spec.ts — Threaded comments on tasks
  • workflows-crud.spec.ts — Workflow template CRUD
  • webhooks-crud.spec.ts — Webhooks with secret masking and regeneration
  • alerts-crud.spec.ts — Alert rule CRUD with full lifecycle
  • user-management.spec.ts — User admin CRUD

Features

  • notifications.spec.ts — Notification delivery and read tracking
  • quality-review.spec.ts — Quality reviews with batch lookup
  • search-and-export.spec.ts — Global search, data export, activity feed

Infrastructure

  • limit-caps.spec.ts — Endpoint limit caps enforced
  • delete-body.spec.ts — DELETE body standardization

Shared

  • helpers.ts — Factory functions (createTestTask, createTestAgent, etc.) and cleanup helpers