Playwright TypeScript Automation Framework
- Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast. Headless execution is supported for all browsers on all platforms.
- As Playwright is written by the creators of the Puppeteer, you would find a lot of similarities between them.
- Playwright has its own test runner for end-to-end tests, we call it Playwright Test.
- Cross-browser. Playwright supports all modern rendering engines including Chromium, WebKit, and Firefox.
- Cross-platform. Test on Windows, Linux, and macOS, locally or on CI, headless or headed.
- Cross-language. Use the Playwright API in TypeScript, JavaScript, Python, .NET, Java. The core framework is implemented using TypeScript.
- Playwright development is sponsored by Microsoft.
GitHub Documentation API reference Changelog
This is an automation framework using Playwright written in TypeScript.
- Visual Code
- NodeJS version > 14 (Node.js 14 is no longer supported since it reached its end-of-life on April 30, 2023.)
- Playwright 1.32.3
This is the quick and easy getting started assuming you already have git, Visual Code and NodeJS installed.
- Launch Visual Code
- File -> Open Folder OR ctrl+K ctrl+O
- Select project root folder
- Install all required packages for project defined in the package.json file: Playwright, etc
Open Terminal window in Visual Code (ctrl + `) then execute command:
npm install
Or go to project root folder then open CMD windows and execute command:
npm install
- Install Playwright Browsers
Open Terminal window in Visual Code (ctrl + `) then execute command:
npx playwright install
Or go to project root folder then open CMD windows and execute command:
npx playwright install
Debug
ENV=local npx playwright test --debug
## Run Tests
### Run tests on Chrome
please refer to script path in package.json
```sh
npm run test:local
npm run test:dev
run with trace on
npm run test:local-trace
npm run test:dev-trace
run smoke test on local machine
npm run smoke-test