Skip to main content

Step Reference

StepDescription
Given I'm on the homepageNavigate to /
Given I'm on page {url}Navigate to a path or URL
Given all popups are closedDismiss cookie banners and modal overlays
When I go back to the previous pageBrowser back navigation
Given I'm on page "/login"

Assert

StepDescription
Then the page {contains|does not contain} {selector}Assert an element is (or is not) visible
Then {selector} is {visible|hidden}Assert a specific element is visible or hidden
Then {selector} {contains|does not contain} {selector}Assert a child element is (or is not) inside a parent
Then {selector} has focusAssert an element has focus
Then {selector} does not have focusAssert an element does not have focus
Then I should be on page {url}Assert the current path (supports :param wildcards)
Then The page contains text "Welcome"
Then The page does not contain button "Sign in"
Then button "Save" is visible
Then text "Loading" is hidden
Then field "Email" has focus
Then button "Submit" does not have focus
Then I should be on page "/dashboard"
Then I should be on page "/users/:id/profile"

Mouse

StepDescription
When I {click|double-click|right-click|hover} {selector}Interact with an element
When I {click|double-click|right-click|hover} {selector} while holding {keys}Interact while holding modifier keys
When I scroll {selector} into viewScroll element into the viewport
When I click button "Sign in"
When I double-click text "Rename"
When I click link "Delete" while holding Shift
When I scroll text "Load more" into view

Form

StepDescription
When I set {selector} to {value}Fill an input, select a dropdown option, or toggle a checkbox
When I set {selector} to range of {value} to {value}Set a range input
When I clear {selector}Clear an input field
When I {check|uncheck} {selector}Check or uncheck a checkbox or switch
When I {focus|blur} {selector}Focus or blur an element
When I set field "Email" to "user@example.com"
When I set field "Country" to "France"
When I check field "Remember me"
When I clear field "Search"
When I set field "Price range" to range of 10 to 100

Value types:

TypeExample
String"hello"
Number42
Booleantrue / false
Date (absolute)date "2025-01-22"
Date (relative)date of tomorrow, date of 3 days ago, date of 8 weeks from now
Generated passwordpassword of "user-uuid"
Array["Option A", "Option B"]

To use password of "...", set LETSRUNIT_PASSWORD_SEED in your environment.

Keyboard

StepDescription
When I press {keys}Press a key or key combination
When I type {text}Type text using the keyboard
When I press Enter
When I press Control+A
When I press Shift+Tab
When I type "Hello, world"

Standard key names: Enter, Tab, Escape, Space, ArrowDown, ArrowUp, Backspace.

Clipboard

StepDescription
When I copy {selector} to the clipboardCopy element content to the clipboard
When I paste from the clipboard into {selector}Paste clipboard content into a field
When I copy text "Invoice #1234" to the clipboard
When I paste from the clipboard into field "Reference"

Mailbox

See Email Testing for setup and examples.

StepDescription
When I open the latest emailFetch and open the most recent email to the test address
When I click the link in the emailClick the first link found in the email body

Custom steps

You can add your own step definitions for project-specific behavior.