Playwright Test Overview

Introduction

Check out the Getting Started with Playwright Test guide for a quick introduction on how to run your Playwright Test suite on Testable. Also check out our Playwright overview guide to better understand how Playwright tests run on Testable in general.

Creating a Scenario

There are two ways to create a Playwright scenario:

  1. Create a new Test Case (Create Test button on the dashboard or Test Cases -> New… on the left nav), select Playwright during step 2.
  2. Go to an existing test case and click on the Scenario tab. Click the New Scenario button and select Playwright as the scenario type.

Source

There are two ways to load your Playwright Javascript scenario into the Testable platform.

  1. Upload: Upload your Playwright Test project either as a zip file or individual files/folders. If you upload a zip it can be extracted into the scenario or each time the test runs.
  2. Version Control: Download the test files from a version control repository. See our version control guide for more details.

Your project should include all the files needed for it to run locally: package.json, specs, playwright.config.ts file, and any other files.

How it Works

When you run a Playwright test each virtual user is assigned to a test runner as per your test configuration. Once the test runner receives the request to run your test it does the following steps:

  1. Create a temporary working directory from which to run your test.
  2. Clone your repository (if Source = Version Control).
  3. Download any uploaded files. Any uploaded zip files are unzipped.
  4. Run npm install
  5. Run npx playwright test. We inject a reporter and config wrapper so that Testable can collect metrics, assertions, screenshots, commands, etc.
  6. When your test launches a browser, we run npx playwright install [browser-type] as required.

Testable APIs: CSVs, metrics, logging, execution info

The testable-utils library provides several Testable APIs for:

  1. Capturing custom metrics
  2. Logging
  3. Execution Info
  4. Reading from a CSV file
  5. Timing code blocks
  6. Live manual events

All these APIs will work when run locally as well, mostly writing to the console where appropriate. See the testable-utils README for more details.