> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mcp-b.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Test native and polyfill behavior

> Run MCP-B conformance, transport, native browser, and Web Platform Test lanes.

Run these commands from the repository root. Choose the smallest lane that covers your change,
then run the broader suite before merging.

## Choose a repository test lane

| Change | Command |
| - | - |
| Package logic and React hooks | `pnpm test:unit` |
| Polyfill and declarative behavior | `pnpm --filter @mcp-b/webmcp-polyfill test --browser.headless` |
| Composed `@mcp-b/global` behavior | `pnpm --filter @mcp-b/global test:conformance:global` |
| Tab and iframe transports | `pnpm --filter mcp-e2e-tests test:runtime-contract:transport` |
| `<mcp-iframe>` element | `pnpm --filter mcp-e2e-tests test:mcp-iframe` |
| Repository native browser contract | `pnpm --filter mcp-e2e-tests test:native-contract` |
| Local relay | `pnpm --filter @mcp-b/webmcp-local-relay test:e2e` |
| Extension template | `pnpm --filter @mcp-b/webmcp-extension test:e2e` |
| Full local E2E set | `pnpm test:e2e` |

The runtime contracts cover discovery, invocation, dynamic registration and removal, and handler
errors through each real transport.

## Run browser conformance

Run the polyfill and composed global contracts together when you change registration,
discovery, lifecycle, or execution behavior:

```bash title="Run MCP-B browser conformance" theme={null}
pnpm --filter @mcp-b/webmcp-polyfill test --browser.headless
pnpm --filter @mcp-b/global test:conformance:global
```

Run the pinned upstream Web Platform Tests when you change behavior covered by WebMCP WPT:

```bash title="Run Web Platform Tests" theme={null}
pnpm test:wpt
pnpm test:wpt:idl
```

The WPT lane builds the standalone polyfill, disables the native implementation, injects the
bundle, and runs the repository's supported test selection. Read the repository's [testing
guide](https://github.com/WebMCP-org/npm-packages/blob/main/docs/TESTING.md) for browser and checkout
prerequisites. Compare failures with the public [WebMCP WPT
results](https://wpt.fyi/results/webmcp) and the [Community Group
draft](https://webmachinelearning.github.io/webmcp/).

## Run the native repository contract

Native lanes need Chrome 155 or later, the first release that accepts object input. Use the
repository commands instead of copying browser flags into another script:

```bash title="Run the native contract" theme={null}
pnpm --filter mcp-e2e-tests test:native-contract
pnpm --filter @mcp-b/global test:conformance:native
```

The checked-in [Playwright
configuration](https://github.com/WebMCP-org/npm-packages/blob/main/e2e/playwright-chrome-beta-webmcp.config.ts)
owns browser selection and feature arguments. If browser discovery fails, set `CHROME_BIN` to the
installed executable and rerun the command.

## Run integration coverage

Use the additional integration lanes when a change crosses package boundaries:

```bash title="Run integration suites" theme={null}
pnpm --filter mcp-e2e-tests test:integration:runtime-api
pnpm --filter mcp-e2e-tests test:integration:frameworks
```

Use a headed or interactive run to inspect a failing browser test:

```bash title="Debug browser tests" theme={null}
pnpm test:e2e:headed
pnpm test:e2e:ui
pnpm test:e2e:debug
```

## Test agent behavior separately

Repository contracts are deterministic. Use Chrome's [WebMCP evals
guide](https://developer.chrome.com/docs/ai/webmcp/evals) and the experimental [WebMCP Evals
tool](https://github.com/GoogleChromeLabs/webmcp-tools/tree/main/webmcp-evals) to measure tool
selection and argument quality. Run the [Lighthouse WebMCP schema validity
audit](https://developer.chrome.com/docs/lighthouse/agentic-browsing/webmcp-schema-validity) before
debugging model behavior.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.