Skip to content

test-proxy-recorder vs MSW, routeFromHAR, Polly.js and Next.js test mode

Each tool here controls the API responses an end-to-end test sees. They differ in where they intercept requests (in the browser, inside your server, or in a separate proxy) and in whether you write the responses or record them. The table keeps the six tools from the docs overview and adds Next.js test mode, mockttp, scenarist, talkback and proxay. Every cell comes from the tool’s own docs, README or source, linked below the table, as of 2026-10-03. “Not documented” means those sources don’t say.

ToolRecord real trafficServer-side (SSR)Browser-sideWebSocketPlaywright-nativeLatest release
test-proxy-recorderYesYes, through the proxyYes, through HARYesYes1.3.1, 2026-08-05
Playwright routeFromHARYesNoYesNoBuilt inPlaywright 1.63.0, 2026-09-04
MSWNo (handlers, or a HAR through @msw/source)Inside the server processYesYes@msw/playwright, browser requests3.0.2, 2026-10-03
Polly.jsYesInside the server processYesNot documentedThird-party adapter@pollyjs/core 6.0.6, 2023-07-20
playwright-network-cacheYesNoYesNot documentedYes0.3.0, 2026-05-12
Mocky BalboaNo (handlers)YesYesNot documentedYes@mocky-balboa/playwright 2.0.2, 2026-05-21
Next.js test modeNo (handlers)Yes, Next.js onlyRequests to other originsNot documentedYesExperimental, in Next.js 16.3.8, 2026-09-30
mockttpNot documentedYes, as a forward proxyYes, as the browser’s proxyYesNo, a fixture you write4.6.3, 2026-09-11
scenaristNo (scenarios in code)Next.js and ExpressNoNot documentedYes0.5.1, 2026-09-27
talkbackYesYes, as the API’s addressNot documentedNot documentedNo4.2.0, 2024-07-10
proxayYesYes, as the API’s addressYes, as the API’s addressNot documentedNonpm 1.9.0, 2024-05-15; GitHub 2.0.0, 2026-01-29

Release dates come from the npm registry unless a GitHub release is linked.

  • test-proxy-recorder. Server-side calls go through the proxy and browser calls through HAR (how it works). Recorded WebSocket messages are replayed by the proxy (CLI). Release: npm.
  • Playwright routeFromHAR. With update: true it records a HAR from real traffic (Mock APIs). Replay serves “the network requests that are made in the page” (API). It goes through route() handlers that fulfil HTTP requests and has no WebSocket path (harRouter.ts). Release: v1.63.0.
  • MSW. You write request handlers. MSW records nothing itself, but @msw/source can generate handlers from a HAR file you export from the browser’s DevTools. In Node.js it runs inside the process that makes the requests (setupServer). WebSockets use the ws API. The official @msw/playwright binding routes through page.route(), so it covers browser requests. Release: v3.0.2.
  • Polly.js. Its repository describes it as “Record, Replay, and Stub HTTP Interactions”. The node-http adapter patches Node’s http and https modules, and the fetch adapter wraps the global fetch. Polly therefore records inside the process that runs it. Its docs list no WebSocket adapter. Playwright support is the third-party polly-adapter-playwright, which Polly’s docs link to. Release: npm.
  • playwright-network-cache. Its README says it speeds up Playwright tests “by caching network requests on the filesystem”. CacheRoute intercepts with page.route() (source), so it sees browser requests only. Release: npm.
  • Mocky Balboa. You define mocks in the test, for server and client requests through one API. Mocks stay isolated per test while tests run in parallel (features). For Next.js 14 and later, its CLI starts your Next.js server (Next.js). Its docs mention WebSocket only as the channel between your server and the test runner. Release: npm.
  • Next.js test mode. Handlers registered with next.onFetch() receive the server’s fetch calls, plus the page’s fetch calls to other origins (README, page-route.ts). Server-side mocking covers its setup, its status and MSW 3. Release: Next.js 16.3.8.
  • mockttp. An HTTP and HTTPS mock server and proxy for tests that run “in node or browsers” (README). forAnyWebSocket() mocks WebSocket connections (source). The README describes no record mode. The Playwright team’s post shows the fixture to write. Release: npm.
  • scenarist. The README says it is “Built on MSW with runtime scenario management and test ID isolation”, and you write the scenarios in code. Its FAQ says it “provides server-side scenario management, which complements Playwright’s client-side mocking”. Your server code forwards x-scenarist-test-id on each fetch (Next.js adapter), and @scenarist/playwright-helpers provides the Playwright fixture. Release: npm.
  • talkback. “A javascript HTTP proxy that records and playbacks HTTP requests” (README). Your app sends its requests to talkback. A request that matches a saved tape gets the tape’s response, and an unknown one is forwarded to the host and saved as a new tape. The README mentions neither browsers nor per-test tapes. Release: npm.
  • proxay. A record and replay proxy for “a web frontend and its backend” or “a server and another server” (README). Tests pick a tape with POST /__proxay/tape, for example in beforeEach, and the README does not cover parallel tests. Version 2.0.0 is a GitHub release; npm still serves 1.9.0.

Polly.js, from Netflix, records, replays and stubs HTTP, and it inspired test-proxy-recorder. Its state on 2026-10-03:

  • @pollyjs/core has had no release since 6.0.6 on 2023-07-20. The repository’s last change, on 2025-05-31, published @pollyjs/adapter-fetch 6.0.7, which lifted the fetch adapter’s deprecation for Node (Netflix/pollyjs#506).
  • Polly has no Playwright adapter of its own. Its docs point to the third-party polly-adapter-playwright, which attaches to a browser context or page. Its last release, 2.4.0, was on 2024-04-18.
  • For server-side calls, Polly has to run inside the server process, through its node-http or fetch adapter.

If you’re moving from Polly.js, its concepts map to test-proxy-recorder as follows.

Polly.jstest-proxy-recorder
Modes record, replay and passthrough (configuration)Modes record, replay and transparent, set per test by playwrightProxy.before()
A named recording per Polly instance, saved by a persisterA .mock.json (server) and a .har (browser) per Playwright test, in the recordings directory
Adapters inside the process that makes the requestsA proxy process for server calls, HAR for browser calls, and registerProxyFetch() on the server
Requests matched by method, headers, body, order and URL by defaultServer-side requests matched by method, path, a hash of the query and the body, with repeats served in recorded order and headers not compared. Browser requests matched by method, URL and body, then by shared headers

In a Next.js app, browser requests and server requests need different MSW setups.

  • Browser requests. @msw/playwright, the official binding, runs your handlers through page.route(), with a network fixture you can change per test.
  • Server requests. MSW runs inside the Next.js process. MSW’s docs have no Next.js guide, and the reference example is an open pull request, mswjs/examples#101. Handlers you change at runtime are shared by every test that reaches that server. Server-side mocking has the details and sources.
  • Per-test server handlers. Next.js test mode takes MSW handlers per test, but its MSW entry point fails to load with MSW 3.0 (details). scenarist builds per-test scenarios on MSW for Next.js and Express, and your server code forwards a test id header on each fetch.
  • Recording. MSW does not record traffic. @msw/source turns a HAR file, exported from the browser’s DevTools, into handlers.

test-proxy-recorder makes the opposite trade. It records both sides from the real API, so there are no handlers to write. In return, you have less control over responses the API won’t produce on demand.

  • All your traffic is browser-side. Playwright’s built-in routeFromHAR needs no extra dependency. Start there, and add test-proxy-recorder when server-side requests show up.
  • You want to write responses by hand, or force errors and edge cases. MSW’s handlers fit that better, and MSW also runs in Vitest, Storybook and the browser, not only in Playwright. For per-test server-side handlers in Playwright, look at Mocky Balboa, scenarist or Next.js test mode.
  • You only need browser-side caching with little setup. playwright-network-cache caches responses on disk through one fixture.
  • Your server isn’t written in JavaScript, or you can’t change its code. A forward proxy such as mockttp works through HTTPS_PROXY. The Playwright team’s post says Python, Go, Ruby, Rust and .NET work the same way, and Java needs -Dhttps.proxyHost and -Dhttps.proxyPort.
  • You need record and replay outside Playwright, in any language. proxay and talkback are standalone HTTP servers that save recordings as tape files.