Playwright is a testing tool for web applications using modern JavaScript frameworks.
Playwright enables you to write end-to-end tests and can test anything that runs on a browser.
Article contents:
Limitations
- Currently imageVersion property will run a browser version which is not compatible with the requested image version.
- The video file attached to the test report can't be download.
These should be fixed in the next release (22.8)
Requirements
Playwright support is available only in SaaS clouds.
In order to run Playwright projects in Cloud, you need to have a Docker Swarm and Execution Service set up in your environment.
Playwright projects are run inside containers in Docker Swarm via Execution Service API.
In order to run Playwright project Cloud need to have Browser license.
Execution Service API
The role of the user performing the Rest Operation is specified by the Authorization header.
For more information please visit How To Execute Rest API, for a detailed example.
Start a Playwright execution
Enables users to run Playwright projects.
Playwright projects are run asynchronously, the response received is immediate.
POST /api/v1/executions |
---|
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
type | String | Yes | Specify execution type. for Playwright use Playwright |
project | File | Yes | The Playwright project to run. |
conf | JSON String | No | A configuration file for the requested execution. |
Playwright project
Playwright project can contain a config file named playwright.config.js which must be located under the root folder.
In order to have a video in the report add the following property to the config file: video: 'on' under the 'use' section.
Playwright configuration
In order to run Playwright project, a configuration must be supplied.
There are 2 options to add configuration:
- add the conf parameter as a JSON string to the POST request.
- a file named digitalai.json with the required configuration in the root directory of the project
When supplying both options, the digitalai.json is ignored
Configuration parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
browsers | List | Yes | A list of browser names and playwright versions to run the project on. each entry in the list is as follows: { "browser": "browser name" "imageVersion": "playwright image version" } Supported browsers are Chromium, Firefox and Webkit. |
Get Playwright execution status
Get the Playwright execution status
Get status privileges:
- User can get only his own session status
- Project admin can get his own session status and can get statuses from other users of his project
- Admin can get any session status on his cloud
GET /api/v1/executions/{Execution_ID}/status |
---|
Cancel Playwright execution
Cancel Playwright execution project by test run id.
Cancel privileges:
- User can cancel only his own execution
- Project admin can cancel his own execution and can cancel executions from other users of his project
- Admin can cancel any execution on his cloud
PUT /api/v1/executions/{executionId}/actions/cancel |
---|