A simple Playwright test suite for practicing end-to-end (combining api and ui) testing patterns.
- Node.js (>= 18) / npm
- Browsers installed via Playwright (see setup)
npm install
npx playwright installRun the full suite:
npm testRun a single test file:
npx playwright test tests/account/user.spec.tsRun in headed mode (opens browser window):
npx playwright test --headedplaywright.config.ts– Playwright configurationtests/– Test suites and page objectsaccount/– Account-related testsauth/– Authentication testscheckout/– Checkout/cart testsfixtures/– Test fixtures for shared setuputils/– Helpers and utilities
- Tests use Playwright Test fixtures defined under
tests/fixtures. - Adjust base URLs and test data in fixtures as needed.
- Use EvilTester example basicart application as target.
- Run tests on container.
- Run tests on Github actions.
- Solve common scenarios on automation.
- Combine api and ui usage in one single test.
- Use fixtures as common steps to avoid code duplication.
- Use POM to provide maintanability.
- Set sessionStorage and log in as authenticated user.
- Mock api response to emulate failed response.
- Accessibility check on a broken site.
- Aim to address some important points on automation pointed out by Soujorit Das in this post.