# User journeys for load tests: Playwright scripts, dry runs, traffic mixes

[Docs](https://www.supervisor.com/docs)

## Journeys in the web app

How to write a journey in the web app, dry run it for free until every step passes, give it test accounts, and load test it alone or in a traffic mix.

[Download as Markdown](https://www.supervisor.com/docs/web-journeys.md)

A plain load test clicks links. That never reaches the things that matter most on many sites: search, add to cart, signing in. A journey is a short script that does those steps the way a visitor does, in a real browser. Load tests, monitors and accessibility checks can all run a journey.

## Open a site’s journeys

On the Load tests page, find the site under “Tested sites” and press Journeys. The same button is on the site’s history page.

![The journeys page of a site: one journey with its version and last dry run, and the form for load testing a journey or a traffic mix](https://www.supervisor.com/assets/docs/web/journeys-list.webp)

The page has everything about journeys for one site: the list, the load test form, monitors, test accounts and, for Shopify shops, the crawler signature.

## Write a journey

Press “New journey”, or Edit on an existing one.

![The journey editor: name, start URL, test accounts and a script with four named steps, with Save and Save and dry run buttons](https://www.supervisor.com/assets/docs/web/journey-editor.webp)

*   **Name** says what the journey does, for example “search and add to cart”. Up to 80 characters.
*   **Start URL** is the page the journey starts from. Its domain is the site that gets tested.
*   **Test accounts** is the set of logins the journey uses, or “None” when it does not sign in.
*   **Script** is the journey itself, written for Playwright. The editor colours the code and marks the line of an error.

This is the journey in the pictures. It opens the home page, the pricing page and the docs, then opens one guide at random.

```
export default async ({ page, user, step, base, pick }) => {
  await step('Home', async () => {
    await page.goto(base + '/');
    await page.waitForSelector('h1');
  });
  await user.think(1, 3);
  await step('Pricing', async () => {
    await page.goto(base + '/pricing');
    await page.waitForSelector('h1');
  });
  await user.think(1, 3);
  await step('Docs', async () => {
    await page.goto(base + '/docs');
    await page.waitForSelector('.doc-list');
  });
  await user.think(1, 3);
  await step('Open a guide', async () => {
    const guide = await pick(page.locator('.doc-list h3 a'));
    await guide.click();
    await page.waitForLoadState('load');
    await page.waitForSelector('article h1');
  });
};
```

You do not have to write the script yourself. An AI agent connected to Supervisor can write it, try it and fix it. See [Journey commands](https://www.supervisor.com/docs/journey-tools).

## What a script can use

“Script reference” under the editor lists the pieces.

![The script reference: a short example and the list of what a script can use](https://www.supervisor.com/assets/docs/web/script-reference.webp)

| Piece | What it does |
| --- | --- |
| `page` | Playwright’s page: `goto`, `click`, `fill`, `locator`, `waitForSelector` and the rest. Only your own site can be opened. |
| `step(name, fn)` | A named, timed step. Results show each step’s time and failures. A step may take 60 seconds at most, and a journey can have 50 step names. |
| `base` | The start URL’s origin, such as `https://www.example.com`. |
| `user.think(min, max)` | Waits a random time in seconds, like a person reading. |
| `pick(locator)` | Picks one of the matching elements at random, so users do not all click the same product. |
| `chance(0.3)` | True in about 30% of rounds, for steps that only some visitors take. |
| `between(a, b)` | A random number. |
| `explore({ pages })` | Clicks a few random links on the site, like a user of a plain load test. |
| `user.account` | This user’s test account: username, password and any extra values. |
| `user.index`, `user.uniqueEmail()` | The user’s number, and a fresh email address for sign-up forms. |
| `export async function setup` | Runs once per user before the rounds begin. Sign in here, and the user stays signed in. |

Each round is a new visitor: cookies are cleared before it, unless the journey has a `setup`. A script cannot open other domains, new tabs or popups, download or upload files, or import other code. It can be up to 100 KB.

## Dry run

“Save and dry run” runs the journey once in one real browser and reports every step. It is free and takes at most 3 minutes.

![A passed dry run: all 4 steps passed, with the time of each step and the guide that was picked at random](https://www.supervisor.com/assets/docs/web/dry-run-passed.webp)

*   **Passed or failed** is at the top, with a sentence that says which step failed.
*   **Each step** has its time. A step that picked something at random says what it picked.
*   **A failed step** shows the error, the address it was on and a screenshot of the browser at that moment. The editor marks the line.
*   **Page loads** lists every page the journey loaded with its load time.
*   **Seed** repeats the random choices of an earlier run. If a run failed only because of the product it picked, enter the same seed to see it again.

Dry run until every step passes. An organization gets 30 dry runs a day.

## Test accounts

Journeys that sign in need logins. Add them under “Test accounts” on the journeys page.

![The test accounts form: a name, how accounts are assigned, and a box for one account per line](https://www.supervisor.com/assets/docs/web/test-accounts.webp)

*   **Name** is how the journey refers to the set, for example `customers`.
*   **Assign** decides who gets which account. “One account per user” needs as many accounts as the test has users. “All users share the accounts” is for sites that let one account be signed in many times at once.
*   **Accounts** go one per line: `username,password`, with optional extras such as `phone=+358401234567`.

Passwords are stored encrypted and never shown again. Saving under an existing name replaces all of its accounts. Use accounts made for testing, never real customers’ accounts, and never write a password into a script.

## Load test a journey or a traffic mix

Real traffic is a mix: most visitors browse, some search, a few buy. The form under the journey list sets that up.

*   **One row** runs that journey only.
*   **Two to five rows** make a mix. Give each row its share of the users in percent, adding up to 100. “Explore” is the plain link-clicking user.
*   **Users** is the largest number of users, as in a [plain load test](https://www.supervisor.com/docs/web-load-test).

The price is the same as for any load test: 1 credit for every 10 users, charged when the test starts. The domain must be verified.

The report of a mix adds a table with one row per entry, so you see which part of the traffic was slow.

![The traffic mix table of a report: the journey with 70% of the users and explore with 30%, each with users, page loads, average and 95th percentile load time and failed steps](https://www.supervisor.com/assets/docs/web/report-traffic-mix.webp)

## Shopify crawler signature

Shopify slows down and challenges automated traffic, which includes load test users adding to cart. A crawler signature lets them through. Create one in the Shopify admin under Online Store, Preferences, Crawler access, and paste its two values at the bottom of the journeys page. Supervisor sends the signature only to that shop and only in load tests. A signature expires after three months at most, and the page warns when it is about to.

## Good habits

*   **Name every action with a step.** Steps are what the results time and report. Code outside a step is not measured.
*   **Wait for something on the page,** not for a fixed time. `waitForSelector` makes a step end when the page is ready.
*   **Add think time.** Without `user.think`, users click faster than any person and the test is harsher than real traffic.
*   **Use `pick` and `chance`.** A thousand users buying the same product test the cache, not the shop.
*   **Stop before payment.** Walk the path to the cart or the checkout page, and do not place orders.
*   **Dry run after every change to the site.** A journey breaks when a button is renamed. A [journey monitor](https://www.supervisor.com/docs/web-monitoring#monitor-a-journey) tells you the same day.

## Related content
- [Journey commands: Playwright user journeys for AI agents](https://www.supervisor.com/docs/journey-tools)
- [Keyboard-only testing of user journeys: can a keyboard user reach checkout?](https://www.supervisor.com/docs/keyboard-runs)
- [How to load test a website with real browsers](https://www.supervisor.com/docs/web-load-test)
- [Website monitoring with a real browser: setup, alerts and settings](https://www.supervisor.com/docs/web-monitoring)
- [Scheduled load tests: catch a site getting slower](https://www.supervisor.com/docs/web-scheduled-tests)
- [Load test commands for AI agents: start, read, compare](https://www.supervisor.com/docs/load-test-tools)
