---
title: Run tests in CI
description: "A GitHub Actions job that runs the Node and browser tests, and every fixture, matcher and mock of @webmcp-agents/testing in one table."
sidebar:
  label: CI and reference
related:
  - /testing
  - /reference/testing
---

The Node tests need nothing but Node. The browser tests need Playwright's Chromium, installed once per job.

## A complete example

```yml title=".github/workflows/test.yml"
# .github/workflows/test.yml
name: test
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with: { node-version: 24, cache: pnpm }
      - run: pnpm install --frozen-lockfile
      # Browser-mode tests run in Playwright's Chromium.
      - run: pnpm exec playwright install --with-deps chromium
      - run: pnpm exec vitest run
```

No test reaches a model or the network: `mockAdapter` and `mockModel` stand in for the model, so the job needs no
secret. End-to-end tests need the app running; add Playwright's `webServer` and a `playwright test` step for them.

## If a test fails only in CI

- **"left a tool call running"**: a call was started and never awaited. Await it, or abort it.
- **"left a tool registered"**: a tool registered with `registerWebTool` or `tools.mock` outside a component was not
  unregistered. Mocks are removed for you; your own registrations are yours.
- **Timing**: wait with `expect.poll` or `until`, never a fixed sleep. Motion is already reduced.

## Every fixture, matcher and mock

{/* Generated by apps/docs/scripts/generate-partials.mjs from the code: do not edit by hand. */}

| API | What it is |
|---|---|
| [`callTool`](/docs/reference/testing/call-tool) | Call a tool the way an agent would and get the result it would read. |
| [`events`](/docs/reference/testing/events) | Every AgentEvent from the start of the test, with helpers. |
| [Page helpers](/docs/reference/testing/helpers) | fixture, until, recordEvents, uniqueName, toolForm and the other small helpers. |
| [`mockAdapter`](/docs/reference/testing/mock-adapter) | A model-free AgentAdapter that plays a script and remembers what it did. |
| [`mockChatServer`](/docs/reference/testing/mock-chat-server) | An in-memory /api/chat for the real cloud adapter. |
| [`mockModel`](/docs/reference/testing/mock-model) | A scripted AI SDK model for createChatHandler: no provider key, no network. |
| [`mockTool`](/docs/reference/testing/mock-tool) | Register a page tool backed by a vi.fn spy. |
| [`mount`](/docs/reference/testing/mount) | Mount HTML or a React element into the page; removed after the test. |
| [openApp, runTool, listTools, parkedOn, confirm](/docs/reference/testing/playwright) | Drive a page's WebMCP tools from Playwright, the way an agent would. |
| [`redactor`](/docs/reference/testing/redactor) | A fresh page redactor per test, reset after it. |
| [`renderChat`](/docs/reference/testing/render-chat) | Render AgentChat for a test, open, with a mock adapter; with the sentinel catalog, every string the chat owns is a marker. |
| [`runs`](/docs/reference/testing/runs) | Every AgentRunEvent of the test, for the run matchers and privacy checks. |
| [chatRequest, readChatStream, withSession](/docs/reference/testing/server-requests) | Build /api/chat requests, read the streamed answer, carry a session. |
| [`@webmcp-agents/testing/setup`](/docs/reference/testing/setup) | The browser setup file: polyfill, reduced motion, deterministic ids, cleanup and leak checks. |
| [`spans`](/docs/reference/testing/spans) | Every browser span of the test, kept in memory, with flush() for the buffered ones. |
| [memoryExporter, spanTree](/docs/reference/testing/telemetry) | An in-memory span exporter for both sides of a trace, and spans as trees. |
| [`test`](/docs/reference/testing/test) | Vitest's test, extended with the kit's fixtures. |
| [`toBeOneTrace`](/docs/reference/testing/to-be-one-trace) | Every span belongs to one trace, with one root. |
| [`toBeToolError`](/docs/reference/testing/to-be-tool-error) | The tool result failed, with the expected error code when one is given. |
| [`toBeToolResult`](/docs/reference/testing/to-be-tool-result) | The tool result succeeded, and its text matches when an expected text is given. |
| [`toContainSensitive`](/docs/reference/testing/to-contain-sensitive) | One of the given values is somewhere in this sink; used negated to prove a secret leaks nowhere. |
| [`toHaveAnswered`](/docs/reference/testing/to-have-answered) | The run's answer contains or matches the expected text. |
| [`toHaveBeenOfferedTools`](/docs/reference/testing/to-have-been-offered-tools) | Every model step of the mock adapter was offered these tools. |
| [`toHaveCalledTool`](/docs/reference/testing/to-have-called-tool) | The run called the tool, with an input containing the given keys when given. |
| [`toHaveCalledTools`](/docs/reference/testing/to-have-called-tools) | The run called exactly these tools, in this order. |
| [`toHaveEventOrder`](/docs/reference/testing/to-have-event-order) | These event types happened in this order, others allowed between them. |
| [`toHaveFilled`](/docs/reference/testing/to-have-filled) | The agent's value went into a field, with the expected value when one is given. |
| [`toHaveFinishedWith`](/docs/reference/testing/to-have-finished-with) | The run ended this way, with this error code when given. |
| [`toHaveNoHardcodedText`](/docs/reference/testing/to-have-no-hardcoded-text) | The rendered chat shows no text that bypassed its messages catalog: only sentinel markers, punctuation, digits and the text you allow. |
| [`toHaveParked`](/docs/reference/testing/to-have-parked) | A tool waited for the person, with the expected prompt when one is given. |
| [`toHaveSpan`](/docs/reference/testing/to-have-span) | The spans include one with this name (or matching it) and these attributes. |
| [`toHaveStarted`](/docs/reference/testing/to-have-started) | A tool run started, for the named tool when one is given. |
| [`toHaveStructuredContent`](/docs/reference/testing/to-have-structured-content) | The tool result's structuredContent has these keys with these values. |
| [`toHaveYielded`](/docs/reference/testing/to-have-yielded) | The cursor got out of the person's way, for the given reason when one is given. |
| [`tools`](/docs/reference/testing/tools) | The page's tools as an agent reaches them: call, list, mock, settled. |
| [`user`](/docs/reference/testing/user) | Trusted input in a browser-mode test: confirm, moveOn, scroll, click, type. |
| [`webAgentsProject`](/docs/reference/testing/web-agents-project) | The two Vitest projects a WebMCP app needs, so a config is two lines. |
