Sauce Labs Integration¶
By default, Scrutinizer supports Selenium tests on recent versions of Chrome and Firefox. If you would like to test your website across a broader range of browsers on different operating systems and devices, we recommend using a service such as Sauce Labs.
Configuration for Sauce Labs¶
If you want to test the non publicly-accessible webserver in build environment of Scrutinizer with Sauce Labs, Sauce Connect is required to create a secure tunnel connection between the Sauce Labs virtual machine and build environment.
Example configuration is shown as follows:
build:
nodes:
functional-tests:
environment:
saucelabs:
username: YOUR_USERNAME
api_key: YOUR_ACCESS_KEY
# (optional) The port for Sauce Connect's inbuilt Selenium Relay. By default is 4444
port: YOUR_CUSTOM_PORT
Now you just need to update the Selenium hub address in your test code with
https://YOUR_SAUCE_USERNAME:YOUR_SAUCE_ACCESS_KEY@localhost:YOUR_CUSTOM_PORT/wd/hub
.
Parallel builds¶
Sauce Labs also support running tests in parallel across multiple virtual machines. In this case
multiple Sauce Connect tunnels are established at the same time. To use the correct tunnels, you need
to provide the tunnel identifier in the test code by using the tunnelIdentifier
desired capability.
$capabilities["tunnelIdentifier"] = getenv('SC_IDENTIFIER')
.
The SC_IDENTIFIER
environment variable is automatically populated by Scrutinizer and contains
a unique identifier for the tunnel of the current build environment.