run npm init playwright@latest
npx playwright test
npx playwright test --ui
npx playwright test --project=chromium
npx playwright test example
npx playwright test --debug
npx playwright codegen
;
- go to browser, proceed the needed steps. All steps are written on the Playwright Inspector. Stop it when needed copy/past the code to your xxx.spec.js
`npx playwright test`
run npx playwright test --trace on
Edit playwright.config.js
import path from "path"; export const STORAGE_STATE = path.join(__dirname, "playwright/.auth/user.json");
Add new projects { name: 'setup', testMatch :"/.setup.js" },
{ name: 'e2e tests logged in', testMatch :"**/*loggedin.spec.js", dependencies: ['setup'], use: { storageState: STORAGE_STATE } },