Sauce Visual Snapshots CLI
The Sauce Visual Snapshots CLI (command line interface) allows you to create Visual snapshots of provided PDF documents.
What You'll Need
- A Sauce Labs account (Log in or sign up for a free trial license)
- Your Sauce Labs Username and Access Key to be set in
SAUCE_USERNAME
andSAUCE_ACCESS_KEY
environment variables
export SAUCE_USERNAME=__YOUR_SAUCE_USERNAME__
export SAUCE_ACCESS_KEY=__YOUR_SAUCE_ACCESS_KEY__
System Requirements
- Node.js: Version 18.x or higher
- npx: Included with Node.js (version 10.x or higher)
- Operating System: macOS 10.15+, Linux, or Windows 10/11
Usage
You can run Sauce Visual CLI using:
npx @saucelabs/visual-snapshots [command] [paths/globs] [options]
Run the following command to see the list of available commands:
npx @saucelabs/visual-snapshots help
Commands
pdf
Creates Visual snapshots of each page of provided PDF document
Usage: npx @saucelabs/visual-snapshots pdf [options]
Example: npx @saucelabs/visual-snapshots pdf ./example.pdf ./dir_with_pdfs ./some_dir/**/*.pdf
Required
paths/globs
: Paths to PDF files, glob patterns, or paths to directories containing PDF files.-u
,--user
: Your Sauce Labs username. If not provided, the value ofSAUCE_USERNAME
environment variable will be checked.-k
,--key
: Your Sauce Labs access key. If not provided, the value ofSAUCE_ACCESS_KEY
environment variable will be checked.
Options
-r
,--region
: The Sauce Labs region. Possible values:us-west-1
,eu-central-1
,us-east-4
. If not provided, the value ofSAUCE_REGION
environment variable will be checked. Default:us-west-1
.-n
,--build-name
: The name you would like to appear in the Sauce Visual dashboard. If not provided, the value ofSAUCE_VISUAL_BUILD_NAME
environment variable will be checked. Default:undefined
(appears asUnnamed Build
in the Sauce Visual dashboard).-b
,--branch
: The branch name you would like to associate this build with. We recommend using your current VCS branch in CI. If not provided, the value ofSAUCE_VISUAL_BRANCH
environment variable will be checked. Default:undefined
.-d
,--default-branch
: Main branch name to associate the build with. Usuallymain
ormaster
. Read more here. If not provided, the value ofSAUCE_VISUAL_DEFAULT_BRANCH
environment variable will be checked. Default:undefined
.-p
,--project
: Label/project to associate the build with. If not provided, the value ofSAUCE_VISUAL_PROJECT
environment variable will be checked. Default:undefined
.--build-id
: For advanced users: A user-supplied Sauce Labs Visual build ID. Can be used to create builds in advance using the GraphQL API. This can be used to parallelize tests with multiple browsers, shard, or more. If not provided, the value ofSAUCE_VISUAL_BUILD_ID
environment variable will be checked. Default:undefined
.--custom-id
: For advanced users. A user-supplied custom ID to identify this build. Can be used in CI to identify / check / re-check the status of a single build. Usage suggestions: CI pipeline ID. If not provided, the value ofSAUCE_VISUAL_CUSTOM_ID
environment variable will be checked. Default:undefined
.--suite-name
: The name of the suite you would like to appear in the Sauce Visual dashboard. Default:undefined
(appears asUnknown
in the Sauce Visual dashboard).--test-name
: The name of the test you would like to appear in the Sauce Visual dashboard. Supports the following parameters:{filename}
. Default:{filename}
.--snapshot-name
The name of the snapshot you would like to appear in the Sauce Visual dashboard. Supports the following parameters:{filename}
,{page}
. Default:{filename}-{page}
.-j
,--concurrency
: Maximum count of simultaneous uploads. Default: the number of CPUs.
help
Displays all available commands. In addition to the help
command there's also the -h
, --help
option available for every command to display the available options.
Usage: npx @saucelabs/visual-snapshots help
Example: npx @saucelabs/visual-snapshots pdf --help