WebTest AI v2 beta

@asserthive/[email protected] is published under npm's beta tag. Use the documented exact version for this beta; the latest tag may point to an older beta.

Use WebTest AI with Cursor and Claude Code

Cursor Agent and Claude Code can invoke WebTest AI through its local MCP server or CLI. The coding agent decides when to call tools; WebTest AI owns browser execution, fixed success checks, evidence, limits, and the final test verdict. An agent's explanation does not replace the recorded result.

Install the published beta

Run these commands from your project root with Node 18 or newer:

npm install --save-dev --save-exact @asserthive/[email protected]
npx playwright install chromium
npx webtest-ai --version

The version command must print 0.2.0-beta.1. --save-exact persists this version as an exact dependency pin; the npm latest tag may point to an older beta. Playwright Chromium is used by the explicit MCP browser debug tools. The default CDP test runtime needs Chrome or Chromium and can use the Chromium downloaded by the command above; see commands and configuration for browser setup.

Separate the agent, navigator, and selector

Role or pathWhat it usesAccess required
Coding agent / orchestratorCursor Agent or Claude Code decides when to invoke WebTest AIThat product's login or plan, according to its terms
WebTest AI navigatorOllama or a configured OpenAI-compatible endpoint plans Goal actionsA configured local endpoint or the endpoint's API credential
Optional ambiguous-element selectorJev, OpenAI Decisions, or a configured selector profile chooses an observed elementIts credential, when required by the configured provider, only when configured and exact local resolution is insufficient
Credential-free pathsRecorder capture, exact-step tests, scripted demo, report inspectionNo Jev or OpenAI Decisions account required; local capture, exact steps, and fixtures need no model API credential

Cursor's selected model is not exposed as a navigator API for WebTest AI. Eligible Claude subscriptions can power Claude Code, but Anthropic Console/API access used by other software is separately configured and billed under current terms. Anthropic currently documents monthly API credits for some Max, Ultra, and Team plans; those credits still do not turn a Claude Code login or model selection into an API endpoint or credential for WebTest AI. Check the current Claude subscription and API billing terms.

For Goal tests, configure the navigator using model configuration. An optional selector resolves ambiguous targets; it does not replace the navigator or decide whether a test passes.

Connect Cursor

Add this server to .cursor/mcp.json in the project root, merging it with any existing mcpServers entries:

{
  "mcpServers": {
    "webtest-ai": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "--yes",
        "@asserthive/[email protected]",
        "mcp"
      ]
    }
  }
}

Project configuration applies to this workspace. Personal configuration at ~/.cursor/mcp.json makes the tools available across projects. Open Cursor at the project root, then reload the window or restart Cursor after changing configuration. Check Cursor's MCP settings for server status and enabled tools; inspect its MCP logs if the server cannot connect or tools are missing. See the official Cursor MCP documentation.

Connect Claude Code

From the project root, register the local stdio server:

claude mcp add --scope project --transport stdio webtest-ai -- \
  npx --yes @asserthive/[email protected] mcp
claude mcp list

The equivalent project .mcp.json is:

{
  "mcpServers": {
    "webtest-ai": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "--yes",
        "@asserthive/[email protected]",
        "mcp"
      ]
    }
  }
}

Merge this entry into an existing file rather than replacing other servers. Review the project configuration before trusting it. Interactive Claude Code sessions request approval for project MCP servers; non-interactive behavior differs, so do not rely on an approval prompt to make an untrusted project safe. Use claude mcp list to check connection health and /mcp inside Claude Code to inspect server status and tools. Restart the session after configuration changes if needed. These commands and approval rules are documented in the official Claude Code MCP guide.

Practical prompts

Replace the sample suite, config, and application URL with files and a running app in your project. These prompts name the actual MCP tools so the agent can distinguish test execution from exploration.

Review the contract first:

Parse specs/checkout.md with webtest-ai.spec.parse. Explain each test's fixed success checks and any required test data before running anything.

Run and diagnose:

Run specs/checkout.md with webtest-ai.run.suite, using webtest-ai.config.json as configPath. Read the returned report path with webtest-ai.report.summary and summarize failures from the report. Keep the original success checks unchanged.

Inspect evidence:

Open the latest report using webtest-ai.report.list and webtest-ai.report.summary. Use webtest-ai.report.test with that report and a test ID to inspect tool-call evidence. Follow nextOffset until the relevant calls are covered, and cite the recorded assertions and artifacts.

Explore explicitly:

Start an explicit browser debug session at http://127.0.0.1:3000 with webtest-ai.browser.start_session. Take webtest-ai.browser.snapshot using the returned sessionId, and show me the observed controls before clicking anything. Stop the session with webtest-ai.browser.stop_session when we finish.

Debug sessions are exploratory browser control. They do not create a suite pass verdict. Run the saved contract through webtest-ai.run.suite or the CLI to obtain a test result. Tool inputs and report resources are described in the MCP reference.

CLI fallback

Any coding agent with terminal access can use the same vendor-neutral commands:

npx webtest-ai run --suite specs/checkout.md --config webtest-ai.config.json
REPORT_PATH=artifacts/reports/Everyday_Goods-example.json
npx webtest-ai report export --report "$REPORT_PATH"

REPORT_PATH must point to a real generated report: replace the example with a JSON report path printed by the run. Exporting a report does not rerun the tests or publish it to another service.

Security and troubleshooting