---
title: "Test a frontend from local recording to Cloud replay | Speedscale Docs"
description: "Use the mock-lab demo shop to record a Playwright journey with proxymock, replay it with API mocks, tell a frontend failure from a mock gap, catch a backend change, heal a renamed button, and read the same runs in a Speedscale Cloud report."
canonical: "https://docs.speedscale.com/guides/browser-journeys/local-to-cloud/"
---

[Documentation index](https://docs.speedscale.com/guides/llms.txt) | [Markdown](https://docs.speedscale.com/guides/browser-journeys/local-to-cloud/index.md) | [Canonical page](https://docs.speedscale.com/guides/browser-journeys/local-to-cloud/)

# Test a frontend from local recording to Cloud replay

This walkthrough uses the [browser journeys lab](https://github.com/speedscale/mock-lab/tree/main/labs/browser-journeys) in mock-lab: a one-page shop whose **Load items** and **Next page** buttons call a separate API. You replay its Playwright journeys with the API answered from a recording, read two failures that look alike, catch a backend change, heal a renamed button, and run the same journeys in a cluster with a Speedscale Cloud report. The blog post [Playwright end-to-end testing with recorded API mocks](https://speedscale.com/blog/playwright-tests-with-recorded-api-mocks/) tells the same story with more background, and [Generate and heal Playwright tests](https://speedscale.com/blog/generate-and-heal-playwright-tests/) goes deeper into heal.

<a id="start-the-lab"></a>

## Start the lab

Use Node.js 22 or newer, make, and [an installed and initialized proxymock CLI](https://docs.speedscale.com/proxymock/getting-started/installation/).

```bash
git clone https://github.com/speedscale/mock-lab.git
cd mock-lab/labs/browser-journeys
make install
```

`make install` installs `@playwright/test` and Chromium in the lab directory, where proxymock finds them. Start the frontend and leave it running:

```bash
make site
```

The shop loads on `http://localhost:3000`. Its API runs on `http://api.localtest.me:8081`, a public name that resolves to `127.0.0.1`, so the API has its own origin. If your network blocks that answer, add `127.0.0.1 api.localtest.me` to `/etc/hosts`.

![The lab's demo shop after a click on Load items: the heading Demo shop SPA, the Load items and Next page buttons, and the items apple and pear](https://docs.speedscale.com/assets/images/lab-shop-e7c0236cfa3ed231ed3f55e3b454ce70.png)

> **Coding agent prompt**
> 
> Clone speedscale/mock-lab into a scratch directory, run `make install` in `labs/browser-journeys`, and start `make site` in a managed background process. Check that `http://localhost:3000` serves the shop. Keep the API on port 8081 stopped.

<a id="record-a-journey"></a>

## Record a journey

The lab ships a recording in `proxymock/recording`, so you can skip this step. To record your own, start the API with `make api` in a second terminal, then run:

```bash
make record
```

This runs `proxymock record --browser http://localhost:3000`, which opens Chromium with Playwright's code generator. Click **Load items**, then close the window. proxymock writes the API calls and a generated journey under `proxymock/my-recording`. The browser sends every request through the recording proxy, including the CORS preflight before the cross-origin `GET /items`. Open the recording to check it:

```bash
proxymock web --in proxymock/recording
```

![proxymock web's Requests grid for the lab recording: two outbound calls to api.localtest.me /items, an OPTIONS preflight answered 204 and a GET answered 200, plus the page load and favicon from localhost](https://docs.speedscale.com/assets/images/lab-recording-989a201e8b287e05782f2267aedc2af9.png)

The generated spec clicks but asserts nothing. `journeys/items.spec.ts` is the same click with a named step and an expectation. Add `RECORDING=proxymock/my-recording` to the make commands below to use your own recording, and stop the API before the next step.

<a id="replay-with-the-api-stopped"></a>

## Replay with the API stopped

Start the mock server in a second terminal:

```bash
make mock
```

It runs `proxymock mock --in proxymock/recording --no-passthrough`, so a call the recording cannot answer gets a 404 instead of reaching a real host. In a third terminal, replay the journey:

```bash
make replay
```

```text
  ✓ shopper loads the item list (items.spec.ts:3) 272ms

Browser journeys: 1 passed, 0 failed, 0 skipped
Web vitals (p95 across journeys): LCP 32ms, FCP 32ms, TTFB 8.8ms, CLS 0
```

The journey passes with nothing listening on port 8081. `make replay` runs `proxymock replay --browser journeys --test-against http://localhost:3000 --browser-proxy http://localhost:4140`: `--test-against` is the frontend, and `--browser-proxy` sends the browser's API calls to the mock server.

<a id="tell-two-failures-apart"></a>

## Tell two failures apart

`journeys-failing/` adds two journeys that fail on purpose. With the site and the mock server still running:

```bash
make replay-failing
```

```text
  ✓ shopper loads the item list (items.spec.ts:3) 177ms
  ✗ shopper sees a checkout button (checkout.spec.ts:5) 3.189s
      Error: expect(locator).toBeVisible() failed
  ✗ shopper pages through the items (next-page.spec.ts:4) 3.159s
      Error: expect(locator).toHaveText(expected) failed
      not in the recording: GET http://api.localtest.me:8081/items?page=2

Browser journeys: 1 passed, 2 failed, 0 skipped
```

Both journeys are red, but the evidence differs. **shopper sees a checkout button** made only calls the recording answered, so the page itself has no Checkout button. **shopper pages through the items** made a call the recording does not have. Open `proxymock web --in proxymock` and pick the run under **Run**. The **Report** view sorts each failure into its likely cause, and the **Journeys** view shows each step with the calls it made.

![proxymock web's Report view for the failing run: 2 failures, one App regression for shopper sees a checkout button and one Mock gap for shopper pages through the items](https://docs.speedscale.com/assets/images/lab-failure-causes-d78b66bd6e7b32d7ace53e43494ef049.png)

<a id="catch-a-backend-change"></a>

## Catch a backend change

Now send the same journey to the real API and compare its answers with the recording. Stop `make mock`, then start the API and the mock server in observe mode in two terminals:

```bash
make api
```

```bash
make mock-real
```

`make mock-real` runs `proxymock mock --in proxymock/recording --observe-real-apis`. `make replay` passes. Now stop `make api` and start the API with a field renamed:

```bash
make api-changed
```

```bash
make replay
```

With the frontend unchanged, the journey fails and names the call:

```text
  ✗ shopper loads the item list (items.spec.ts:3) 5.21s
      answered differently from the recording: GET http://api.localtest.me:8081/items (Body JSON)
Browser journeys: 0 passed, 1 failed, 0 skipped
```

In proxymock web, the **Journeys** view puts the changed call under the click that made it, and the failed expectation shows the list rendered `undefined` for each item.

![proxymock web's Journeys view for the run against the changed API: the expectation received undefined twice instead of apple and pear, and under the click on Load items the call GET http://api.localtest.me:8081/items is flagged as answered differently from the recording (Body JSON)](https://docs.speedscale.com/assets/images/lab-real-api-changed-78964e2a4c281e09147b93b866a16851.png)

Stop the API and the mock server when you finish. `make verify-local` runs the last three sections in one go and checks each result.

> **Coding agent prompt**
> 
> In the browser journeys lab, run the mocked replay, the failing replay, and the observe-mode replay against `make api-changed`. For each failed journey, report whether a call was missing from the recording, answered differently by the real API, or not involved, and quote the line proxymock printed.

<a id="heal-a-renamed-button"></a>

## Heal a renamed button

A redesign that renames a button breaks the journey's locator even though the flow still works. Heal compares against a run where the journey passed. Save one in a fresh folder: with the API stopped, start `make mock`, then run:

```bash
proxymock replay --in proxymock/recording --browser journeys \
  --test-against http://localhost:3000 --browser-proxy http://localhost:4140 \
  --out proxymock/results/heal-baseline
```

The journey passes. Stop the mock server. `make replay` adds every run to `proxymock/results/journeys`, which is why the baseline gets a folder of its own.

Now change the text of the button with `id="load"` in `app/site/index.html` from **Load items** to **Load shop items**, and restart `make site`. Ask proxymock to repair the journey against the passing run:

```bash
proxymock journeys heal --in proxymock/recording --browser journeys \
  --url http://localhost:3000 --baseline proxymock/results/heal-baseline
```

```text
shopper loads the item list (items.spec.ts): healed
  failed step: Click getByRole('button', { name: 'Load items' }) at items.spec.ts:8
  the journey passes and makes the same API calls as in the run where it last passed
  tried page.getByRole('button', { name: 'Load shop items', exact: true }): accepted
  - await page.getByRole('button', { name: 'Load items' }).click();
  + await page.getByRole('button', { name: 'Load shop items', exact: true }).click();
  checked against proxymock/results/heal-baseline, where the journey made GET /items
Patch: journey-heal.diff
```

Heal accepts a locator only when the journey passes with it and makes the same API calls as in the passing run. It changes nothing until you apply `journey-heal.diff` with `git apply` or run heal again with `--write`, and with `--pr` it opens a pull request instead. Leave the patch unapplied here: put the button text back to **Load items** and restart `make site` before you continue. See [Explore and heal journeys](https://docs.speedscale.com/guides/browser-journeys/explore-and-heal/#heal-a-journey-whose-element-moved).

<a id="read-the-runs-in-speedscale-cloud"></a>

## Read the runs in Speedscale Cloud

The lab can create a disposable minikube cluster with the released Speedscale operator and deploy the shop and its API. It needs minikube, a container runtime with about 6 GB free, kubectl and helm, plus your API key:

```bash
export SPEEDSCALE_API_KEY=<key>
make up
```

Run the failing journeys with the snapshot and report in Speedscale Cloud:

```bash
make cloud-failing
```

This runs `proxymock cluster replay start --browser journeys-failing --snapshot-source cloud` against `http://shop-spa.browser-journeys:80`. The recording and journeys are pushed as a snapshot, and a generator pod runs Chromium with a responder beside it that answers the frontend's API calls. The command prints a `report at:` link and returns before cloud analysis finishes, so wait for the report's status to change to **Passed** or **Missed Goals** before you open its **Journeys** tab.

![The Journeys tab of a Speedscale report with one passed and two failed journeys and p95 web vitals. The passed journey is expanded to show its steps, each with its category, duration and the number of calls it made](https://docs.speedscale.com/assets/images/lab-cloud-journeys-tab-18b8b00b036cc22e3fb20f2abfb52430.png)

Expand **shopper pages through the items**. The click on **Next page** names the call the recording could not answer, one step before the assertion times out.

![The failed journey expanded: under the click on Next page, the tab says Not in the recording, so the mock could not answer, and names GET http://api.localtest.me:8081/items?page=2. The expect step after it shows the failed assertion](https://docs.speedscale.com/assets/images/lab-cloud-failed-journey-08d53a3f68b4684c727bc00be18051f5.png)

Under a failed journey's steps are the screenshot Playwright took when it failed and the files it kept. **Open trace** replays the journey in Playwright's trace viewer inside the dashboard.

![A failed journey's files in the Journeys tab: the screenshot of the demo shop with no Checkout button, an Open trace button and downloads for the screenshot, error context and trace](https://docs.speedscale.com/assets/images/report-failed-journey-files-89dfbd3188da14dc11be72e9004a0977.png)

![The trace viewer open in the dashboard on the failed journey shopper sees a checkout button, with the action list, a snapshot of the page and the failed toBeVisible expectation](https://docs.speedscale.com/assets/images/report-trace-viewer-85a71cef6b1f29a4ca684b4f6596e8be.png)

Now change the API in the cluster and run with mocks off, so the report compares the real API's answers with the recording:

```bash
make change-api
make cloud-real
```

![The Journeys tab for the run with mocks off: under the click on Load items, GET http://api.localtest.me:8081/items is named as answered differently from the recording by the real API, with Body JSON as what differed](https://docs.speedscale.com/assets/images/lab-cloud-changed-call-93fbeece83e1357bd9d397964a8eaa97.png)

Restore the API with `make restore-api`, and remove the cluster with `make down` when you finish.

To start the same replay from the dashboard, open `/replay-launcher?snapshotId=<snapshot id>` with the snapshot id the command printed and pick **Browser journeys** under **Start from**; see [From the dashboard](https://docs.speedscale.com/guides/browser-journeys/run-in-cluster/#from-the-dashboard). To start it with a Speedscale Cloud login and no kubeconfig, use `proxymock cloud replay`, with `--cluster` set to the cluster's name in Speedscale Cloud:

```bash
proxymock cloud replay --in proxymock/recording --browser journeys-failing \
  --cluster "$DEMO_CLUSTER" -n browser-journeys \
  --target http://shop-spa.browser-journeys:80 --wait
```

Add `--no-mocks` to send the frontend's calls to the real API. See [Run journeys in a cluster](https://docs.speedscale.com/guides/browser-journeys/run-in-cluster/).

> **Coding agent prompt**
> 
> Run the lab's failing journeys in the cluster with a Speedscale Cloud report, then run them with mocks off after `make change-api`. From each report's Journeys tab, name the step and call behind every failure, and restore the API when you finish.

<a id="run-the-journeys-in-ci"></a>

## Run the journeys in CI

Copy `labs/browser-journeys` into a repository of its own. The proxymock GitHub Action and GitLab component run browser journeys when `browser` names the journeys directory. They answer the frontend's API calls from the recording, install the browsers, and keep the traces and screenshots with the job's artifacts. Install the lab's Playwright dependency first, so the browsers match it:

**GitHub**

```yaml
      - uses: actions/checkout@v4
      - run: npm ci
      - uses: speedscale/proxymock-action@v1
        with:
          api-key: ${{ secrets.SPEEDSCALE_API_KEY }}
          in: proxymock/recording
          app-command: node app/serve-site.js
          app-port: 3000
          browser: journeys
```

**GitLab**

```yaml
include:
  - component: gitlab.com/proxymock/ci/replay@1
    inputs:
      image: node:22
      in: proxymock/recording
      build-command: npm ci
      app-command: node app/serve-site.js
      app-port: 3000
      browser: journeys
```

`proxymock ci init github --in proxymock/recording --browser journeys --app-command "node app/serve-site.js" --app-port 3000` writes the workflow for you, and `gitlab` in place of `github` writes the GitLab job. Add `--dry-run` to print it first, or `--heal` to open a pull request with healed locators when a journey fails because its element moved. The same pipeline can review changed screenshots in a pull request, run against preview deployments, and report a check on the commit. See [Browser journeys in CI/CD](https://docs.speedscale.com/proxymock/guides/cicd/#browser-journeys).

<a id="go-further"></a>

## Go further

Each of these works with the lab's recording and journeys:

*   **Run more browsers and devices.** Add `--browser-engines chromium,firefox,webkit` or `--browser-devices "iPhone 15"`, retry flaky journeys, record video and shard across CI jobs. See [Playwright config and run settings](https://docs.speedscale.com/guides/browser-journeys/playwright-config/).
*   **Scan for accessibility problems.** Install `@axe-core/playwright` and add `--browser-a11y` to scan every page the journey shows. Add `--browser-a11y-fail-on serious` to fail the journey on serious violations. See [Accessibility scans](https://docs.speedscale.com/guides/browser-journeys/playwright-config/#accessibility-scans).
*   **Compare screenshots.** Add `toHaveScreenshot()` to the step and review changed images in a pull request. See [Screenshots and ARIA snapshots](https://docs.speedscale.com/guides/browser-journeys/playwright-config/#screenshots-and-aria-snapshots).
*   **Track flaky journeys.** `proxymock journeys history` ranks journeys by how often they pass, and `proxymock journeys quarantine` stops a flaky one from failing the run. See [Compare runs](https://docs.speedscale.com/guides/browser-journeys/run-locally/#compare-runs) and [Quarantine flaky journeys](https://docs.speedscale.com/guides/browser-journeys/run-locally/#quarantine-flaky-journeys).
*   **Start signed in.** Reuse a storage state, mint fresh tokens, sign in as several roles, and fill authenticator codes, passkeys and single sign-on. See [Start signed in](https://docs.speedscale.com/guides/browser-journeys/write-journeys/#start-signed-in).
*   **Write journeys without a recorder.** Explore a recorded user session, describe a journey in plain language, or let a model recover from a moved element during the run. See [Explore and heal journeys](https://docs.speedscale.com/guides/browser-journeys/explore-and-heal/).
*   **Hand the work to a coding agent.** The proxymock MCP server's replay tools run journeys, and the `browser-journey-tests` skill teaches an agent to write them. See [From a coding agent](https://docs.speedscale.com/guides/browser-journeys/run-in-cluster/#from-a-coding-agent). The [Playwright gates lab](https://github.com/speedscale/mock-lab/tree/main/labs/playwright-gates) shows an agent porting an existing suite.
