Playwright
Automated Web Testing and Monitoring with Playwright
Last updated
Automated Web Testing and Monitoring with Playwright
Last updated
Install Playwright using yarn, npm, or via VS Code as shown below :
Using yarn:
Using npm:
Using VS Code:
Install the extension called 'Playwright Test for VSCode'.
Open the Command Palette and type 'Install Playwright' as shown in the reference below.
You will be asked to choose the browsers you would like to run your tests on. Type the following command in the terminal to open Playwright Inspector and Chromium (or, another web driver).
Type the URL of the application you would like to test in the browser and click ‘Record’ on the Playwright Inspector.
Go back to the application and perform a few actions to create scripts.
Copy the code and paste it to the file created under the extension '.spec.ts'.
Type the following command in the terminal to run the code:
To run all tests,
To run a specific test (say, sample.spec.ts),
To run a specific test (say, sample.spec.ts) in chromium,
To view the HTML report of the test result,
7. Integrate with PerfAgents
To take screenshots, add this line of code:
Screen recording is by default turned on for all tests in Playwright
To include multiple tests inside a single file, create each test as different Playwright "test" functions
Sequence monitoring now supports access to custom variables inside of test files as environmental variables
To use custom variables inside JavaScript or typescript fie