Playwright Python Overview
Introduction
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.
Once you create the scenario, select Runtime = Python.
Source
There are two ways to load your Playwright Python scenario into the Testable platform.
- Upload: Upload your Playwright Python 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.
- 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: test specs, requirements.txt (optional), etc.
How it Works
When you run a Playwright Python 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:
- Create a temporary working directory from which to run your test.
- Clone your repository (if Source = Version Control).
- Download any uploaded files. Any uploaded zip files are unzipped.
- Create a virtual env if a
requirements.txtfile is provided. Otherwise it will use a pre-built virtual env that haspytest-playwright(the sync pytest plugin for Playwright) +playwright(latest version). - If a new virtual env was created, run
pip install. - Run
pytest. We inject a plugin and conftest.py wrapper so that Testable can collect metrics, assertions, screenshots, commands, etc. - When your test launches a browser, we install the browser via Playwright as required.