Writing steps
A step is one sentence. It either does one thing a person would do, or checks one thing a person would see. Write it the way you would tell a colleague sitting at the screen.
One thing per step
Section titled “One thing per step”Each step is one action or one check.
Click the Save button.Check that the page shows "Saved".“Click Save and check that Saved is shown” is two things, so Belay asks you to split it and offers the two steps to use. Signing in is three: fill the email, fill the password, click the button.
One check can still name several values of the same thing:
Check that the page shows "Order placed" and "Thank you".Say which element
Section titled “Say which element”Belay finds the element from your words each time the test runs, so describe it the way a person would point it out. Useful details are its name, what kind of thing it is, where it is, and what it is next to.
Click the Rent button in the "Monarch Crest" row.Click the Add to cart button on the "Trail Helmet" card.Click the first "Rent" button.Check that the Total in the order summary is "$89.00".More description is better than less. “Click Rent” is fine on a page with one Rent button; on a page with ten, say which.
Quote the exact text
Section titled “Quote the exact text”Put text in double quotes when the exact words matter. Belay compares quoted text as written.
Check that the heading is "Your cart".Enter "Robin Lee" into the Name field.“Is” means the whole text; “shows” means it is in there
Section titled ““Is” means the whole text; “shows” means it is in there”The verb decides how strict a text check is.
| You write | Belay checks |
|---|---|
| is, says, reads | The element’s whole text is exactly the value. Use it for one short value in a named element. |
| shows, contains, includes, displays | The value appears somewhere in the element or the page. |
| mentions | The text says this in its own words. Belay judges the meaning; it is not an exact match. |
Check that the cart badge is "2".Check that the cart shows "Trail Helmet".Check that the error message mentions that the email is required.Use “mentions” when you care what a message says but not its exact wording. It is better than guessing the exact text and failing on a full stop.
How text is compared:
- Capitals count: “Saved” is not “SAVED”. Extra spaces and line breaks do not.
- “Shows” matches whole words and numbers. “9” is not found in “$29.99”.
- “Does not show” ignores capitals, so a text that is there in other capitals still fails the check.
Say where
Section titled “Say where”Name the part of the page a text should be in. A text that is in the wrong place then fails, as it should.
Check that the cart shows "Trail Helmet".Check that the cart does not show "Trail Helmet".Without a place, a check looks at the whole page:
Check that the page shows "Order placed".Check that the page does not show "Out of stock".Each step stands alone
Section titled “Each step stands alone”A step cannot say “it”, “that one”, “the same”, or “again”. Belay reads each step by itself, so name the thing in every step that uses it. To carry a value from one step to a later one, remember it.
Read the reading
Section titled “Read the reading”When Belay has read a step, the editor shows how it understood it, and save_workflow returns the same as one sentence. This is what will run. Two things to look for:
- It checks less than you wrote. If your step says a row has a price and the reading only looks for the price anywhere, rewrite the step to name the row.
- It is judged from a picture. Some checks have no exact measure, so Belay judges them from a screenshot and the reading says so. That is right for “the photo shows a mountain bike”. If you meant an exact comparison, say what to compare.
Where a run starts
Section titled “Where a run starts”A run opens the project’s start page before the first step, unless the first step goes to a page itself. The start page is the environment’s base URL, or a route you choose. See Routes.
So a workflow can begin with an action:
Click the Sign in link.Or go somewhere first:
Go to the shop page.- Actions: everything a step can do.
- Checks: everything a step can check.
- Values in steps: variables, secrets, and values remembered from the page.