Playwright Library Overview
- Introduction
- Create a Scenario
- Source
- Testable APIs: CSVs, metrics, logging, execution info, live events
- Screenshots
Introduction
Check out the Getting Started with Playwright Library guide for a quick introduction on how to run your test script. 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:
- Create a new Test Case (Create Test button on the dashboard or Test Cases -> New… on the left nav), select Playwright during step 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 three ways to load your Playwright Javascript scenario into the Testable platform.
- Upload Files + Credit/Edit: Credit/edit the test spec and package.json files in the browser that are required to run your Playwright Library test. All other files can be uploaded in the Files section. Note that if you upload a zip file it will be unzipped on the test runner before execution.
- Upload All Files: Upload all files required to run your Playwright Library test without editing any of them in the browser. Note that if you upload a zip file it will be unzipped on the test runner before execution.
- Version Control: Download the test files from a version control repository. See our version control guide for more details.
Testable APIs: CSVs, metrics, logging, execution info
The testable-utils library provides several Testable APIs for:
- Capturing custom metrics
- Logging
- Execution Info
- Reading from a CSV file
- Timing code blocks
- 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.
Screenshots
Playwright has support for capturing browser screenshots. To take a screenshot use standard Playwright screenshot command:
// ... somewhere in your test
await page.screenshot({path: 'screenshot.png'});
Testable collects the results of any screenshot request into the test results. When run locally, the screenshot will be written to the current working directory.
All screenshots get reported back to the results by default. To only capture a sampling of screenshots toggle the Advanced Options -> Advanced Settings -> Capture All Output box in your configuration.