# ahmadkhalil05/saucedemo-playwright-e2e architecture

> Architecture diagram of the GitHub repository ahmadkhalil05/saucedemo-playwright-e2e, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmadkhalil05/saucedemo-playwright-e2e
- Repository: https://github.com/ahmadkhalil05/saucedemo-playwright-e2e

## Overview

This repository is a Playwright end-to-end automation framework for SauceDemo. Its main workflow runs customer-journey specifications through page objects, which drive browser interactions against the application. Authentication setup saves reusable browser state; other major capabilities include data-driven login and product scenarios, sorting, checkout, cross-browser coverage, and failure artifacts. The test specifications and data files are listed in the tree but were not excerpted, so their links rely on README descriptions; uncertain per-test call details are not expanded.

Main entry points: [`pages/CartPage.ts`](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/pages/CartPage.ts) (Cart Page), [`tests/add-to-cart.spec.ts`](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/add-to-cart.spec.ts) (Add To Cart Tests), [`tests/checkout.spec.ts`](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/checkout.spec.ts) (Checkout Tests), [`playwright.config.ts`](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/playwright.config.ts) (Playwright Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scenarios["Test Scenarios"]
  node_add_tests["Add To Cart Tests"]
  node_remove_tests["Remove From Cart Tests"]
  node_checkout_tests["Checkout Tests<br/>[checkout.spec.ts]"]
  node_login_tests["Login Tests<br/>[login.spec.ts]"]
  node_sort_tests["Sorting Tests<br/>[sort.spec.ts]"]
  node_auth_setup["Authentication Setup<br/>[auth.setup.ts]"]
end

subgraph group_pages["Page Objects"]
  node_login_page["Login Page<br/>[LoginPage.ts]"]
  node_inventory_page["Inventory Page<br/>[InventoryPage.ts]"]
  node_cart_page["Cart Page<br/>[CartPage.ts]"]
  node_checkout_page["Checkout Page<br/>[CheckoutPage.ts]"]
end

subgraph group_support["Test Support"]
  node_login_data["Invalid Login Data"]
  node_product_data["Product Data<br/>[products.json]"]
  node_environment["Environment Settings<br/>[env.ts]"]
  node_playwright_config["Playwright Configuration"]
  node_auth_state["Saved Browser State"]
end

node_customer(("Test Operator"))
node_playwright["Playwright Browser API"]
node_saucedemo["SauceDemo Application"]

node_customer -->|"runs configured tests"| node_playwright_config
node_login_tests -->|"uses page object"| node_login_page
node_auth_setup -->|"uses page object"| node_login_page
node_add_tests -->|"uses page object"| node_inventory_page
node_add_tests -->|"uses page object"| node_cart_page
node_remove_tests -->|"uses page object"| node_cart_page
node_checkout_tests -->|"uses page object"| node_cart_page
node_checkout_tests -->|"uses page object"| node_checkout_page
node_sort_tests -->|"uses page object"| node_inventory_page
node_login_tests -->|"loads scenarios"| node_login_data
node_add_tests -->|"uses selections"| node_product_data
node_remove_tests -->|"uses selections"| node_product_data
node_checkout_tests -->|"uses selections"| node_product_data
node_auth_setup -->|"saves session"| node_auth_state
node_playwright_config -->|"reuses session"| node_auth_state
node_playwright_config -->|"configures projects"| node_playwright
node_login_page -->|"drives browser"| node_playwright
node_inventory_page -->|"drives browser"| node_playwright
node_cart_page -->|"drives browser"| node_playwright
node_checkout_page -->|"drives browser"| node_playwright
node_playwright -->|"automates journeys"| node_saucedemo

click node_add_tests "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/add-to-cart.spec.ts"
click node_remove_tests "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/remove-from-cart.spec.ts"
click node_checkout_tests "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/checkout.spec.ts"
click node_login_tests "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/login.spec.ts"
click node_sort_tests "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/sort.spec.ts"
click node_auth_setup "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/auth.setup.ts"
click node_login_page "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/pages/LoginPage.ts"
click node_inventory_page "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/pages/InventoryPage.ts"
click node_cart_page "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/pages/CartPage.ts"
click node_checkout_page "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/pages/CheckoutPage.ts"
click node_login_data "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/test-data/invalid-login-cases.json"
click node_product_data "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/test-data/products.json"
click node_environment "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/utils/env.ts"
click node_playwright_config "https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/playwright.config.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_add_tests,node_remove_tests,node_checkout_tests,node_login_tests,node_sort_tests,node_auth_setup,node_playwright toneBlue
class node_login_page,node_inventory_page,node_cart_page,node_checkout_page toneAmber
class node_login_data,node_product_data,node_environment,node_playwright_config,node_auth_state toneMint
class node_customer,node_saucedemo toneIndigo
```

## Components

### Test Scenarios

- [Add To Cart Tests](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/add-to-cart.spec.ts): `tests/add-to-cart.spec.ts`
- [Remove From Cart Tests](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/remove-from-cart.spec.ts): `tests/remove-from-cart.spec.ts`
- [Checkout Tests](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/checkout.spec.ts): `tests/checkout.spec.ts`
- [Login Tests](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/login.spec.ts): `tests/login.spec.ts`
- [Sorting Tests](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/sort.spec.ts): `tests/sort.spec.ts`
- [Authentication Setup](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/tests/auth.setup.ts): `tests/auth.setup.ts`

### Page Objects

- [Login Page](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/pages/LoginPage.ts): `pages/LoginPage.ts`
- [Inventory Page](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/pages/InventoryPage.ts): `pages/InventoryPage.ts`
- [Cart Page](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/pages/CartPage.ts): `pages/CartPage.ts`
- [Checkout Page](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/pages/CheckoutPage.ts): `pages/CheckoutPage.ts`

### Test Support

- [Invalid Login Data](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/test-data/invalid-login-cases.json): `test-data/invalid-login-cases.json`
- [Product Data](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/test-data/products.json): `test-data/products.json`
- [Environment Settings](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/utils/env.ts): `utils/env.ts`
- [Playwright Configuration](https://github.com/ahmadkhalil05/saucedemo-playwright-e2e/blob/main/playwright.config.ts): `playwright.config.ts`
- **Saved Browser State**

### Other components

- **Test Operator**
- **Playwright Browser API**
- **SauceDemo Application**

## Connections

- Test Operator → Playwright Configuration: runs configured tests (evidence: `README.md`)
- Login Tests → Login Page: uses page object (evidence: `README.md`)
- Authentication Setup → Login Page: uses page object (evidence: `README.md`)
- Add To Cart Tests → Inventory Page: uses page object (evidence: `README.md`)
- Add To Cart Tests → Cart Page: uses page object (evidence: `README.md`)
- Remove From Cart Tests → Cart Page: uses page object (evidence: `README.md`)
- Checkout Tests → Cart Page: uses page object (evidence: `README.md`)
- Checkout Tests → Checkout Page: uses page object (evidence: `README.md`)
- Sorting Tests → Inventory Page: uses page object (evidence: `README.md`)
- Login Tests → Invalid Login Data: loads scenarios (evidence: `README.md`)
- Add To Cart Tests → Product Data: uses selections (evidence: `README.md`)
- Remove From Cart Tests → Product Data: uses selections (evidence: `README.md`)
- Checkout Tests → Product Data: uses selections (evidence: `README.md`)
- Authentication Setup → Saved Browser State: saves session (evidence: `README.md`)
- Playwright Configuration → Saved Browser State: reuses session (evidence: `README.md`)
- Playwright Configuration → Playwright Browser API: configures projects (evidence: `playwright.config.ts`)
- Login Page → Playwright Browser API: drives browser (evidence: `pages/LoginPage.ts`)
- Inventory Page → Playwright Browser API: drives browser (evidence: `pages/InventoryPage.ts`)
- Cart Page → Playwright Browser API: drives browser (evidence: `pages/CartPage.ts`)
- Checkout Page → Playwright Browser API: drives browser (evidence: `pages/CheckoutPage.ts`)
- Playwright Browser API → SauceDemo Application: automates journeys (evidence: `README.md`)
