BrowserStack Integration¶
By default, Scrutinizer allows you to test your website 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 BrowserStack.
Configuring your tests¶
To use BrowserStack, simply update the Selenium hub address in your tests to the URL provided by BrowserStack.
Since the webserver in the build environment is not reachable externally, it is also necessary to set-up a tunnel between the build environment and BrowserStack. To do that, simply set-up your BrowserStack secret key in the configuration:
build:
environment:
browserstack:
access_key: YOUR_ACCESS_KEY
This allows BrowserStack to access the web-server that is running in the build environment as if the browser was running directly in the build environment.
Besides the setup above, we also need to tell BrowserStack that it should route requests through the
tunnel, this is done via Selenium capabilities. Your testing framework should have documentation on
how to request certain capabilities. For BrowserStack, make sure to request
$capabilities["browserstack.local"] = true
.
Parallel builds¶
If you run multiple builds in parallel, there are potentially multiple tunnels established between
BrowserStack and Scrutinizer. To find the correct tunnel to route requests through, we need to set
a further capability that allows BrowserStack to pick the correct tunnel
$capabilities["browserstack.localIdentifier"] = getenv('BS_IDENTIFIER')
.
The BS_IDENTIFIER
environment variable is automatically populated by Scrutinizer and contains
a unique identifier for the tunnel of the current build environment.