How it works
How it works
Every command does the same four things: find your Credentials, pick a Region, call one Sauce Labs endpoint and print the result.
- Step 1
Find Credentials
Flags win over the environment:
--usernameand--access-key, elseSAUCE_USERNAMEandSAUCE_ACCESS_KEY. A.envor.env.localfile in the working directory is loaded first and never overwrites a variable that is already set. - Step 2
Pick a Region
--region, elseSAUCE_REGION, elseus-west-1. The Region selects the API host,api.<region>.saucelabs.com. - Step 3
Call the API
App Storage commands call
/v1/storage/…, Virtual-device job commands/rest/v1/<username>/jobsand Real-device job commands/v1/rdc/jobs, with HTTP basic auth. - Step 4
Print and exit
Terse output by default, the full response with
--verbose, nothing with--silent. The exit code tells a script what happened.
Checked before the request
Options are validated before any request is sent: the Region, --output, --kind and --visibility must be one of the listed values, --per-page must be 1 to 100, and --custom-data must be a JSON object.
Missing Credentials exit with code 2 and name the flag and variable to set. --help and --version work without any Credentials.
Script App Storage and Jobs without curl
A Node.js command line tool you run on your machine or in CI, with your own Sauce Labs account. Nothing in between.