Skip to content
Sign in

How-to

Write a user journey

Updated

On this page

A user journey is a flow through your site that Zof's end-to-end test runs in a real browser, step by step: open a page, click, fill in a field, then check what the page shows. You write it in a short step language, one step per line.

Writing a short journey takes about 5 minutes. Zof only understands the steps below. Free text such as "open my about page" can't be run, and the run shows Couldn't check (Journey needs rewording).

Where to write it

On Runs, choose Run tests, then tick End-to-end test in the Test types step. The Options step shows User journeys: type each journey's steps in its box, one per line. Choose Add a journey for another. See Run a test for the other steps.

The step language

Quoted text names something on the page, or a value to type. Everything else is a fixed word from this table.

StepExamples
Open a page on your addressopen /pricing, go to the homepage, or just the path: /pricing
Click a button, link, tab, menu item or exact textclick button "Contact us", click link "Pricing", click on the "Checkout" link, tap "Menu"
Type into a field, found by its label, placeholder or namefill "Search" with "lamp", type "42" into "Quantity"
Tick or untick a checkboxcheck "I agree", uncheck "Newsletter"
Choose from a dropdownselect "Deutsch" from "Language"
Press a keypress Enter (also Tab, Escape, Space, Backspace, arrow up and arrow down)
Hoverhover over "Menu", hover over button "Account"
Scrollscroll to "Contact us", scroll down, scroll up, scroll to the bottom, scroll to the top
Close a cookie bannerdismiss the cookie banner clicks a reject or close button. No banner isn't a failure.
Accept browser pop-upsaccept the dialog accepts alert, confirm and prompt pop-ups. Without it, Zof dismisses them and the run says so.
Waitwait for "Order placed", wait until url contains /done, wait 2 seconds (at most 10)
Check what the page showsexpect "Welcome", expect button "Sign out", I should not see "Error", title contains "Pricing"
Check a named control's stateexpect button "Place order" is disabled, expect checkbox "I agree" is checked, expect checkbox "Newsletter" is unchecked
Check the addressexpect url /services

Rules

  • One step per line.
  • Quoted text names things on the page or values to type, for example click link "Pricing".
  • A journey has at most 30 steps, and a run has at most 5 journeys.
  • Stay on your address: open a path such as /about-us, never a full address on another site. If the first step isn't open, the journey starts at the address you're testing.
  • Each journey starts in a fresh browser, at desktop size, with no cookies from another journey.
  • Steps also find controls inside frames from your address. A control inside another site's frame is never used.

Tips

  • Use link or button text that appears once on the page. A step that matches more than one visible control is ambiguous and cannot run safely. Naming the kind of element helps: click link "Get started" only looks at links; give it a unique accessible name if several links still match.
  • Text checks match whole words and ignore capitals: expect "error" doesn't match "No errors found". Clicks match the whole name, never part of it.
  • Don't submit real forms, such as sign-up or subscribe forms: they create real data on your site. Check that the form is there instead.
  • Never type an account password into journey steps. Without saved test sign-in, the wizard refuses password steps and account placeholders. When saved sign-in is available, use the mode and placeholders below.
  • End with a check, such as expect or expect url. A journey without one passes as long as every step runs. A journey that only opens pages gets a check added for you: that the last page it opened loaded, like expect url /pricing.
  • A confirmation message proves only what the page displays. To check that an order was saved, add an explicit supported readback, such as opening a test order page and checking its unique order text. Unsupported business outcomes and control states remain unproven even when the supported steps pass. Each part of an expected outcome counts on its own: in Results show "Dune" and the result count is 2, the count has no quoted text to check, so the run warns "part of an expected outcome not understood" and doesn't count it as checked.

Test sign-in

When saved test sign-in is on, enter the test account email, password and protected page, or use the saved account, in a manual end-to-end run's Options. Signed-in checks starts each journey after verified sign-in. Test sign-in from signed out starts each journey anonymously so its steps can test the ordinary login form. See Run a test to save and select the account.

In Test sign-in from signed out, use fill "Email" with {username} and fill "Password" with {password}, with your form's actual field labels. The saved values are substituted only while the test runs. Never put the username or password themselves into step values. Open the saved login path, fill those fields, submit the sign-in button once, then check the saved protected page or its text shown only when signed in. For example:

open /login
fill "Email" with {username}
fill "Password" with {password}
click button "Sign in"
expect url /dashboard

This supports one username/password form on the saved website address. OAuth, SSO, MFA, CAPTCHA and further form submissions after sign-in are unsupported. A failed or unverified sign-in ends as Couldn't check rather than passing as a public journey. Signed-in journeys do not save screenshots.

A worked example

For a marketing site at https://www.example.com, the first journey checks that visitors can reach the services page from the home page:

open /
dismiss the cookie banner
click link "See how it works"
expect url /services
expect "Our services"

The second checks that the sign-up page opens, without submitting it:

open /
click link "Sign up"
expect url /signup
expect button "Create account"

Check that it worked

When the run finishes, its page lists each journey with the steps it ran. Passed means every step of every journey passed. If any step failed, the run shows Issues found, and the journey shows the step that failed, with a screenshot when a public journey captured one. A step Zof couldn't understand means nothing ran: the run shows Couldn't check.

Common errors and fixes

The run saysWhy, and the fix
could not understand "open my about page"The step isn't in the step language. Rewrite it with a step from the table: open /about-us.
could not understand "click the Contact button"The name isn't in quotes. Write click button "Contact".
link "Pricing" not found, or field "Email" not foundNothing on the page has that text or label. Copy the exact visible text or field label from the page.
text "How it works" not visibleThe words on screen differ: punctuation, a curly quote (’) instead of a straight one ('), or only part of a word. Copy whole words as shown on screen, and prefer a distinctive part without apostrophes.
A named control is ambiguousMore than one visible control matches that name. Use a unique accessible name, or narrow the kind of element: click link "Get started".
is inside a frame from another addressThe control is in another site's frame, such as a payment or chat widget. Journeys stay on your address; check something on your own page instead.
Stay on this address: open a path, like /login.A step opens another site. Open a path on your address instead.
Zof can't sign in for you yet. Test journeys that don't need signing in.A password step or account placeholder isn't allowed in the selected mode. Use a saved account with Test sign-in from signed out, when available, or test public pages. Never type the password into steps.

Next steps