How rajatt95/testautomationframework_yt_rajat_web_playwright_ts works
Project type and purpose
• This is a Test Automation Framework for web applications, built using Playwright and TypeScript.
• Its purpose is to define and run UI tests against a target web application (in this case, the “saucedemo” demo site), generate HTML reports, and integrate with CI pipelines.
High-level analysis of the file structure
• .github/workflows/ – GitHub Actions pipelines (01_ui_tests_chrome.yml, 02_ui_tests_select_one.yml, 03_ui_tests_ALL.yml) that trigger Playwright test runs on various browsers.
• playwright.config.ts – Core Playwright configuration (baseURL, browsers, testDir, reporter settings).
• pages/ – Page Object Model (POM) classes (BasePage, LoginPage, ProductsPage, CartPage, Components) encapsulating page locators and actions.
• utils/ – Utility modules (WaitUtils, VerificationUtils) providing common wait/verification helpers.
• test-data/ – External JSON files (login_credentials.json) containing test data.
• tests-saucedemo/ – Test specification files (.spec.ts) that import POM classes, utils, and data to define test scenarios.
• package.json / package-lock.json – NPM scripts (e.g. tests:ui-mode, tests:CHROME), dependencies (playwright, typescript, playwright-html-reporter).
Key architectural patterns and design principles
• Page Object Model (POM): separates test logic (tests-saucedemo) from page interactions (pages/).
• Modular test data: decouples credentials and test inputs into external files.
• Utility layer: centralizes common operations (waiting, assertions) in utils/.
• Config-driven execution: playwright.config.ts plus NPM scripts control browsers, headless/headed modes, parallelism, and reporters.
• CI integration: GitHub Actions workflows invoke NPM scripts across different browser targets.
Main components
a. Test Runner Layer
• Node.js process / NPM CLI scripts
• Playwright Test Runner (reads playwright.config.ts)
b. Configuration
• playwright.config.ts
• NPM scripts in package.json
• .github/workflows YAML files
c. Test Suite
• tests-saucedemo/*.spec.ts (test definitions)
d. POM Layer
• pages/BasePage.ts, LoginPage.ts, ProductsPage.ts, CartPage.ts, Components.ts
e. Utilities
• utils/WaitUtils.ts, VerificationUtils.ts
f. Test Data
• test-data/login_credentials.json
g. Browser Engines
• Chromium, WebKit, Firefox, Chrome, Edge (via Playwright drivers)
h. Reporting
• playwright-html-reporter output (HTML, screenshots, traces, videos)
• playwright-report directory
i. CI/CD
• GitHub Actions workflows invoking NPM scripts
Relationships and data flows
• Test Runner loads Configuration → spawns Browser Engines
• Test Runner executes Test Suite
• Each test uses POM Layer + Utilities + Test Data → interacts with Browser Engines → drives the AUT (Application Under Test)
• Browser Engines send back DOM states, screenshots, traces → Reporting
• Reporting artifacts stored and published by both the local reporter and the CI pipeline