Sauce Service
WebdriverIO service that provides a better integration into Sauce Labs. This service can be used for:
- the Sauce Labs Virtual Machine Cloud (Desktop Web/Emulator/Simulator)
- the Sauce Labs Real Device cloud (iOS and Android)
It can update the job metadata ('name'*, 'passed', 'tags', 'public', 'build', 'custom-data') and runs Sauce Connect if desired.
What else will this service do for you:
- By default the Sauce Service will update the 'name' of the job when the job starts. This will give you the option to update the name at any given point in time.
- You can define a
setJobName
parameter and customise the job name according to your capabilities, options and suite title - The Sauce Service will also push the error stack of a failed test to the Sauce Labs commands tab
- It will allow you to automatically configure and spin up Sauce Connect
- And it will set context points in your command list to identify which commands were executed in what test
Installation
The easiest way is to keep @wdio/sauce-service
as a devDependency in your package.json
, via:
npm install @wdio/sauce-service --save-dev
Instructions on how to install WebdriverIO
can be found here.
Configuration
To use the service for the Virtual Desktop/Emulator/Simulator Machine and Real Device cloud you need to set user
and key
in your wdio.conf.js
file. It will automatically use Sauce Labs to run your integration tests. If you run your tests on Sauce Labs you can specify the region you want to run your tests in via the region
property. Available short handles for regions are us
(default) and eu
. These regions are used for the Sauce Labs VM cloud and the Sauce Labs Real Device Cloud. If you don't provide the region, it defaults to us
.
If you want WebdriverIO to automatically spin up a Sauce Connect tunnel, you need to set sauceConnect: true
. If you would like to change the data center to EU add region:'eu'
as US data center is set as default.
// wdio.conf.js
export const config = {
// ...
user: process.env.SAUCE_USERNAME,
key: process.env.SAUCE_ACCESS_KEY,
region: 'us', // or 'eu'
services: [
['sauce', {
sauceConnect: true,
sauceConnectOpts: {
// ...
}
}]
],
// ...
};
If you want to use an existing Sauce Connect tunnel you only need to provide a tunnelIdentifier
, or if you are using a parent tunnel, include the parentTunnel
in the capabilities like this:
- Tunnel Identifier
- Parent Tunnel
export const config = {
// ...
{
browserName: 'chrome',
platformName: 'Windows 10',
browserVersion: 'latest',
// Sauce options can be found here https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options
'sauce:options': {
tunnelIdentifier: 'YourTunnelName',
// Example options
build: 'your-build-name',
screenResolution: '1600x1200',
// ...
},
},
// ...
};