For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /docs/testplane/index.md.

Testplane

@decoyhq/testplane is a Testplane plugin. It starts decoy for the run, gives each test its own Session, routes the browser's API calls to Decoy, and exposes the Control API as decoy(browser).

npm
pnpm
yarn
bun
npm install -D @decoyhq/cli @decoyhq/testplane

The setup is one plugins entry:

.testplane.conf.ts
import type { DecoyOptions } from '@decoyhq/testplane'
import type { ConfigInput } from 'testplane'

export default {
  gridUrl: 'local',
  baseUrl: 'http://127.0.0.1:4173',
  browsers: { chrome: { desiredCapabilities: { browserName: 'chrome' } } },

  plugins: {
    '@decoyhq/testplane': {
      command: 'decoy serve --config mocks/decoy.yaml',
      urls: '**/api/**', // browser requests sent to Decoy
      collection: 'happy-path', // each test's Session starts here
    } satisfies DecoyOptions,
  },
} satisfies ConfigInput

Next, switch responses in a test.

Options

optiondefaultmeaning
enabledtruefalse turns the plugin off without removing it
urlhttp://127.0.0.1:8080where Decoy serves
commanddecoy serveshell command the plugin runs when Decoy isn't up
cwdthe config file's directoryworking directory for command
reuseExistingServertrue locally, false in CIreuse a Decoy already answering health
timeout60000ms the plugin waits for health
urlsnoneglob (* in a segment, ** across) or RegExp, or a list
collectionDecoy's defaultCollection each test's Session starts on

A urls glob matches the full request URL, as in Playwright: * stays within a path segment, ** crosses them, and {api,graphql} matches either. It must start with * or a scheme ('**/api/**', 'http://localhost:3000/api/**'). The plugin throws on load for a glob like '/api/**', which could never match. Requests that match nothing go to the real network.

command runs with node_modules/.bin (from cwd up) on PATH. At the end of the run the plugin sends SIGTERM and, if Decoy hasn't exited after 8s, SIGKILL (Windows: taskkill /T /F).

Limits

  • Routing (urls) needs Chrome or Chromium: it uses CDP through browser.getPuppeteer(), in WebDriver Classic and BiDi (webSocketUrl: true) sessions alike. On other browsers each test fails with a clear error.
  • Testplane reuses a browser for many tests, so a request still in flight when a test ends can reach the next test's Session. Wait for your page to settle before a test ends.

The runnable version of all this is examples/testplane-ts-e2e.