Your first flow: test what people do, not only that pages open

How to write a first flow that follows a visitor through your site step by step, try it on real phones, and keep it running after every deploy.

Checked 24 November 20263 min read

A page that opens is not a site that works. The sign-in button can be dead, the cart can refuse to update, and every page will still load without an error. A flow is a short script of what a visitor does, run on each phone and browser. When it passes, the thing people came for works.

Pick one thing that matters

Start with the one action your site exists for: signing in, buying, booking, starting a game. If it broke tonight, you'd want to know before your visitors do. One flow for that is worth more than ten that click around.

Write it a step a line

A flow reads like instructions to a person:

flow sign in
open /login
type css=#email "{{test-user.user}}"
type css=#password "{{test-user.password}}"
tap "Sign in"
wait for "Your dashboard"
see "Sign out"
Sign-in stepWhat the test learns
OpenThe form loaded. A broken button could still pass this check.
TapThe visitor submitted the test account’s details.
Verify“Sign out” appears. The visitor reached the signed-in state.
  • tap and see use the words on the screen, the way a visitor finds them.
  • wait for gives a slow step time to finish (30 seconds unless you say otherwise).
  • End on see: something that is only there when it worked.

Make it pass every time, not once

A flow runs every day, after each deploy, and on every device, so it has to find the site the way it left it. Signing in does: the account is there before and after. Signing up with a fixed email doesn't: the first run makes the account, and every run after it fails because the account already exists.

If a flow has to make something (an account, an order, a booking), end it by removing it again, as a person would, so the next run starts clean. Then run it twice in a row before you keep it.

The test account

test-user is a test account kept on your lab computer, referred to by its name. A person adds it there, with the sites it may sign in to; your coding agent can't. Test accounts explains how to make one that can be reset without losing anything.

The password is stored only on that computer and typed only on the sites you allowed. It never appears in a result, a report or what your coding agent reads, and once it's typed that device keeps no screenshots for the rest of the test.

Let your coding agent write it

Your agent knows your site's code. Ask it: "Write a flow for signing in, run it on my phones with PocketQA, and keep it." It tries the flow, reads which step failed and why, and fixes the flow or the site.

Try it as a draft

Put draft on the line after flow sign in while you're working on it. A draft runs on every device and reports each step, but never counts as a failure. Take the word off once it passes.

A new flow is also on trial on each device until it passes there once, so a step written for the wrong screen size is blamed on the flow, not on your site.

Keep it

A flow you keep on the site runs every day and after each deploy, on every device. When it fails, you're told which step, on which phone, and what was on the screen.

Saving flows replaces the ones the site already keeps. In the dashboard's Flows, add the new one below the others. An agent that saves it with change_site sends the saved flows too, with the new one after them.

Then add the next most important thing. Three or four flows cover what most sites are for.

Related guides