An open API service indexing awesome lists of open source software.

https://github.com/jptrp/saucedemo-playwright

Playwright + TypeScript automation framework for SauceDemo with comprehensive test coverage
https://github.com/jptrp/saucedemo-playwright

automation automation-testing playwright playwright-tests playwright-typescript pomme qa qa-automation test-automation testing typescript

Last synced: about 2 months ago
JSON representation

Playwright + TypeScript automation framework for SauceDemo with comprehensive test coverage

Awesome Lists containing this project

README

          


πŸ§ͺ Playwright UI Automation Framework


Modern, maintainable end-to-end automation using Playwright, TypeScript, and the Page Object Model.



TypeScript
Playwright
GitHub Actions
Tests


POM
Coverage

---

## 🎯 Why This Project Matters

**Most QA portfolios only show simple scripts. This repo demonstrates real-world automation capability:**

- βœ… **Clean Architecture** - Page Object Model pattern with proper encapsulation and reusability
- βœ… **Comprehensive Coverage** - 25+ tests across authentication, inventory, cart, and checkout flows
- βœ… **Production-Ready** - CI/CD pipeline with GitHub Actions, automated testing on every push
- βœ… **Modern Stack** - TypeScript with Playwright, following current industry standards
- βœ… **Best Practices** - Centralized test data, JSDoc documentation, AAA test pattern
- βœ… **Robust Selectors** - Data-test attributes and defensive locator strategies
- βœ… **Cross-Browser** - Configured for Chromium, Firefox, and WebKit testing
- βœ… **Professional Reporting** - HTML reports with screenshots and videos on failure
- βœ… **Maintainable** - DRY principles, clear naming conventions, and comprehensive comments

**This isn't just test automationβ€”it's a scalable framework that shows enterprise-level thinking.**

---

## 🎬 Demo

![Test Execution Demo](./demo.gif)

*Automated end-to-end checkout flow running in Chromium*

---

## πŸ“‹ Overview

A production-ready UI automation framework built using Playwright, TypeScript, and the Page Object Model (POM) pattern.
This project demonstrates clean automation architecture, comprehensive test coverage, and CI/CD integration β€” all aligned with real-world QA Engineer workflows.

πŸ“š **Documentation**:
- [Test Strategy](./docs/TestStrategy.md) - Comprehensive testing approach and methodology
- [Test Plan](./docs/TestPlan.md) - Detailed test planning and execution strategy
- [Architecture](./docs/Architecture.md) - Framework design and technical architecture

---

## πŸš€ Tech Stack

- Playwright (TypeScript)
- Page Object Model (POM)
- GitHub Actions (Continuous Integration)
- Node.js
- HTML Reporter
- Cross-browser testing (Chromium, Firefox, WebKit)

---

## πŸ“ Project Structure

```text
saucedemo-playwright/
β”œβ”€β”€ tests/ # Test specs
β”‚ β”œβ”€β”€ login.spec.ts
β”‚ β”œβ”€β”€ inventory.spec.ts
β”‚ β”œβ”€β”€ cart.spec.ts
β”‚ └── checkout.spec.ts
β”‚
β”œβ”€β”€ pages/ # Page Object Model classes
β”‚ β”œβ”€β”€ BasePage.ts
β”‚ β”œβ”€β”€ LoginPage.ts
β”‚ β”œβ”€β”€ InventoryPage.ts
β”‚ β”œβ”€β”€ CartPage.ts
β”‚ └── CheckoutPage.ts
β”‚
β”œβ”€β”€ fixtures/ # Test data
β”‚ └── testData.ts
β”‚
β”œβ”€β”€ playwright.config.ts # Global Playwright settings
β”œβ”€β”€ package.json
β”‚
└── .github/workflows/ # CI pipeline
└── playwright.yml
```

---

## πŸ§ͺ Features & Tests Included

### βœ”οΈ Login tests

- Valid login
- Invalid login (error validation)

### βœ”οΈ Inventory tests

- Add item to cart
- Navigate from inventory β†’ cart

### βœ”οΈ Cart & Checkout tests

- Start checkout
- Fill user information
- Complete the purchase
- Validate confirmation screen

### βœ”οΈ Page Object Model (POM)

- LoginPage
- InventoryPage
- CartPage
- CheckoutPage
- BasePage (shared functionality)

### βœ”οΈ CI Integration

- GitHub Actions workflow triggers on push and pull requests
- Ensures all tests run headless in CI

---

## ▢️ Running Tests Locally

Install dependencies:

```bash
npm install
```

Run all Playwright tests:

```bash
npx playwright test
```

View the HTML test report:

```bash
npx playwright show-report
```

Run tests in headed mode:

```bash
npx playwright test --headed
```

Run a specific test file:

```bash
npx playwright test tests/login.spec.ts
```

---

## πŸ€– Continuous Integration (CI)

GitHub Actions workflow automatically runs:

- `npm ci`
- Install Playwright browsers
- All test specs
- Generate report artifacts

On:

- Push to main
- Pull requests

Workflow file: `.github/workflows/playwright.yml`