Sauce Labs Testrunner Toolkit is a containerized testing solution that simplifies user setup, speeds up test execution time and supports native Javascript frameworks like Puppeteer and Playwright for running end-to-end web tests with Sauce Labs.
- Docker installed
- Make sure the Docker daemon is running (e.g.
docker info
works in your terminal) - A Sauce Labs account; if you don't have one, start a free trial
Using NPM:
npm install -g saucectl
A Sauce Labs user name and access key are needed to post the test results. You can get your SAUCE_ACCESS_KEY
from
Account > User Settings in Sauce Labs.
To authenticate yourself, the following environment variables need to be set:
SAUCE_USERNAME
SAUCE_ACCESS_KEY
You can export them as follows:
export SAUCE_USERNAME=<your-username>
export SAUCE_ACCESS_KEY=<your-access-key>
If you are using a cloud CI/CD tool, we strongly suggest protecting these values through secrets or context variables.
npx saucectl new
This command will ask you to choose one of the frameworks:
After that, a ./sauce/config.yml
file and an example test under
the tests
directory will be created, where you can start working from.
npx saucectl run
This command will run the example test based on the ./.sauce/config.yml
file.
To learn more about saucectl
and its commands and flags,
please visit the saucectl repository.
saucectl
requires a configuration file to know what tests to run and what
framework to use. By default, .sauce/config.yml
will be the place where
saucectl
will look for its configuration.
NOTE: Test files need to match
(spec|test)
in their file name so they will be automatically detected as testfiles.
files:
- ./tests/file.spec.js
files:
- ./tests/*.spec.js
files:
- ./tests/cypress/
Image is hosted in Docker Hub
Base image + Cypress contains saucectl with different versions of Cypress.
context('Actions', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/actions')
})
it('.type() - type into a DOM element', () => {
// https://on.cypress.io/type
cy.get('.action-email')
.type('fake@email.com').should('have.value', 'fake@email.com')
})
})