# Writing tests

## Journeys vs steps

### Steps

You write the test line by line, one action or check per step. Once a step test passes, its actions are cached and replayed on later runs, so it is fast and cheap to run. If the UI changes, the affected steps may need an AI fix or an edit.

**Example:** `Click the "Sign in" button`

### Journey

You describe what a user does and what they should see, as a short story. The agent works out the clicks itself and checks the outcome. Once a journey passes, later runs replay those actions and check the outcome again. When the UI has changed, the agent explores again from where the replay stopped, so the journey keeps working without edits. Exploring takes longer and uses more credits than a step test. A journey can drag and drop, wait, check an email and check that an action showed a notification, even a short-lived one. It cannot upload files, run scripts or insert shared steps: use a step test for those.

**Example:** `Create a project called Demo and verify it shows up in the project list`

### Which one to pick

Use steps for flows you run often and that rarely change, where speed and credits matter. Use a journey for flows whose UI is still moving, or when you care that the outcome works rather than exactly how the user gets there. A new test starts as a journey. You can switch between the two with the Journey / Steps toggle. To rewrite a test in the other form, click "Convert to steps" or "Convert to journey" next to the toggle (1 credit).

## Core concepts

### Step

A single line in your test, written in plain English. Each step is interpreted by AI and turned into one or more concrete browser actions (click, type, hover, verify, etc.).

**Example:** `Click the "Sign in" button`

### Verification / observation

Steps that start with verify, check, confirm, ensure, observe, find, or locate are read-only: the runner takes a screenshot and asks AI whether the expected outcome is visible. Use these to assert results without performing another click. One exception: "Find and open X" and "Find and click X" are treated as real interactions, so write plain "Find X" when you only want to assert that X is there.

**Example:** `Verify the success banner is visible`

### Comparison check

When a verify step asks whether something changed, moved, was added, or was removed, the runner compares a before/after pair of screenshots instead of judging a single frame.

**Example:** `Verify the row order changed after sorting`

### Referring to earlier steps

You can refer back to subjects from earlier steps using pronouns or definite phrases ("it", "the card", "that section"). The runner resolves the reference against your previous step text.

### Referring to earlier tests

A step or a journey can refer to something an earlier test in the same run created. The runner looks up the real item from what that test actually did in the same environment, and acts only on it: a change to any item this run did not create is stopped. When it cannot tell which item is meant, the step or journey is marked blocked instead of guessing. These always run live, never from the run cache.

**Example:** `Delete the projects this run created`

### Run cache

Once a test passes end to end, the runner saves its action plan to a per-environment cache. Future runs replay those actions directly against the live page and skip the AI planner for any step that has not structurally changed. Cached runs use far fewer credits than fresh runs, so keeping a test stable once it works is the easiest way to save credits. The cache is dropped automatically when you add, remove, or reorder a step, and the next successful run rebuilds it. Journeys are cached the same way, and a replayed journey still has its outcome checked. File uploads, drag and drop, verify-notification, wait-longer, run-script, and wait-for-email steps always run via AI and never cache, and neither do steps or journeys that refer to an earlier test in the run.

## Slash actions

### Authentication

A built-in action that runs one of your configured auth methods before continuing. Pick this from the '/' menu when a step needs to authenticate. The session is reused across steps within the same test run, add it for every test, it is used when needed. To set up another auth method, open the step's auth method menu in the test editor and pick **Add new auth method**.

### Shared steps

Insert a saved, reusable sequence of steps with one action. Pick 'Run shared steps' from the '/' menu and choose a saved set. The steps run inline as if you had typed them here. Manage your reusable sequences with the **Shared steps** button on the Tests page.

### Verify notification

Checks that a brief toast or snackbar appeared after the previous step. Pick 'Verify notification' from the '/' menu and type the expected text (e.g. "Saved successfully"). Matching is fuzzy, so you do not need the exact wording. Add it right after the step that triggers the message.

**Example:** `Saved successfully`

### Wait longer

A declarative pause for slow background work, animations, or async responses. Pick 'Wait longer' from the '/' menu and choose a duration (5s, 10s, 30s, 1min, 3min). Use it instead of writing 'wait' in plain text when a step needs more time.

### Drag and drop

Drags one element onto another. Pick 'Drag and drop' from the '/' menu, then describe what to drag and where to drop it in plain English (e.g. drag "the Report.pdf card" onto "the Archive column").

### Submit file

Uploads a file by clicking an upload button or dropping onto a drop zone. Pick 'Submit file' from the '/' menu, choose click or drag-and-drop mode, describe the target, and attach the file (max 25 MB).

### Run script

Executes your own JavaScript in the page during the run. Pick 'Run script' from the '/' menu and type the body. It runs in the page context, so window, document, localStorage and your app's own globals are all reachable, which makes it the way to seed state, clear storage, or read a value the UI does not show. The step passes unless the script throws, and anything it returns is recorded as the step's observation.

**Example:** `localStorage.setItem("onboarded", "true")`

### Verify email

Waits for an email, then checks it. Pick 'Verify email' from the '/' menu, choose the mailbox to watch (the unique address this run gets, or one of your project's saved addresses), and describe the email you expect in plain English; what arrives is checked against that description, so a reworded subject line does not fail the test. You can also narrow it to a sender. Saved addresses are created on the Emails page under Settings. The runner shows the rendered email as a screenshot, so you can see exactly what was sent, and any link in it can be opened by the next step. Add it after the step that triggers the email. Emails carrying an attachment are not supported yet and will not be picked up.

**Example:** `Verify email: a link to confirm the account`

## Browser actions

### Navigate back

Moves browser history back one page, the same as the browser's back button. Write it as its own step when the current page offers no in-app way back, for example an external site after a redirect. On your own pages prefer clicking the real link, breadcrumb or menu item, and never ask for an in-page "back" element to mean this.

**Example:** `Navigate back`

### Refresh the page

Reloads the current page in place. Write it as its own step when the test genuinely needs a reload, most often to prove that a change persists. It is not a way to nudge a page that looks stuck, the runner handles waiting on its own.

**Example:** `Refresh the page`

### Switch to previous tab

Returns to the tab that was active before the current one. Use it when a link opened a new tab and the flow continues back in the original tab, for example after verifying an externally opened page. For plain history inside a single tab use Navigate back instead.

**Example:** `Switch to previous tab`

### Change the URL

Manipulates the address bar on purpose, for example to check what a tampered or stale link does. Two things to know. The step has to mention the URL or the address bar, otherwise it is read as an ordinary navigation. And you describe the change rather than pasting a finished URL, because the current URL is read at run time and your change is applied to it. Whatever the modified URL lands on, including an error or "not found" page, is the outcome the step observes.

**Example:** `Change the URL: replace the project ID with one that does not exist`

## Placeholders

### Type / inside a step

A slash on an empty step picks the step type. A slash in the middle of a sentence picks a value instead: a unique value, this run's mailbox, or one of your project's email addresses. Pick one and it is written into the step for you, so there is nothing to memorise or copy from another page. The plus button in the step field opens the same two menus if you would rather click than type.

### {{email}}

Type this instead of an email address and the runner substitutes a real mailbox it can read. Each test gets its own address on every run, so tests never collide and a rerun is never blocked by an address already being registered. A 'Verify email' step set to the unique address watches this same mailbox. Insert it from the '/' menu as 'Unique email address'. For a fixed address instead, create one on the Emails page under Settings.

**Example:** `Type {{email}} into the email field`

### {{unique}}

Substituted with a fresh value on every run. Use it inside any text that must differ from what the field already holds, or that must not collide with something that already exists. Without it, a saved step retypes the same text and a save button that only enables on change stays inert on the second run.

**Example:** `Type "Project {{unique}}" into the name field`

## Tips

### Hover

To trigger a hover (e.g. to inspect a tooltip or popover), include an explicit hover word in your step: hover, mouse over, tooltip, on hover, popover. Without one of these words the step is treated as a click.

**Example:** `Hover over the help icon and verify the tooltip says "Optional field"`

### Right-click

To open a context menu, include an explicit right-click word in your step: right click, secondary click, context menu. Without one of these the step is treated as a normal click. When you also choose a menu item, write it as part of the same step.

**Example:** `Right-click the row and select "Delete"`

### Batch / repeated actions

Steps that mention 'all', 'every', 'each', or a number (e.g. "add 3 tests", "delete all rows") run one item at a time, re-checking the page after each. Write them as a single natural step; the runner handles the repetition.

**Example:** `Delete all items in the list`

### Downloads

A step whose outcome is a downloaded file can still be verified even though nothing changes on screen. The runner records the download and hands the file to the verifier as evidence, so a plain verify step is enough.

**Example:** `Verify a PDF is downloaded`
