Skip to main content

Playwright Quickstart

This page explains how to run your Playwright tests in Sauce Orchestrate with saucectl.

What You'll Need

How Orchestrate Works

Sauce Orchestrate uses container technology to package and run your tests in the Sauce Labs cloud. See How it Works for more details.

The following example uses a project with a saucectl configuration file that is set up to run in Orchestrate. See saucectl Configuration for more information about the configuration and run options available. The example also has a Dockerfile for building the container image. See Building Images for more information about creating your own container images.

Step 1: Clone the Project

git clone https://github.com/saucelabs/saucectl-imagerunner-example.git

Step 2: Install saucectl

Navigate to the Playwright example in the project you just cloned, then install saucectl.

cd saucectl-imagerunner-example/playwright
npm install -g saucectl

saucectl requires access to a valid Sauce Labs account.

Use Environment Variables

saucectl uses your Sauce Labs credentials as environment variables and prioritizes them over values in the credentials.yml file when both are present. If you have set them, you may skip this step. Not sure if you have them set? Run the following command to check:

echo $SAUCE_USERNAME
echo $SAUCE_ACCESS_KEY

If a value is returned for both variables, they are set.

  1. Run the configure command:

    saucectl configure
  2. Enter your Sauce Labs Username and Access Key at the prompts.

note

The saucectl configure command will not set system environment variables or alter your .bashrc or other command-line profiles to set them by default. To do this, you must run export commands as specified in our environment variables page.

Step 4: Run Tests Using saucectl

Run the Playwright tests.

saucectl run

The console displays the running tests, distinguishing which mode is running.

After the tests are run, saucectl outputs the command logs from Orchestrate and downloads the artifacts from the container.

The following is an example CLI output.

2:52:05 INF Downloading artifacts archive
12:52:07 INF Suites in progress: 0

Name Duration Status Attempts
────────────────────────────────────────────────────────────────────────────
✔ Playwright in ImageRunner 2m16s Succeeded 1
────────────────────────────────────────────────────────────────────────────
✔ All suites have passed 2m32s

The results and test assets are also available immediately following test completion in your Sauce Labs account.