Skip to content

ln0185/PlaywrightTesting

Repository files navigation

PlaywrightTesting

Overview

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.


Features

  • 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

Prerequisites

  • Node.js >= 18
  • npm >= 9

Installation

git clone https://github.com/ln0185/PlaywrightTesting.git
cd PlaywrightTesting
npm install
npx playwright install --with-deps

Running Tests Locally

# Run all tests
npx playwright test

# Run tests in headed mode (useful for debugging)
npx playwright test --headed

# Generate HTML report
npx playwright show-report

Project Structure

tests/ ├─ 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

GitHub Actions CI

The project is set up to run tests automatically in GitHub Actions.

Common Issues & Fixes

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.

Contributing

Pull requests are welcome. Please ensure tests pass locally before pushing.

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors