- check
NodeJS
version
node -v
- new project with Playwright
npm init playwright@latest
- record tests for given site
npx playwright codegen https://demo-bank.vercel.app/
- run tests without browser GUI
npx playwright test
- run tests with browser GUI
npx playwright test --headed
- view report
npx playwright show-report
- run Trace Viewer on ZIP file while being in a folder with this ZIP:
npx playwright show-trace trace.zip
-
config file
playwright.config.ts
-
disable browsers, i.e. Firefox
// { // name: 'firefox', // use: { // ...devices['Desktop Firefox'], // }, // },
-
config file
package.json
'npm' instead of npx when you want to run script within other script{ "scripts": { "test": "npx playwright test", "test:headed": "npx playwright test --headed", "test:pulpit:headed": "npm run test tests/pulpit.spec.ts -- --headed" } }
- running one test:
test.only
- creating Test Suite:
test.describe(' [ test suite name ] ', () => {});
- test:
test(' [ test name ] ', () => {});