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.
Feature table
Section titled “Feature table”| Tool | Record real traffic | Server-side (SSR) | Browser-side | WebSocket | Playwright-native | Latest release |
|---|---|---|---|---|---|---|
| test-proxy-recorder | Yes | Yes, through the proxy | Yes, through HAR | Yes | Yes | 1.3.1, 2026-08-05 |
Playwright routeFromHAR | Yes | No | Yes | No | Built in | Playwright 1.63.0, 2026-09-04 |
| MSW | No (handlers, or a HAR through @msw/source) | Inside the server process | Yes | Yes | @msw/playwright, browser requests | 3.0.2, 2026-10-03 |
| Polly.js | Yes | Inside the server process | Yes | Not documented | Third-party adapter | @pollyjs/core 6.0.6, 2023-07-20 |
| playwright-network-cache | Yes | No | Yes | Not documented | Yes | 0.3.0, 2026-05-12 |
| Mocky Balboa | No (handlers) | Yes | Yes | Not documented | Yes | @mocky-balboa/playwright 2.0.2, 2026-05-21 |
| Next.js test mode | No (handlers) | Yes, Next.js only | Requests to other origins | Not documented | Yes | Experimental, in Next.js 16.3.8, 2026-09-30 |
| mockttp | Not documented | Yes, as a forward proxy | Yes, as the browser’s proxy | Yes | No, a fixture you write | 4.6.3, 2026-09-11 |
| scenarist | No (scenarios in code) | Next.js and Express | No | Not documented | Yes | 0.5.1, 2026-09-27 |
| talkback | Yes | Yes, as the API’s address | Not documented | Not documented | No | 4.2.0, 2024-07-10 |
| proxay | Yes | Yes, as the API’s address | Yes, as the API’s address | Not documented | No | npm 1.9.0, 2024-05-15; GitHub 2.0.0, 2026-01-29 |
Sources and notes
Section titled “Sources and notes”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. Withupdate: trueit records a HAR from real traffic (Mock APIs). Replay serves “the network requests that are made in the page” (API). It goes throughroute()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/sourcecan 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 thewsAPI. The official@msw/playwrightbinding routes throughpage.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
httpandhttpsmodules, and the fetch adapter wraps the globalfetch. 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”.
CacheRouteintercepts withpage.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’sfetchcalls, plus the page’sfetchcalls 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-idon eachfetch(Next.js adapter), and@scenarist/playwright-helpersprovides 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 inbeforeEach, and the README does not cover parallel tests. Version 2.0.0 is a GitHub release; npm still serves 1.9.0.
Polly.js alternative for Playwright
Section titled “Polly.js alternative for Playwright”Polly.js, from Netflix, records, replays and stubs HTTP, and it inspired test-proxy-recorder. Its state on 2026-10-03:
@pollyjs/corehas had no release since 6.0.6 on 2023-07-20. The repository’s last change, on 2025-05-31, published@pollyjs/adapter-fetch6.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.js | test-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 persister | A .mock.json (server) and a .har (browser) per Playwright test, in the recordings directory |
| Adapters inside the process that makes the requests | A proxy process for server calls, HAR for browser calls, and registerProxyFetch() on the server |
| Requests matched by method, headers, body, order and URL by default | Server-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 |
MSW with Next.js and Playwright
Section titled “MSW with Next.js and Playwright”In a Next.js app, browser requests and server requests need different MSW setups.
- Browser requests.
@msw/playwright, the official binding, runs your handlers throughpage.route(), with anetworkfixture 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/sourceturns 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.
When to use something else
Section titled “When to use something else”- All your traffic is browser-side. Playwright’s built-in
routeFromHARneeds 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.proxyHostand-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.