UI Steps Reference
Complete reference for all @ui tagged step definitions.
Registration
import { registerUiSteps } from '@esimplicity/stack-tests/steps';
registerUiSteps(test);
This registers:
registerUiBasicSteps- Basic UI interactionsregisterWizardSteps- Advanced UI interactions
Navigation Steps
Given I navigate to {string}
Navigates to a URL path.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| path | string | URL path (supports interpolation) |
Example:
Given I navigate to "/login"
Given I navigate to "/users/{userId}"
Given I open {string} page
Opens a page by URL.
Tag: @ui
Example:
Given I open "/dashboard" page
Given I open {string} in the browser
Opens a URL in the browser.
Tag: @ui
Example:
Given I open "https://example.com" in the browser
When I go back in the browser
Navigates back in browser history.
Tag: @ui
Example:
When I go back in the browser
When I reload the page
Reloads the current page.
Tag: @ui
Example:
When I reload the page
Click Steps
When I click the button {string}
Clicks a button by accessible name.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| name | string | Button text/name |
Example:
When I click the button "Submit"
When I click the button "Sign In"
When I click the button "{buttonName}"
When I click the {string} button
Alias for I click the button {string} with reversed parameter order.
Tag: @ui
Example:
When I click the "Login" button
When I click the "Submit" button
When I click the element {string}
Clicks an element by CSS selector.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| selector | string | CSS selector |
Example:
When I click the element "#submit-btn"
When I click the element "input[type='checkbox']"
When I click the element ".menu-item:first-child"
When I click the link {string}
Clicks a link by text.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| name | string | Link text |
Example:
When I click the link "Learn More"
When I click the link "Home"
When I {string} the {string} element that contains {string}
Clicks an element containing specific text.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| clickMode | string | Click mode |
| elementType | string | HTML element type |
| text | string | Text content |
Click Modes: click, force click, dispatch click, force dispatch click
Example:
When I "click" the "div" element that contains "Click Me"
When I "force click" the "button" element that contains "Submit"
When I {string} the {string} element with {string} {string}
Clicks an element by locator method.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| clickMode | string | Click mode |
| ordinal | string | Element index (1st, 2nd, etc.) |
| text | string | Locator value |
| method | string | Locator method |
Locator Methods: text, label, placeholder, role, test ID, alternative text, title, locator
Example:
When I "click" the "1st" element with "Submit" "text"
When I "click" the "2nd" element with "submit-btn" "test ID"
When I "force click" the "1st" element with "Email" "label"
When I click on the top left corner of the page
Clicks at position (0, 0).
Tag: @ui
Example:
When I click on the top left corner of the page
When If its visible, I {string} the {string} element with {string} {string}
Conditionally clicks an element if visible.
Tag: @ui
Example:
When If its visible, I "click" the "1st" element with "Dismiss" "text"
Form Input Steps
When I fill the placeholder {string} with {string}
Fills an input by placeholder text.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| placeholder | string | Placeholder text |
| value | string | Value to enter |
Example:
When I fill the placeholder "Enter your email" with "test@example.com"
When I fill the field {string} with {string}
Fills an input by label.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| label | string | Field label |
| value | string | Value to enter |
Example:
When I fill the field "Email" with "test@example.com"
When I fill the field "Password" with "{password}"
When I fill in {string} with {string}
Alias for I fill the field {string} with {string}. Common Cucumber phrasing.
Tag: @ui
Example:
When I fill in "username" with "tomsmith"
When I fill in "password" with "secret123"
When I select {string} from dropdown {string}
Selects an option from a dropdown by CSS selector.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| option | string | Option label to select |
| selector | string | CSS selector for dropdown |
Example:
When I select "Option 1" from dropdown "#dropdown"
When I select "United States" from dropdown "#country-select"
When I {string} {string} in the {string} element with {string} {string}
Performs input action on element.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| action | string | Input action |
| value | string | Value |
| ordinal | string | Element index |
| text | string | Locator value |
| method | string | Locator method |
Actions: type, fill, choose
Example:
When I "type" "hello" in the "1st" element with "search" "placeholder"
When I "fill" "test@example.com" in the "1st" element with "Email" "label"
When I "choose" "Option A" in the "1st" element with "Select..." "placeholder"
Then I fill {string} into the {string} dropdown
Selects a dropdown option.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| value | string | Option to select |
| dropdownLabel | string | Dropdown label |
Example:
Then I fill "United States" into the "Country" dropdown
Keyboard Steps
Then I {string} {string}
Performs keyboard action.
Tag: @ui
Parameters:
| Name | Type | Description |
|---|---|---|
| action | string | type or press |
| value | string | Text to type or key to press |
Example:
Then I "type" "hello world"
Then I "press" "Enter"
Then I "press" "Tab"