Skip to content

saucelabs/testcafe-reporter

Repository files navigation

testcafe-reporter-saucelabs

This is the Sauce Labs reporter plugin for TestCafe.

Tip: You can also use this reporter together with the Sauce Labs Browser Provider for running tests against remote browsers from Sauce Labs!

Installation

npm install testcafe-reporter-saucelabs

Configuration

Sauce Labs Credentials

Set the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables to allow the plugin to report your results to Sauce Labs. Your Sauce Labs Username and Access Key are available from your dashboard.

Alternatively, you can use the username and accessKey fields in the reporter configuration.

TestCafe Configuration

To configure the reporter, extend your TestCafe configuration file (e.g. .testcaferc.js):

module.exports = {
  sauce: {
    build: 'build123',
    tags: ['app101'],
    region: 'us-west-1',
  },
};

Usage

When you run tests from the command line, specify the reporter name using the --reporter option:

testcafe chrome 'path/to/test/file.js' --reporter saucelabs

When using the API, pass the reporter name to the reporter() method:

testCafe
  .createRunner()
  .src('path/to/test/file.js')
  .browsers('chrome')
  .reporter('saucelabs') // <-
  .run();