Miss any of our Open RFC calls?Watch the recordings here! »

@wdio/sauce-service

6.4.0 • Public • Published

WebdriverIO 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 and em/simulators) and can update the job metadata ('name', 'passed', 'tags', 'public', 'build', 'custom-data') and runs Sauce Connect if desired.
  • the Sauce Labs Real Device cloud (iOS and Android) and can ONLY update the job status to passed / failed

Installation

The easiest way is to keep @wdio/sauce-service as a devDependency in your package.json.

{
    "devDependencies": {
        "@wdio/sauce-service": "^6.3.6"
    }
}

You can simple do it by:

npm install @wdio/sauce-service --save-dev

Instructions on how to install WebdriverIO can be found here.

Configuration

In order to use the service for the virtual machine and em/simulator 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 want to use Sauce Connect you just need to set sauceConnect: true. If you would like to change data center to EU add region:'eu' as US data center is set as default (region only works on ^4.14.1 or ^5.0.0).

// wdio.conf.js
export.config = {
    // ...
    userprocess.env.SAUCE_USERNAME,
    keyprocess.env.SAUCE_ACCESS_KEY,
    services: [
        ['sauce', {
            sauceConnecttrue,
            sauceConnectOpts: {
                // ...
            }
        }]
    ],
    // ...
};

If you want to use the Real Device cloud just pass the testobject_api_key in the capabilities like this:

capabilities = [
    {
        deviceName: 'iPhone XS',
        // The api key that has a reference to the app-project in the RDC cloud
        testobject_api_key: process.env.SAUCE_RDC_ACCESS_KEY,
        // Some default settings
        // You can find more info in the TO Appium Basic Setup section
        platformName: 'iOS',
        platformVersion: '11.4'
    },
]

Sauce Service Options

In order to authorize to the Sauce Labs service your config needs to contain a user and key option.

sauceConnect

If true it runs Sauce Connect and opens a secure connection between a Sauce Labs virtual machine running your browser tests.

Type: Boolean
Default: false

(only for vm and or em/simulators)

sauceConnectOpts

Apply Sauce Connect options (e.g. to change port number or logFile settings). See this list for more information. Per default the service disables SC proxy auto-detection as via noAutodetect as this can be unreliable for some machines.

Type: Object
Default: { noAutodetect: true }

(only for vm and or em/simulators)

setJobNameInBeforeSuite

If true it updates the job name at the Sauce Labs job in the beforeSuite Hook. Attention: this comes at the cost of an additional call to Sauce Labs. The advantage of using this flag is the direct visibility of the job name in sauce labs also during the run time. This is especially useful for long running tests.

Type: Boolean
Default: false


Overriding generated name metadata

The service automatically generates a name for each test from the suite name, browser name and other information.

You can override this by providing a value for the name desired capability, but this will have the side effect of giving all tests the same name.


For more information on WebdriverIO see the homepage.

Install

npm i @wdio/sauce-service

DownloadsWeekly Downloads

38,142

Version

6.4.0

License

MIT

Unpacked Size

19.9 kB

Total Files

7

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar