A POC for using Playwright.
Requires Node.js.
Dependencies can then be installed via the following command:
npm i
VSCode has a Playwright extension providing useful functionality such as running tests and picking locators.
Install:
- Playwright -
ms-playwright.playwright
- Prettier -
esbenp.prettier-vscode
- code formatting
Add the following file to the root of the project:
.vscode/settings.json
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
Run in an interactive UI mode:
npx playwright test --ui
Run all - runs all of the tests in the command line:
npx playwright test
Run a tag - runs a subset of tests tagged in feature files:
npx playwright test --grep "@api"
Run headed - runs tests in the browser:
npx playwright test --grep "@ui" --headed