Skip to content

bpechersky/playwright-saucedemo-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Playwright + Pytest + Page Object Model for SauceDemo

πŸš€ Overview

This project is a Playwright UI automation framework in Python designed to test the SauceDemo application using:

Playwright (Python)

Pytest

Page Object Model (POM)

Pytest fixtures

Allure reporting

GitHub Actions CI pipeline

It demonstrates a clean, scalable, interview-ready automation architecture suitable for professional SDET portfolios.

πŸ“ Project Structure playwright-saucedemo-python/ β”‚ β”œβ”€β”€ pages/ β”‚ β”œβ”€β”€ base_page.py β”‚ β”œβ”€β”€ login_page.py β”‚ β”œβ”€β”€ inventory_page.py β”‚ β”œβ”€β”€ cart_page.py β”‚ β”œβ”€β”€ checkout_page.py β”‚ └── checkout_overview_page.py β”‚ β”œβ”€β”€ tests/ β”‚ β”œβ”€β”€ test_login.py β”‚ └── test_checkout_flow.py β”‚ β”œβ”€β”€ conftest.py β”œβ”€β”€ pytest.ini β”œβ”€β”€ requirements.txt └── README.md

πŸ§ͺ Features βœ” Playwright Python

Browser automation using Chromium, Firefox, and WebKit

Native trace viewer

Headless/headed mode

Slow-motion runs (--slowmo)

βœ” Pytest Test Framework

Fixtures (page, login_page)

Test parametrization

Test grouping and tagging

βœ” Page Object Model (POM)

Each page is represented as a class

Clean separation of locators, actions, and assertions

βœ” Full E2E Flow Included

Login

Add item to cart

Checkout

Validate order success

βœ” Allure Reporting

Beautiful report UI + dashboards

Auto-attach traces, screenshots, steps

GitHub Actions-compatible

πŸƒβ€β™‚οΈ Getting Started 1️⃣ Create virtual environment python -m venv .venv .venv\Scripts\activate

2️⃣ Install dependencies pip install -r requirements.txt

3️⃣ Install Playwright browsers playwright install

β–Ά Running Tests Headed + slow motion (recommended) pytest --headed --slowmo 500

Normal run pytest

πŸ“Š Allure Reporting Install Allure (Windows)

Download Allure from: https://github.com/allure-framework/allure2/releases

Unzip and add allure/bin to your system PATH.

Verify:

allure --version

Run tests with Allure pytest --alluredir=allure-results

Generate report locally allure serve allure-results

πŸ” GitHub Actions CI (Playwright + Pytest + Allure)

This project includes a ready-to-run GitHub Actions workflow that:

Installs Python

Installs Playwright browsers

Runs tests

Uploads Allure results as an artifact

Runs tests on every push + PR

🧬 Roadmap / Future Enhancements

Add reporting screenshots & videos

Add Docker support

Extend POM to cover all SauceDemo pages

Add API + UI combo tests

πŸ“œ License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages