How I test my frontend without an end-to-end environment
An end-to-end environment is a shared staging stack that every browser test talks to. It drifts. Someone reseeds the database, a backend deploy lands mid-run, a test account expires, and a frontend test fails although the frontend did not change.
This post shows how to replace that environment with a browser isolation test: your real frontend, driven by Playwright journeys, with every call behind it answered from a recording. You record the backend once. After that the test runs on a laptop, in CI or in a Kubernetes cluster with no backend connected.
You do not build it by hand. proxymock ships an agent skill, browser-isolation-test, that does the whole job from one prompt in your coding agent.
You need Node.js, a coding agent with shell access, a proxymock release that includes the browser-isolation-test skill, and a backend you can safely test against once, such as a local stack or staging. If your frontend has no tests yet, that is fine: the skill writes the journeys.
- A browser isolation test runs your real frontend with every API call answered from one recording, so it needs no end-to-end environment.
- proxymock’s
browser-isolation-testagent skill builds one from a single prompt: it ports or writes Playwright journeys, records the backend once, and proves the test passes with only the frontend reachable. - Freezing the browser clock breaks debounced requests. Start the clock at the recorded time and let the mock count times within five minutes of the recorded ones as a match instead.
- Running the skill on our own React and gRPC-web dashboard took six recording attempts and turned up five traps your app can hit too. The skill and proxymock now handle each one.
How a browser isolation test works
The frontend is the system under test, so its own pages and scripts load live. Everything the browser calls beyond that is answered from the recording, and anything the recording cannot answer fails the journey instead of reaching a real host.
flowchart TB
subgraph Record["1. Record once"]
direction LR
J1[Playwright journeys] --> B1[Browser]
B1 --> F1[Frontend]
B1 -->|API calls| R[Recorder]
R --> API[Live backend]
end
subgraph Replay["2. Replay anywhere"]
direction LR
J2[Same journeys] --> B2[Browser]
B2 --> F2[Frontend]
B2 -->|API calls| M[Mock: recording only]
M -.->|refused| X[Real hosts]
end
Record -->|recording + journeys| Replay
Two things make the replay repeatable. The browser’s clock starts at the time the recording was made, and its randomness (Math.random, crypto.randomUUID) is seeded, so requests that carry a time window or a client-made ID come out the same as they did in the recording.
Step 1: Install the skill
From your frontend’s repository, install proxymock’s skills for your coding agent. --client also takes codex, cursor and the other clients proxymock mcp install --help lists:
proxymock mcp install --client claude-code --skills
The skills are also published in the speedscale/skills repository, and the agent skills page covers every other way to install them.
LLM prompt for this step
Install proxymock's MCP server and bundled agent skills for this coding agent in the current project with `proxymock mcp install --client <your-agent> --skills`. Check `proxymock mcp install --help` first for the client name. Then run `proxymock mcp skills list` and confirm browser-isolation-test is listed. Report the commands you ran and anything you could not verify.
Step 2: Ask for an isolation test
Start the frontend and a backend that is safe to test against, then give your agent one prompt:
Use the browser-isolation-test skill to build an isolation test of this frontend. It runs with `npm run dev` on http://localhost:5173, our local backend is safe to record against, and the journeys must be read-only.
Before it runs anything, the skill asks once for what it cannot find out itself: how to start the frontend, which backend is safe to record against, whether journeys may write, which test account they sign in as, and where the test must replay. Answer in the prompt and it asks nothing.
Then it works through the job:
- Journeys. It reads your existing Playwright specs and ports them into a new directory, such as
e2e/isolation/, without touching your suite. With no specs, it writes five to ten journeys from the app’s routes. Each journey uses fixed test data, asserts through the page, and never calls the backend itself. It runs them three times against the live app and drops any that fail once. - Third-party scripts. It lists every host that is neither the frontend nor its API, such as tag managers, ad pixels, analytics, RUM and web fonts, and blocks them. Their beacons carry IDs and timestamps nothing controls.
- Sign-in. An identity provider’s login carries values that change every run, so the journeys start signed in from a storage state, or through a sign-in that needs no identity provider.
- Recording. It records the backend once while the journeys run, keeps only the API calls, and stores the journeys inside the recording.
- Proof. It replays three times with the backend stopped, then breaks the replay on purpose to show the gate fails and names each call the recording could not answer.
When a replay misses, the skill reads each “not in the recording” line and fixes the cause: a random value in a spec, a host that skipped the proxy, a same-origin stream. Under the hood it runs proxymock journeys record and proxymock replay. The isolation test guide covers those commands and each setting if you want to run them by hand.
Step 3: Run it in CI and Kubernetes
The skill leaves two things to commit: the recording, such as proxymock/recorded-app, and its test config, recorded-app-isolation. It also adds proxymock/ to your formatter ignores, because a pre-commit hook that rewrites Markdown will rewrite the recording too.
CI needs no agent. One command replays the test and exits 1 when a journey fails or a call misses the recording:
proxymock replay --in proxymock/recorded-app --test-config recorded-app-isolation
For a Kubernetes cluster, tell the skill where the frontend’s image runs and it starts the replay there. The browser’s calls go to a responder beside the frontend, which answers every host from the recording and refuses the rest. The cluster needs a Speedscale release with isolation support. It can also push the recording to Speedscale cloud as a snapshot, with the journeys and test config attached.
LLM prompt for this step
Add a CI job that starts this frontend and runs `proxymock replay --in proxymock/recorded-app --test-config recorded-app-isolation`, failing the job on a non-zero exit. Check `proxymock replay --help` and `proxymock ci init --help` first. Run the command once locally with the backend stopped and report the journeys passed, browserMockMissCount and the exit code, and anything you could not verify.
What running it on our own dashboard taught us
I ran the skill on our own dashboard, a React app on Vite that talks gRPC-web to its API. Five read-only journeys took six recording attempts before the isolation test passed. Two failures were ours (a proxymock flag bug and a sloppy locator). Four were traps any frontend can hit, plus one more found after the run, and proxymock now handles each of them:
- A frozen clock stalls debounced requests. Playwright’s
setFixedTimemakesDate.now()“return fixed fake time at all times” while timers keep running. Debounce or scheduling code that comparesDate.now()before and after a delay never fires, so the services list never loaded. The fix is a clock that runs from the recorded time, plus a mock that counts times within five minutes of the recorded ones as equal, in JSON bodies, query parameters and protobuf timestamps. - The dev server’s hot reload socket is same-origin. A Vite dev server’s
ws://<frontend-host>/?token=…socket looks like a backend stream to a rule that refuses unanswered same-origin streams. It is part of the frontend, so proxymock now lets it through, along with the Next.js and Angular CLI sockets. webpack-dev-server’s default/wshas to be named in the test config’sisolation.frontendSockets, because plenty of apps use/wsfor their own backend socket. - gRPC-web carries its status in the body. The gRPC-web protocol encodes the response status “as part of the response body”, as a final frame with the top bit of the flag byte set. A mock that replays only the message makes the client fail with
missing trailers. The mock reported zero misses while the table stayed empty, so read the console when a page renders nothing. - The journey ended before the page did. Detail pages fire calls as the last assertion passes. The live backend had not answered before the browser closed, so the recording lacked them. Each journey now waits for recently started calls to finish, in the recording and every replay.
- Prettier rewrote the recording. The repository’s pre-commit hook turned
### REQUEST ###into### REQUEST, and the recording stopped parsing. proxymock now reads both forms; keep the ignore anyway.
Attempt six passed: five of five journeys, 200 API calls answered from the recording and zero misses. With the dashboard’s API proxy pointed at a dead port it passed three runs out of three, and moving the clock to January 1 failed it with each mismatched call named. For the same workflow on a smaller app with screenshots, see Playwright end-to-end testing with recorded API mocks. To find out which API broke a failing journey, read browser tests that know which API broke, and to repair journeys after a UI change, generate and heal Playwright tests.
Run this workflow with an LLM
Whole-workflow LLM prompt
Read https://speedscale.com/blog/how-i-test-my-frontend-without-an-end-to-end-environment/ and this repository's own contributor instructions first. Install proxymock's agent skills for this agent, then use the browser-isolation-test skill to build an isolation test of this frontend at <frontend-url>, recording against a backend I confirm is safe to test against, with read-only journeys signed in as <test-account>. Then add a CI job that runs the replay command the skill reports. Check each proxymock command's --help before running it. Report the result of every check, and anything you could not verify.
Frequently asked questions
Can I run Playwright tests without a backend or a staging environment?
Yes. Run the journeys once against a live backend through proxymock, which keeps the API calls as a recording. The browser-isolation-test agent skill does this for you. Every replay after that answers the frontend's calls from the recording, so the backend can be stopped.
Why do browser tests miss their mocks when the app asks for the last 15 minutes?
The window comes from Date.now(), so the request differs on every run. An isolation test starts the browser clock at the recorded time, and the mock counts times within five minutes of the recorded ones as a match, so a replay that runs a few seconds faster or slower still matches.
Should I freeze the browser clock in Playwright for deterministic tests?
Usually not. Playwright's setFixedTime keeps Date.now() constant while timers keep running, and debounce code that compares Date.now() values then never fires. A clock that runs from a fixed start time, with tolerant matching on the mock side, keeps requests repeatable without stalling the app.
Does mocking work for gRPC-web frontends?
Yes, as long as the mock replays the trailer frame. gRPC-web sends the response status as the last frame of the response body, and a browser client rejects a response without it as missing trailers.