BrowserStack Plugin
The plugin provides integration with continuous testing cloud BrowserStack.
Installation
-
Copy the below line to
dependencies
section of the projectbuild.gradle
fileExample 1. build.gradleimplementation(group: 'org.vividus', name: 'vividus-plugin-browserstack', version: '0.5.9')
-
If the project was imported to the IDE before adding new plugin, re-generate the configuration files for the used IDE and then refresh the project in the used IDE.
Profiles
The plugin defines profiles with a set of the preconfigured properties.
|
Use in conjunction with web application profiles. |
|
Use in conjunction with web application phone profiles. Required properties:
|
|
Use in conjunction with native mobile application profiles. Required properties:
|
BrowserStack profiles can be enabled by adding the corresponding entry to configuration.profiles
property.
configuration.profiles=browserstack/web,web/desktop/chrome
BrowserStack profile must be first. |
Explore BrowserStack Capabilities for more fine-grained configuration.
Links to BrowserStack test runs can be found in Allure report |
Properties
The properties marked with bold are mandatory. |
Property Name | Acceptable values | Default | Description |
---|---|---|---|
|
hostname |
hub-cloud.browserstack.com |
BrowserStack remote end host to be used to create a new session |
|
username |
|
|
|
password |
|
|
|
|
|
Enables BrowserStack Local |
-
BrowserStack specific properties must be prepended with prefix
selenium.grid.capabilities.bstack\:options.
Meaning, given a property
projectName
with a valueMy Project
, the resulting property will beselenium.grid.capabilities.bstack\:options.projectName=My Project
-
Appium specific properties in BrowserStack must be prepended with prefix
selenium.grid.capabilities.appium\:options.
Meaning, given a property
clearSystemFiles
with a valuetrue
, the resulting property will beselenium.grid.capabilities.appium\:options.clearSystemFiles=true
Enable network capturing
The following options are available to enable network logs capturing on BrowserStack side:
-
Add
selenium.grid.capabilities.bstack:options.networkLogs=true
property into tests configuration, this will enable network logs capturing for all stories in suite. -
Add
@capability.bstack:options.networkLogs true
meta for a story being run -
Pass the capability with name
bstack:options.networkLogs
and valuetrue
as parameter to the step starting native mobile application. .Enable network logs in the step starting application
Given I start mobile application with capabilities:
|name |value|
|bstack:options.networkLogs|true |
Steps
Save network logs into variable
Saves network traffic captured during application run into variable. The network traffic data is in HAR format. The application session must be closed before network logs can be saved.
When I save BrowserStack network logs to $scopes variable `$variableName`
-
$variableName
- name of variable to save network logs
When I close mobile application
When I save BrowserStack network logs to SCENARIO variable `networkLogs`
Then number of JSON elements from `${networkLogs}` by JSON path `$..*[?(@.url == 'https://graph.example.com/v8.0')]` is equal to 1
Save network logs into context
Saves network traffic captured during application run into JSON context. The network traffic data is in HAR format. The application session must be closed before network logs can be saved.
When I save BrowserStack network logs to JSON context
To interact with the saved network logs see JSON steps that work with the JSON context
When I close mobile application
When I save BrowserStack network logs to JSON context
Then number of JSON elements from `${networkLogs}` by JSON path `$..*[?(@.url == 'https://graph.example.com/v8.0')]` is equal to 1