This repository contains a comprehensive Playwright test suite for the SauceDemo website (https://www.saucedemo.com/). Tests follow Playwright best practices and the Page Object Model (POM) for maintainability.
-
Happy Path E2E (happy-path.spec.ts):
Validates the complete purchase flow including login, product selection, cart modification, and checkout. -
Login Tests (login.spec.ts):
Verifies login behavior for various users, including error handling for locked-out users. -
Session & Security (session-security.spec.ts):
Confirms that logout clears the session and redirects to the login page. -
Product Details (product-details.spec.ts):
Checks that product details (name, price) display correctly upon selection. -
Visual Regression (visual-user-layout.spec.ts):
Captures UI screenshots to document known visual differences. -
Animation & Transition (animation-transition.spec.ts):
Ensures smooth transitions for the hamburger menu animation. -
Negative Flows (negative-flow.spec.ts):
Tests error scenarios for invalid login attempts and checkout form validations. -
Accessibility (accessibility.spec.ts):
Uses Axe to analyze the inventory page for accessibility issues. -
Responsive Design (responsive.spec.ts):
Verifies layout correctness across multiple device viewports. -
Sorting & Filtering (sorting-filtering.spec.ts):
Ensures product sorting by price and filtering functionality work as expected. -
Problem User Images (problem-user-images.spec.ts):
Checks that all images for a problematic user share the same (incorrect) source. -
Performance Glitch (performance-glitch-login.spec.ts):
Measures login time for performance-challenged users ensuring longer durations but successful login. -
Error User Checkout (error-user-checkout.spec.ts):
Validates that missing mandatory checkout fields trigger appropriate error messages. -
Locked Out User (locked-out-user.spec.ts):
Confirms proper error messaging for locked-out user login attempts. -
Cart Item Count (cart-item-count.spec.ts):
Verifies that the shopping cart badge accurately reflects item additions and removals. -
Back to Products (back-to-products.spec.ts):
Checks navigation from the product details page back to the inventory page.
-
GitHub Actions:
- Triggers:
- On pushes and pull requests to
main
- On a scheduled basis: every Tuesday at 7 am Eastern (11 am UTC)
- Manually via the Actions tab
- On pushes and pull requests to
- Browsers: Tests run on Chromium, Firefox, WebKit, Pixel 8, and iPhone 15.
- Secrets: The SauceDemo password is stored as a GitHub secret.
- Triggers:
-
Local Testing Commands:
- Run tests:
npm test
- Lint code:
npm run lint
- Auto-fix lint issues:
npm run lint:fix
- Format code:
npm run format
- Run tests:
- src/tests/
Contains all test specifications. - src/pages/
Contains Page Object Model (POM) classes. - playwright.config.ts
Global Playwright test configuration. - .github/workflows/playwright.yml
GitHub Actions workflow configuration.