How mahbub091/playwright_ts_project works
Project Type & Purpose
• This is an end-to-end (E2E) test automation framework using Playwright + TypeScript.
• It follows a hybrid approach with the Page Object Model (POM), reusable utilities, externalized test data, and CI/CD integration.
Key Architectural Components
a. Configuration Layer
• playwright.config.ts – global Playwright settings (browsers, timeouts, reporters)
• package.json / package-lock.json – dependencies and scripts
• .github/workflows/main.yml – CI pipeline for running tests on each push/PR
b. Test Suites
• /tests – entry points (e.g., loginTest.spec.ts, lambdaTestPlayground.spec.ts)
• These invoke fixtures and POM classes.
c. Page Object Model (POM) Layer
• /pom – encapsulates page‐specific locators & actions (loginPage.ts, accountPage.ts, lambdaHomePage.ts)
• Each class exposes methods representing UI operations.
d. Utilities Layer
• /utilities – shared helpers
– fixtures.ts (Playwright fixtures for setup/teardown)
– logger.ts (custom logging)
– utils.ts (generic functions)
– valueProvider.ts (dynamic value generation)
e. Test Data Layer
• /testData – JSON files (globalData.json, lambda.json) for environment-specific inputs
• Loaded by utilities or direct import in tests.
f. Playwright Engine & Browsers
• Underlying Playwright library launching Chromium/Firefox/WebKit
• Browser instances spin up per fixture configuration.
Interactions & Data Flow
1. CI/CD Trigger (GitHub Actions) →
2. Installs npm deps →
3. Runs npx playwright test (or npm script) →
4. Test Runner reads playwright.config.ts →
5. Fixtures initialize browser contexts →
6. Test Spec imports test data & utilities →
7. Test Spec calls POM methods →
8. POM uses Playwright APIs to interact with the browser →
9. Utilities log results, read/write test data →
10. Test Runner gathers reports and artifacts
Architectural Patterns & Principles
• Page Object Model: separates page concerns into classes.
• Layered Architecture: clear separation between test scripts, page abstractions, utilities, and data.
• Configuration as Code: all settings externalized in config files.
• CI/CD Integration: pipeline runs headless tests on each commit.