testcafe-browser-provider-sauce
v0.3.0
Published
Official Sauce Labs TestCafe browser provider plugin.
Downloads
17
Maintainers
Readme
testcafe-browser-provider-sauce
This is the official Sauce Labs browser provider plugin for TestCafe.
:construction: This plugin is currently in beta. We caution against using it in production pipelines. We do seek feedback and encourage you to report any issues you encounter.
Install
npm install testcafe-browser-provider-sauce
Setup
Before using this plugin, you need to set the SAUCE_USERNAME
and
SAUCE_ACCESS_KEY
environment variables. Your Sauce Labs Username and Access
Key are available from your dashboard.
Furthermore, a Sauce Connect
tunnel is required to run tests on Sauce Labs. After launching a tunnel, specify
the tunnel name using the SAUCE_TUNNEL_NAME
environment variable.
Usage
You can determine the available browser aliases by running
testcafe -b sauce
When you run tests from the command line, use the alias when specifying browsers:
testcafe "sauce:chrome@latest:Windows 11" path/to/test/file.js
When you use API, pass the alias to the browsers()
method:
testCafe
.createRunner()
.src('path/to/test/file.js')
.browsers('sauce:chrome@latest:Windows 11')
.run();
Enhanced Reporting
This plugin can be further enhanced when used in conjunction with testcafe-reporter-saucelabs.
Our reporter will automatically detect if TestCafe is running remote browser sessions on Sauce Labs and attach test results to the corresponding Sauce Labs job.
Note: The build name and tags as defined by the provider plugin take precedence over those defined by the reporter.
testcafe "sauce:chrome@latest:Windows 11" path/to/test/file.js --reporter saucelabs
Configuration
Full overview of the available configuration options.
Mandatory environment variables:
SAUCE_USERNAME
- Your Sauce Labs username.SAUCE_ACCESS_KEY
- Your Sauce Labs access key.SAUCE_TUNNEL_NAME
- The Sauce Connect tunnel name.
Optional environment variables:
SAUCE_JOB_NAME
- Specify the job name for all jobs. Defaults toTestCafe via ${browserName}@${browserVersion} on ${platformName}
.SAUCE_BUILD
- All jobs will be associated with this build. The default value is randomly generated.SAUCE_TAGS
- A comma separated list of tags to apply to all jobs.SAUCE_REGION
- The Sauce Labs region. Valid values areus-west-1
(default) oreu-central-1
.SAUCE_SCREEN_RESOLUTION
- The desktop browser screen resolution (not applicable to mobile). The format is1920x1080
.SAUCE_TUNNEL_WAIT_SEC
- The amount of time to wait, in seconds, for the tunnel defined bySAUCE_TUNNEL_NAME
to be ready. Default is "30".