This repository contains automated end-to-end UI tests for SauceDemo using Playwright and TypeScript.
It covers the full user workflow: login → browse products → add to cart → checkout → logout.
Tests follow the AAA (Arrange-Act-Assert) pattern and demonstrate professional QA practices.
- Login tests (positive/negative)
- Full shopping flow: products → cart → checkout → logout
- AAA pattern for clarity and maintainability
- Reusable login helper
- CI/CD integration (GitHub Actions)
- HTML test reports
- Node.js >= 18
- npm >= 9
git clone https://github.com/ln0185/PlaywrightTesting.git
cd PlaywrightTesting
npm install
npx playwright install --with-deps# Run all tests
npx playwright test
# Run tests in headed mode (useful for debugging)
npx playwright test --headed
# Generate HTML report
npx playwright show-reporttests/ ├─ login.spec.ts # Login tests ├─ shoppingFlow.spec.ts # Full end-to-end shopping flow including logout ├─ helpers.ts # Reusable login helper
playwright.config.ts # Playwright configuration package.json # Node dependencies README.md # Project documentation test-results/ # Raw test outputs playwright-report/ # HTML reports .github/workflows/ # GitHub Actions CI config
The project is set up to run tests automatically in GitHub Actions.
Browser download issues: Ensure browsers are installed using npx playwright install --with-deps.
Headless failures: Some tests may fail in headless mode. Use --headed for debugging locally.
Environment variables: Make sure any required secrets or URLs are set in GitHub Actions.
Pull requests are welcome. Please ensure tests pass locally before pushing.
MIT License