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.
- Playwright has its own test runner for end-to-end tests, we call it Playwright Test., it uses Expect assertions,and contains UI interface and a few nice loggers.
- Install Node and Typescript
- Run npn install
- To run the tests: npm run tests
- To run single test: npx playwright test landing-page.spec.ts
- To run a set of tests: npx playwright test tests/todo-page/ tests/landing-page/
- To run tests in headed mode: npm run tests-headed
- To open reporter: npm run report
Tests are located under tests/
- Note- By default, test files are run in parallel. Tests in a single file are run in order, in the same worker process. A test file can be configured to also run the test in parallel
They are the standard way of coping with large test suites, since, firstly, they enable us to write the tests using objects that are relevant to the application; and limit the use of selectors and other page-specific code, which makes the test code more robust and easier to maintain. Page objects also enable some level of flexibility when the structure of a page changes and we need to change our code to accommodate that. We are using BasePage class, it will contain all of the service in order to preserve DRY principle. All test pages should implement this class.
- Docker
- EXTRACT TO WORKFLOWS