How xotabu4/demo-playwright-workshop works
Project type and purpose
• This is an end-to-end (E2E) test automation suite built on Playwright (TypeScript, Node.js) for a demo e-commerce application (“shopdemo…”). Its goal is to validate UI flows and API interactions against two deployed storefronts.
File structure
• Top-level config & scripts
• playwright.config.ts – Playwright test runner configuration
• package.json, .eslintrc, tsconfig.json
• API layer (api/)
• api.ts, auth.controller.ts, requestHolder.ts, models.d.ts
• Page Object Model (app/)
• abstractClasses.ts
• component/ (reusable UI widgets)
• page/ (pages and page-specific components)
• Fixtures (fixtures/)
• index.ts (shared test fixtures)
• lazy/ (lazy-loaded or on-demand fixtures)
• Miscellaneous helpers (misc/)
• cacheWarmer.ts
• reporters/ (custom Playwright reporters: slowStepReporter.ts, step.ts)
• Test suites (tests/)
• organized by examples, junior, senior, lazy-fixtures, etc.
README
• Confirms “demo-playwright-workshop” E2E project
• Provides target URLs for the system under test
• Notes for debugging locators
Main components
A. Test Runner & Config
– Playwright CLI (playwright.config.ts)
– Custom reporters in misc/reporters/
B. Page Object Model
– app/page (pages)
– app/component (widgets)
– abstractClasses.ts (base page / component classes)
C. API Abstraction
– api/requestHolder.ts (HTTP client)
– api/auth.controller.ts (auth flows)
– api/models.d.ts (types)
D. Fixtures
– fixtures/index.ts (global fixtures)
– fixtures/lazy (on-demand fixtures)
E. Utility Scripts
– misc/cacheWarmer.ts (warming up state)
F. Test Suites
– tests/ (examples, junior, senior, visual, etc.)
– Organized by skill level and feature area
G. External System Under Test
– UI Endpoints (browser-driven)
– REST API Endpoints (API-driven)
H. Browsers & Network
– Chromium/Firefox/WebKit nodes managed by Playwright
– Outbound HTTP calls for API tests
Relationships & interactions
• Test Runner reads playwright.config → registers fixtures, reporters
• Each test imports POM classes (app/) and/or API controllers (api/)
• POM classes drive the browser via Playwright APIs
• API controllers drive HTTP requests via requestHolder
• Fixtures supply common setup/teardown (users, tokens, cart state)
• misc/cacheWarmer preloads data (optional)
• Custom reporters collect step-by-step logs and performance metrics
• Tests execute against the External SUT URLs
Architectural patterns & design principles
• Page Object Model for UI tests
• Layered abstraction: test → page/API → browser/HTTP
• Fixture injection for reusable state setup
• Custom reporters for observability
• Modular test suite organization by maturity/feature
Elements
• Clear labels: “Playwright Runner”, “Page Objects”, “API Controllers”, “Tests”
• Optional: annotate key files (e.g., playwright.config.ts, abstractClasses.ts)