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!
npm install testcafe-reporter-saucelabsSet 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.
To configure the reporter, extend your TestCafe configuration file (e.g. .testcaferc.js):
module.exports = {
sauce: {
build: 'build123',
tags: ['app101'],
region: 'us-west-1',
},
};| Name | Description | Type |
|---|---|---|
build |
Sets a build ID. Default: '' |
string |
tags |
Specifies tags to add to the uploaded Sauce job for easy categorization. Default: [] |
string[] |
region |
Sets the region in which the service will run. Valid options are us-west-1 or eu-central-1. Default: 'us-west-1' |
'us-west-1' | 'eu-central-1' |
When you run tests from the command line, specify the reporter name using the --reporter option:
testcafe chrome 'path/to/test/file.js' --reporter saucelabsWhen using the API, pass the reporter name to the reporter() method:
testCafe
.createRunner()
.src('path/to/test/file.js')
.browsers('chrome')
.reporter('saucelabs') // <-
.run();Custom artifacts, such as log files or screenshots, can be uploaded during TestCafe
tests using the t.report API. Specify the sauceAttachments option to include
artifacts. Paths for artifacts are relative to the current test execution directory.
Add the following example to your test:
await t.report({
sauceAttachments: ['my_screenshots/this-is-fine.png', 'test.log'],
});