The plugin provides functionality to interact with Web applications.
Note
|
The properties marked with bold are mandatory. |
Property Name | Acceptable values | Default | Description |
---|---|---|---|
|
Valid target platform name |
empty |
Identifies the operating system for the testing. e.g. |
|
Valid target platform version |
empty |
Identifies the operating system version for the testing. e.g. partial$selenium-properties.adoc partial$proxy-properties.adoc |
|
|
|
Provides possibility to attach screenshot for failed proxy steps |
|
{durations-format-link} |
|
Sets the amount of time to wait for a page load to complete before throwing an error. |
|
{durations-format-link} |
|
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error. |
|
string with arguments |
|
The command line (CLI) arguments to use when starting browser.
|
|
header size as a viewport size percent |
|
Before the click VIVIDUS scrolls element into the viewport, the property defines top edge indent in viewport percent for the scroll |
In addition to the command line arguments, user preferences (see the Preferences file in Chrome’s user data directory or open chrome://prefs-internals/
link in Chrome browser for examples) can be customised.
Here is an example how to configure third-party cookies behaviour.
web.driver.chrome.experimental-options={"prefs": {"profile": {"cookie_controls_mode": 0}}}
The allowed values for the preference from the example are:
-
0
- allow all cookies; -
1
- block third-party cookies; -
2
- block third-party cookies in Incognito mode only.
Note
|
The expression parameters marked with bold are mandatory. |
Parses Data URL-s and decodes their data if Base64 encoding is set. The result of the expression depends on the MIME type of Data URL. The result will be a binary data in case of the binary MIME type and it will be a string for the text MIME type.
Warning
|
If expression is applied to invalid Data URL the error will be thrown. |
#{decodeDataUrl($dataUrl)}
-
$dataUrl
- The Data URL to decode.
When I save `src` attribute value of element located by `id(image)` to scenario variable `image`
When I compare against baseline with name `inlined-image` from image `#{decodeDataUrl(${image})}`
Expression | Result |
---|---|
|
|
|
|
|
|
|
|
|
|
|
Image binary data. |
The variable provides the URL of the page currently loaded in the browser.
${current-page-url}
Given I am on page with URL `https://docs.vividus.dev/`
Then `${current-page-url}` is equal to `https://docs.vividus.dev/vividus/latest/index.html`
The set of dynamic variables provides ability to access height and width of the browser window.
Variable name | Description |
---|---|
|
the height of the browser window |
|
the width of the browser window |
When I change window size to `800x600`
Then `${browser-window-width}` is = `800`
Then `${browser-window-height}` is = `600`
plugins:partial$plugin-web-app-profiles.adoc
partial$locator-header.adoc plugins:partial$plugin-web-app-locators.adoc
plugins:partial$plugin-web-app-steps.adoc
Waits for the tab with desired title and switches to it.
When I wait `$duration` until tab with title that $comparisonRule `$title` appears and switch to it
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
When I wait `$duration` until window with title that $comparisonRule `$windowTitile` appears and switch to it
-
$duration
- The timeout duration to wait for a tab in {durations-format-link} format. -
$comparisonRule
- The tab title comparison rule. -
$title
- The expected tab title.
Given I am on page with URL `https://vividus-test-site-a92k.onrender.com/windows.html`
When I click on element located by `id(timeout)`
When I wait `PT3S` until tab with title that is equal to `Vividus test site` appears and switch to it
Stops page loading
When I stop page loading
Tip
|
Could be useful in combination with Selenium’s page load strategy |
When I open URL `https://delayed.vividus.dev` in new tab
When I stop page loading
Sets a custom page load timeout for a part of the story
When I set page load timeout to `$duration`
-
$duration
- total duration to wait for page load completion in {durations-format-link} format.
Given I am on page with URL `https://example.com/`
When I set page load timeout to `PT20S`
When I open URL `https://example.com/super-heavy-page` in new tab
When I set page load timeout to `PT10S`
Checks web performance metrics.
Then metric $webPerformanceMetric is $comparisonRule `$duration`
-
$webPerformanceMetric
- The web performance metric. Where:-
TIME_TO_FIRST_BYTE
- The time between the navigation start and the response start. -
DNS_LOOKUP_TIME
- The time between the domain lookup start and the domain lookup end. -
DOM_CONTENT_LOAD_TIME
- The time between the DOM loading and the the DOM complete. -
PAGE_LOAD_TIME
- The time between the navigation start and the load event end.
-
-
$comparisonRule
- The duration comparison rule. -
$duration
- The duration to compare against in {durations-format-link} format.
Given I am on page with URL `https://example.com`
Then metric PAGE_LOAD_TIME is less than `PT5S`
Scan a barcode from the specified context and save its value to the variable with the specified name. If context not set - takes a screenshot of the entire page. Only the first found barcode will be scanned.
Supported Code Formats
Actions performed at this step:
-
Takes a screenshot of the specified context. If it’s not set - takes a screenshot of the entire page
-
Scans a barcode from the screenshot and save its value to the variable
When I scan barcode from context and save result to $scopes variable `$variableName`
-
$scopes
- The comma-separated set of the variables scopes. -
$variableName
- The name of the variable to save the value of the barcode.
When I change context to element located by `xpath(//div[@id='qrCode'])`
When I scan barcode from context and save result to scenario variable `qrCodeLink`
Then `${qrCodeLink}` is equal to `https://www.example.com`
Uploads the resource or file via web interface.
When I select element located by `$locator` and upload `$resourceNameOrFilePath`
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
When I select element located `$locator` and upload file `$filePath`
-
$locator
- the locator of the web element with input tag and attribute type=file -
$resourceNameOrFilePath
- relative path to the file to be uploaded
When I select element located by `id(uploadfile)` and upload file `/folder/file_for_upload.png`
This set of steps facilitates the dragging and dropping of elements on a web page.
Performs drag-and-drop operation for the specified elements.
When I drag element located by `$draggable` and drop it at $location of element located by `$target`
When I drag element located by `id(item-number)` and drop it at right bottom of element located by `id(item-number)`
Simulates a drag-and-drop operation for the specified elements, replicating the behavior without actual mouse actions performed.
When I simulate drag of element located by `$draggable` and drop at element located by `$target`
When I simulate drag of element located by `id(item-number)` and drop at element located by `id(item-number)`
Checks that each element specified by the locator contains an exact number of visible child elements specified by another locator
Then each element with locator `$elementLocator` has `$number` child elements with locator `$childLocator`
Then each element with locator `id(menu)` has `5` child elements with locator `id(menu-item)`
Checks the context element has the expected CSS property.
The context can be set by the corresponding steps.
Then context element has CSS property `$cssName` with value that $comparisonRule `$cssValue`
-
$cssName
- A name of the CSS property. -
$comparisonRule
- CSS property comparison rule. -
$cssValue
- The expected value of the CSS property.
When I change context to element located by `id(rainbow)`
Then context element has CSS property `color` with value that is equal to `rgba(0, 0, 0, 1)`
Check that all elements found on the page by the given locator have the same dimension: width / height.
Note
|
Element’s dimension is measured in pixels and means the size that given element occupies on the web-page in a browser. Element size may vary in different browsers, it also depends on screen resolution, page scaling, scripts running on the page. |
Then each element located by `$locator` has same `$dimension`
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
Then each element located `$locator` has same `$dimension`
-
$locator
- The locator to find an elements to compare. -
$dimension
- The elements dimension to compare. Possible values: width, height
Then each element located `id(context-menu-item)` has same `width`
Then each element located `id(context-menu-item)` has same `height`
Checks that the context element has an expected width in a percentage (from the style attribute) relative to the page body.
The context can be set by the corresponding steps.
Then context element has width of $widthPercentage%
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
Then the context has a width of '$widthPercentage'%
-
widthPercentage
- An expected element width in a percentage relative to the page body.
When I change context to element located by `id(menu)`
Then context element has width of 30%
Checks that the context element has an expected width in a percentage (from the style attribute) relative to the parent element
The context can be set by the corresponding steps.
Then context element has width of $widthPercentage% relative to parent element
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
Then the context element has a width of 'widthPercentage'% relative to the parent element
-
widthPercentage
- An expected element width in a percentage.
When I change context to element located by `id(menu)`
Then context element has width of 13% relative to parent element
Focus Steps
Focus indicates the act of selecting an element of a graphical user interface. Text entered at the keyboard or pasted from a clipboard is sent to the component which has the focus.
Sets the focus on the context element, if it can be focused. The focused element is the element that will receive keyboard and similar events by default.
When I set focus on context element
When I change context to element located by `id(input-username)`
When I set focus on context element
Sets the focus on the element found by the specified locator, if it can be focused. The focused element is the element that will receive keyboard and similar events by default.
When I set focus on element located by `$locator`
-
$locator
- The locator to find an element.
When I set focus on element located by `id(input-username)`
Checks if the context element is in the provided focus state by comparing the context element and the active element.
Then context element is $focusState
-
$focusState
- The state to verify:in focus
ornot in focus
.
Then context element is in focus
When I press ENTER on keyboard
Checks if the element found by the specified locator is in the provided focus state by comparing the found element and the active element
Then element located by `$locator` is $focusState
-
$locator
- The locator to find an element. -
$focusState
- The state to verify:in focus
ornot in focus
.
Then element located by `id(input-username)` is in focus
When I change context to element located by `id(input-username)`
When I press ENTER on keyboard
Validates whether the dropdown located by locator exists and contains the list of the expected options.
Then dropdown located by `$locator` contains options:$options
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
Then dropdown located `$locator` contains options:$options
-
$locator
- The locator used to find a dropdown. -
$options
- examples table describing expected options
Then dropdown located by `id(colors)` contains options:
|state|item |
|false|Red |
|false|Green|
|true |Blue |
Important
|
The item is an option. The state (true or false ) specifies whether the item is selected.
|
Verifies if dropdown located by locator exists and first selected option.
Then dropdown located by `$locator` exists and selected option is `$option`
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
Then dropdown located `$locator` exists and selected option is `$option`
-
$locator
- The locator used to find a dropdown. -
$option
- first selected option
Then dropdown located by `id(colors)` exists and selected option is `Blue`
Selects option in multi-select dropdown
Important
|
Step will fail if target dropdown is not multi-select |
When I add `$option` to selection in dropdown located by `$locator`
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
When I add `$option` to selection in dropdown located `$locator`
-
$option
- option to select -
$locator
- The locator used to find a dropdown.
When I add `Two` to selection in dropdown located by `id(numbers)`
Selects option in dropdown
Important
|
Does not support multi-selection |
When I select `$option` in dropdown located by `$locator`
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
When I select `$option` in dropdown located `$locator`
-
$option
- option to select -
$locator
- The locator used to find a dropdown.
When I select `Red` in dropdown located by `id(colors)`
Validates whether the certain cookie is set.
Then cookie with name `$cookieName` is set
-
$cookieName
- The name of the cookie to check presence.
Then cookie with name `JSESSIONID` is set
Validates whether the certain cookie is not set.
Then cookie with name `$cookieName` is not set
-
$cookieName
- The name of the cookie to check absence.
Then cookie with name `JSESSIONID` is not set
Adds the cookies provided in the input ExamplesTable. It’s allowed to add the cookies for the current domain only: make sure the web browser is opened at the expected domain. The actions performed by the step:
-
add the cookies;
-
refresh the current page (this action is required to apply the changes in cookies).
When I set all cookies for current domain:$parameters
-
$parameters
- The parameters of the cookies to set as ExamplesTable:Column Name Description cookieName
the name of the cookie to set
cookieValue
the value of the cookie to set
path
the path of the cookie to set
When I set all cookies for current domain:
|cookieName |cookieValue |path |
|cookieAgreed |2 |/ |
Finds the cookie by the name and saves its value to a variable.
When I save value of cookie with name `$cookieName` to $scopes variable `$variableName`
-
$cookieName
- The name of the cookie to save the value. -
$scopes
- The comma-separated set of the variables scopes. -
$variableName
- The variable name to save the cookie value.
When I save value of cookie with name `JSESSIONID` to scenario variable `session-id`
Finds the cookie by the name and saves all its parameters as JSON to a variable.
When I save cookie with name `$cookieName` as JSON to $scopes variable `$variableName`
-
$cookieName
- The name of the cookie to save. -
$scopes
- The comma-separated set of the variables scopes. -
$variableName
- The variable name to save the cookie.
When I save cookie with name `JSESSIONID` as JSON to scenario variable `session-id`
Removes the certain cookie from the current domain. The actions performed by the step:
-
remove the certain cookie the from current domain;
-
refresh the current page (this action is required to apply the changes in cookies).
When I remove cookie with name `$cookieName` from current domain
-
$cookieName
- The name of the cookie to remove.
When I remove cookie with name `JSESSIONID` from current domain
Removes the certain cookie from the current domain, but does not apply the changes in cookies. The current page must be refreshed or the navigation must be performed to apply the cookie changes.
When I remove cookie with name `$cookieName` from current domain without applying changes
-
$cookieName
- The name of the cookie to remove.
When I remove cookie with name `JSESSIONID` from current domain without applying changes
When I refresh page
Removes all cookies from the current domain. The actions performed by the step:
-
remove all cookies from the current domain;
-
refresh the current page (this action is required to apply the changes in cookies).
When I remove all cookies from current domain
Web Storage steps
Finds the web storage item by the key and saves its value to the variable.
When I save $storageType storage item with key `$key` to $scopes variable `$variableName`
-
$storageType
- One of the web storage mechanisms: eitherlocal
orsession
. -
$key
- The name of the key to retrieve the value of. -
$scopes
- The comma-separated set of the variables scopes. -
$variableName
- The name of the variable to store the value of the web storage item.
When I save local storage item with key `token` to scenario variable `application-token`
Adds the item with the specified key-value pair to the web storage, or updates that key’s value if it already exists.
When I set $storageType storage item with key `$key` and value `$value`
-
$storageType
- One of the web storage mechanisms: eitherlocal
orsession
. -
$key
- The name of the key to create/update. -
$value
- The value to give the key that is creating/updating.
When I set session storage item with key `token` and value `session-token`
Validates the web storage item with the specified key exists.
Then $storageType storage item with key `$key` exists
-
$storageType
- One of the web storage mechanisms: eitherlocal
orsession
. -
$key
- The name of the key to check presence.
Then session storage item with key `token` exists
Validates the web storage item with the specified key does not exist.
Then $storageType storage item with key `$key` does not exist
-
$storageType
- One of the web storage mechanisms: eitherlocal
orsession
. -
$key
- The key of the local storage item to check absence.
Then local storage item with key `token` does not exist
Changes the current browser window size to the specified one.
Important
|
The specified browser window size should be smaller than the current screen resolution. |
When I change window size to `$targetSize`
-
$targetSize
- The desired browser window size in pixels, e.g.800x600
, where the first measure is window width, the last one is window height.
Given I am on page with URL `https://example.com/`
When I change window size to `640x320`
A checkbox is a graphical user interface element. Performs the action with the flag found by the locator. Actions that can be performed (CHECK or UNCHECK)
When I $checkBoxAction checkbox located by `$checkboxLocator`
-
$checkBoxAction - The action to select a state of the checkbox, either CHECK or UNCHECK.
-
$checkboxLocator - The locator used to identify the checkbox.
When I check checkbox located by `checkboxName(terms-and-conditions)`
Steps allow to interact with video elements.
Starts video playback.
When I play video in video player located by `$locator`
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
When I play video in video player located `$locator`
-
$locator
- The locator used to find a video player.
Pauses video playback.
When I pause video in video player located by `$locator`
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
When I pause video in video player located `$locator`
-
$locator
- The locator used to find a video player.
Rewinds video to the desired mark in seconds.
When I rewind time to `$number` seconds in video player located by `$locator`
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
When I rewind time to `$number` seconds in video player located `$locator`
-
$number
- time mark in seconds -
$locator
- The locator used to find a video player.
Saves video player info: duration, currentTime, src, networkState. For more information about the properties see HTML Audio/Video Properties
When I save info from video player located by `$locator` to $scopes variable `$variableName`
Deprecated syntax (will be removed in VIVIDUS 0.7.0):
When I save info from video player located `$locator` to $scopes variable `$variableName`
-
$locator
- The locator used to find video player. -
$scopes
- The comma-separated set of the variables scopes. -
$variableName
- The variable name to save the info. If the variable name is info, the following variables will be created:-
${info.src}
- The current source of the audio/video element -
${info.duration}
- The length of the current audio/video (in seconds) -
${info.currentTime}
- The current playback position in the audio/video(in seconds) -
${info.networkState}
- The current network state of the audio/video. For more information see: Network State
-
Given I am on page with URL `https://www.youtube.com/watch?v=pYqyVpCV-3c`
When I pause video in video player located `cssSelector(video)`
When I rewind time to `777` seconds in video player located `cssSelector(video)`
When I play video in video player located `cssSelector(video)`
When I save info from video player located `cssSelector(video)` to SCENARIO variable `info`
Then `${info.currentTime}` is > `0`
Then `${info.duration}` is > `1000`
Then `${info.networkState}` is = `2`
Then `${info.src}` matches `.+youtube.+`
Allows to set command line arguments for browsers. This step works similar to the property:
web.driver.<browser-name>.command-line-arguments
In case both the property and the step are used - arguments from the property will be ignored. The step will take effect for all new browser sessions created in the current story. It will not affect the current sessions.
Popular browsers supporting command line arguments configuration:
Not supported browsers:
-
Safari
When I set browser command line arguments to `$argsString`
-
$argsString
- Sequence of command line arguments, separated by space.
When I set browser command line arguments to `--use-fake-ui-for-media-stream --use-file-for-fake-video-capture=${videoStorage}/${video1}.y4m --use-fake-device-for-media-stream`
Given I am on main application page
Executes async JavaScript code and saves result into variable.
When I execute async javascript `$jsCode` and save result to $scopes variable `$variableName`
-
$jsCode
- Any JavaScript code. In order to save a result return statement should be used. -
$scopes
- The comma-separated set of the variables scopes. -
$variableName
- The variable name to save the cookie value.
When I execute async javascript `
var callback = arguments[arguments.length - 1];
var xhr = new XMLHttpRequest();
xhr.open('GET', '/resource/data.json', true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
callback(xhr.responseText);
}
};
xhr.send();` and save result to scenario variable `response`
Then `${response}` matcher `.+`
Waits for element disappearance with desired timeout.
Note
|
If the element doesn’t exist on the page/context, the step will immediately complete successfully. Checking the element on the page (if needed) should be done in a separate step (e.g. [_wait_for_element_appearance] or Validate elements). |
Then element located by `$locator` disappears in `$timeout`
-
$locator
- The locator used to element. -
$timeout
- The maximum time to wait for the element disappearance in {durations-format-link} format.
When I click on a button with the name 'Toggle element visibility with delay'
Then element located by 'xpath(//div[@id='delayed'])' disappears in 'PT3S'
This step allows you to save an HTML table from a specified context into a variable.
For more information, see how to work with table variables
Important
|
The HTML table must have a header row with <th> tags. |
When I save table to $scopes variable `$variableName`
-
$scopes
- The comma-separated set of the variables scopes. -
$variableName
- The variable name to refer to the variable value.
Note
|
Before using this step, ensure the context is set to the required table. See the example below. |
When I change context to element located `xpath(//table[1])`
When I save table to SCENARIO variable `table`
Saves the number of currently opened tabs in the browser to the variable.
When I save number of open tabs to $scopes variable `$variableName`
-
$scopes
- The comma-separated set of the variables scopes. -
$variableName
- The variable name to refer to the variable value.
When I save number of open tabs to SCENARIO variable `count`
Accepts the action in popup alert with matching text by clicking on the "OK" button or dismiss it by clicking "Cancel" button.
Actions performed at this step:
-
Finds the appropriate alert with matching message
-
Performs the corresponding action
When I $alertAction alert with message which $comparisonRule `$message`
-
$alertAction
- Action to perform. Possible values:ACCEPT
,DISMISS
. -
$comparisonRule
- String comparison rule. -
$message
- The text message of the alert.
When I accept alert with message which matches `.*`
This step allows you to type text into popup alert input field and then accept the alert.
Note
|
This step is applicable only for alerts with a single input field. For authorization alerts, basic URL authorization should be used. For example, https://user:pass@domain.com |
When I type text `$text` in alert and accept it
-
$text
- The text to be typed into the alert input field.
When I type text `VIVIDUS` in alert and accept it
Waits for an popup alert appearance on the current page.
When I wait until alert appears
When I click on element located by `buttonName(Survey)`
When I wait until alert appears
Then an alert is present
Waits for an popup alert disappearance from the current page.
When I wait until alert disappears
When I click on element located by `buttonName(Survey)`
Then an alert is present
When I accept alert with message which matches `.*`
When I wait until alert disappears
Then an alert is not present
Checks that there is popup alert on the page.
Then an alert is present
When I click on element located by `buttonName(Survey)`
Then an alert is present
Waits for a frame with the specified name to appear and then switches to it.
When I wait until frame with name `$frameName` appears and I switch to it
-
$frameName
- The name or ID of the expected frame.
cookieFrame
name and switch to itGiven I am on page with URL `http://example.com`
When I wait until frame with name `cookieFrame` appears and I switch to it
Waits until the current page title matches the certain title using specified comparison rule.
When I wait until page title $comparisonRule `$pattern`
-
$comparisonRule
- String comparison rule. -
$pattern
- The expected title pattern of the current page.
Given I am on page with URL `http://example.com`
When I wait until page title matches `.*Domain`
Steps allow to interact with slider (input element with type = "range").
Set the specified value in the slider.
When I set value `$value` in slider located by `$locator`
-
$value
- The value to set in the slider. In most cases, it is a numeric value in the range of [0, 100]. -
$locator
- The locator used to find a slider.
When I set value `50` in slider located by `id(test_slider)`
Check that the actual value in the slider equals to the value provided in the step.
Then value `$value` is selected in slider located by `$locator`
-
$value
- The expected value in the slider. In most cases, it is a numeric value in the range of [0, 100]. -
$locator
- The locator used to find a slider.
Then value `50` is selected in slider located by `id(test_slider)`
Emulates mobile device using the provided configuration.
Important
|
The step is only supported by Chrome browser. |
When I emulate mobile device with configuration:`$jsonConfiguration`
-
$jsonConfiguration
- The JSON containing device metrics to override.
When I emulate mobile device with configuration:`{
"width": 430,
"height": 932,
"deviceScaleFactor": 3,
"mobile": true
}`
Resets the mobile device emulation returning the browser to its initial state.
Important
|
The step is only supported by Chrome browser. |
Important
|
The step ignores the web/desktop/chrome/mobile_emulation/phone profile settings when returning the browser to its initial state.
|
When I reset mobile device emulation
When I reset mobile device emulation
To validate host component of the current page URL the following statement can be used:
Given I am on page with URL `https://example.com/relative/url/example.html`
Then `#{extractHostFromUrl(${current-page-url})}` is equal to `example.com`
-
${current-page-url}
is the current page URL dynamic variable.
To validate path component of the current page URL the following statement can be used:
Given I am on page with URL `https://example.com/relative/url/example.html`
Then `#{extractPathFromUrl(${current-page-url})}` is equal to `/relative/url/example.html`
-
${current-page-url}
is the current page URL dynamic variable.
To validate whether current page URL contains some part the following statement can be used:
Given I am on page with URL `https://example.com/relative/url/example.html`
Then `${current-page-url}` matches `.+\/relative\/url.+`
-
${current-page-url}
is the current page URL dynamic variable. -
.\/relative\/url.
is a regular expression to match the expected part of the page URL.