Skip to content

Testing

Chat ships two test suites: a vitest-based set of standalone runtime tests and a vitest-based set of "connected" runtime tests, plus a Playwright config for browser-level e2e.

Test scripts

chat/package.json:

json
"test":            "pnpm test:standalone && pnpm test:connected",
"test:standalone": "vitest run --root . src/runtime/__tests__/resolve-chat-config.spec.ts src/runtime/__tests__/bind-chat-services.spec.ts src/runtime/__tests__/create-host-managed-chat.spec.ts",
"test:connected":  "vitest run --root . src/runtime/__tests__/chat-config-profiles.spec.ts",
"test:e2e":        "npx playwright test",
"type-check":      "tsc -p tsconfig.runtime.json --noEmit"

What's tested

src/runtime/__tests__/:

SpecWhat it covers
resolve-chat-config.spec.tsMode resolution, profile merging, config validation.
bind-chat-services.spec.tsService binding (CHAT_CONFIG_SERVICE_KEY), root resolution from bootstrap, target relativization.
create-host-managed-chat.spec.tsHost-managed mounting flow with a mock MatrixRuntime.
chat-config-profiles.spec.tsPer-profile config overrides (standalone-local vs connected vs daemon-hosted).

The split between standalone and connected runs corresponds to which transport assumptions the spec makes — standalone specs work with no transport, connected specs assume a remote-actor configuration.

What's not tested

Honest gaps:

  • No DOM-component tests. MatrixChatApp, ChatInput, ChatMessageList are not covered by automated specs in this package. (The element-level concerns are partly covered upstream in @open-matrix/core for MatrixActorHtmlElement semantics.)
  • No e2e in source. playwright.config.ts exists, but e2e/ directory holds legacy fixtures only. No committed Playwright spec exercises the full chat path.
  • No real system.agents integration test. All adapter tests use mocks. The cognitive proof loop is WORKSTREAMS/loose-ends/items/P1.11-cognitive-product-proof.md — open as of 2026-05-05.
  • No accessibility audit automation.
  • No streaming/cancel tests. The streaming path through on$Activity is not exercised directly.

Running specs

bash
cd projects/matrix-3/packages/chat
pnpm test:standalone           # runs three specs
pnpm test:connected            # runs profile spec
pnpm test                      # both

For a single spec:

bash
npx vitest run --root . src/runtime/__tests__/bind-chat-services.spec.ts

Running e2e

The Playwright config exists; the spec set is empty. To extend:

bash
cd projects/matrix-3/packages/chat
pnpm test:e2e

Today this likely runs zero tests. Adding e2e is a known gap.

Manual verification

Until automated UI tests land, manual verification follows the standard CLAUDE.md "END TO END TESTING" recipe:

  1. Start a Host with both Chat and @open-matrix/agents runtimes registered.
  2. Navigate to http://127.0.0.1:3100/apps/chat/.
  3. Check console for system.agents reachable, system.inference configured.
  4. Send a prompt to a known target. Verify activity frames render.
  5. Reload the page; verify the session resumes via session_state.read.

HTTP 200 is not proof; the console must show no NATS permission errors, no missing-service errors, and the prompt round-trip must complete.

Cross-package checks

Some bind-chat-services tests assert specific mount-rooting behavior that depends on @open-matrix/core resolving the same way Director does. If those tests fail, run pnpm install at the workspace root to refresh symlinks before debugging.

See also

Source: projects/matrix-3/packages/chat/package.json, chat/src/runtime/__tests__/, chat/playwright.config.ts.