BrowserStack Plugin

The plugin provides integration with continuous testing cloud BrowserStack.

Installation

Example 1. build.gradle
implementation(group: 'org.vividus', name: 'vividus-plugin-browserstack', version: '0.3.7')

Profiles

The plugin defines profiles with a set of the preconfigured properties.

browserstack/web

Use in conjunction with web application profiles.

browserstack/mobile_app

Use in conjunction with native mobile application profiles.

Required properties:

  • selenium.grid.device-name

BrowserStack profiles can be enabled by adding the corresponding entry to configuration.profiles property.

Example 2. Configure Chrome on BrowserStack
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

  • BrowserStack specific properties must be prepended with selenium.grid.capabilities.bstack\:options. prefix, meaning given a property projectName with a value My Project the resulting property will be selenium.grid.capabilities.bstack\:options.projectName=My Project

  • Appium specific properties in BrowserStack must be prepended with selenium.grid.capabilities.appium\:options. prefix, meaning given a property clearSystemFiles with a value true the resulting property will be selenium.grid.capabilities.appium\:options.clearSystemFiles=true

Property Name Acceptable values Default Description

selenium.grid.host

hostname

hub-cloud.browserstack.com

Defines remote grid host to be used to create a new session

selenium.grid.username

username

empty

Defines remote grid username to be used to create a new session

selenium.grid.password

password

empty

Defines password to be used to create a new session

browserstack.browserstack-local.enabled

true false

false

Enables BrowserStack Local

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 value true 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`
  1. $scopes - The comma-separated set of the variables scopes.

  2. $variableName - name of variable to save network logs

Example 3. Save network logs into variable
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

Example 4. Save network logs into variable
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