Step Definitions
Comprehensive guide to all available Gherkin step definitions
General Steps
Core navigation and authentication steps for basic web interactions.
GIVEN
I go to "{string}"
Navigate to a specific page path. Supports both relative and absolute URLs.
Given I go to "/login"
Given I go to "https://example.com/about"
Parameters:
path
- URL path or full URL to navigate to
GIVEN
I log in
Perform login using default credentials from configuration.
Given I log in
GIVEN
I log in as "{string}" "{string}"
Login with specific username and password credentials.
Given I log in as "testuser" "password123"
Parameters:
username
- Username for login
password
- Password for login
GIVEN
I follow "{string}"
Click on a link with the specified text.
Given I follow "About Us"
Page Elements
Core UI interaction steps for elements, forms, and content validation.
THEN
I should see "{string}"
Verify that text is visible on the page. Supports variables and multilingual strings.
Then I should see "Welcome to our site"
Then I should see "{variable_name}"
WHEN
I click on the element "{string}"
Click on an element using CSS selector or common field name.
When I click on the element "#submit-button"
When I click on the element "SubmitButton"
WHEN
I click on the text "{string}"
Click on an element containing specific text.
When I click on the text "Continue"
THEN
I fill in "{string}" with "{string}"
Fill a form field with specified text.
Then I fill in "#email" with "test@example.com"
Then I fill in "EmailField" with "user@test.com"
THEN
I should see the element with selector "{string}"
Verify that an element is visible on the page.
Then I should see the element with selector ".success-message"
THEN
I upload the "{string}" in "{string}" field
Upload a file using a file input field.
Then I upload the "test-image.jpg" in "#file-upload" field
THEN
I select "{string}" from "{string}"
Select an option from a dropdown by value.
Then I select "option1" from "#country-select"
Conditional Steps
Steps that execute conditionally based on element visibility or configuration.
THEN
I should see "{string}" if visible
Check for text only if it's visible, skip if not found.
Then I should see "Optional message" if visible
WHEN
I click on the element "{string}" if visible
Click on element only if it's present and visible.
When I click on the element ".optional-button" if visible
THEN
I fill in "{string}" with "{string}" if visible
Fill field only if it exists and is visible.
Then I fill in "#optional-field" with "value" if visible
API Testing
RESTful API testing steps with comprehensive validation capabilities.
WHEN
I send a "{string}" request to "{string}"
Send HTTP request with specified method to endpoint.
When I send a "GET" request to "/api/users"
When I send a "POST" request to "/api/users"
THEN
the response code should be "{string}"
Validate HTTP response status code.
Then the response code should be "200"
Then the response code should be "404"
THEN
the property "{string}" should be an "{string}"
Validate JSON response property type.
Then the property "name" should be an "string"
Then the property "age" should be an "number"
GIVEN
I have request body
Prepare request body for API calls from docstring.
Given I have request body
"""
{
"name": "John Doe",
"email": "john@example.com"
}
"""
Mobile Testing
Mobile application testing steps using Appium integration.
GIVEN
I go to "{string}" app package and "{string}" activity
Navigate to specific Android app package and activity.
Given I go to "com.example.app" app package and ".MainActivity" activity
THEN
I click on the element "{string}" on mobile
Click on mobile element using Appium locators.
Then I click on the element "id:button-login" on mobile
THEN
I scroll to the element "{string}" on mobile
Scroll to make element visible on mobile device.
Then I scroll to the element "id:footer-text" on mobile
Accessibility Testing
Web accessibility testing with Pa11y integration and automated reporting.
THEN
I validate the saved page accessibility
Run accessibility tests on the current page and generate HTML report.
Then I validate the saved page accessibility
WHEN
I validate the accessibility of the "{string}" page
Run accessibility tests on a specific page path.
When I validate the accessibility of the "/contact" page
Performance Testing
Performance testing with Google Lighthouse integration.
GIVEN
I generate lighthouse report for the saved page
Generate Lighthouse performance report for current page.
Given I generate lighthouse report for the saved page
WHEN
I generate lighthouse report for "{string}" page
Generate Lighthouse report for specific page path.
When I generate lighthouse report for "/products" page
Visual Regression Testing
Visual regression testing with BackstopJS integration.
GIVEN
I generate reference screenshot for "{string}"
Create reference screenshot for visual comparison.
Given I generate reference screenshot for "/homepage"
THEN
I compare "{string}" to reference screenshot
Compare current page to reference screenshot.
Then I compare "/homepage" to reference screenshot
GIVEN
I generate reference screenshot for multiple pages
Create reference screenshots for multiple pages from docstring.
Given I generate reference screenshot for multiple pages
"""
/homepage
/about
/contact
"""
Iframe Interactions
Specialized steps for working with iframe elements.
THEN
I should see "{string}" in iframe "{string}"
Verify text is visible inside an iframe.
Then I should see "Content loaded" in iframe "#payment-frame"
WHEN
I click on element "{string}" in iframe with selector "{string}"
Click on element inside an iframe.
When I click on element "#submit" in iframe with selector "#payment-form"
Helper Steps
Utility steps for data management, waiting, and debugging.
WHEN
I wait for "{string}" seconds
Wait for specified number of seconds.
When I wait for "3" seconds
GIVEN
I store "{string}" in "{string}" variable
Store a value in a variable for later use.
Given I store "John Doe" in "username" variable
GIVEN
I save the path of the current page
Save current page URL path for later reference.
Given I save the path of the current page
WHEN
I wait for AJAX loading to finish
Wait until all AJAX requests are completed.
When I wait for AJAX loading to finish