How deepika5reddy/playwright_ts_e2e_api works
Project type and purpose
• This is a test-automation framework in TypeScript built on Playwright.
• It supports two testing modalities: end-to-end (UI) tests against a web application and API tests against backend endpoints.
• It’s designed for CI/CD pipelines (Jenkinsfile, buildspec.yml) and environment-specific configurations.
File structure
• Top level
• env/ – holds .env.local and .env.prod for environment-specific variables
• page-object/ – Page Object Model classes (AbstractPage, LoginPage, ProductGrid)
• tests/
– api/ – API test suites (ApiTest.spec.ts)
– e2e/ – UI test suites (ValidateLogin, ValidateGrid, ValidateBook, ValidateScreenshot) + storageState, screenshots
• utils/ – helper functions (env loader, generic helpers)
• playwright.config.ts – global Playwright settings
• playwright.service.config.ts – service-specific configuration
• CI/CD files: Jenkinsfile, buildspec.yml
• Standard Node/TS files: package.json, tsconfig.json
Key insights from README
• Uses the Page Object Model (POM) for UI tests.
• Tests are invoked via Playwright CLI or npm scripts.
• Outputs HTML reports via Playwright’s reporter.
• Integrates into CI (Jenkins/AWS CodeBuild).
Main components
a. Configuration Layer
• env loader (utils/env.ts)
• playwright.config.ts & playwright.service.config.ts
b. Test Runner & Orchestration
• Playwright Test Runner (invoked via CLI or CI)
c. Test Suites
• E2E UI suite (tests/e2e)
• API suite (tests/api)
d. Page Object Model
• AbstractPage, LoginPage, ProductGrid (page-object/)
e. Utility Functions
• env.ts, helper.ts (utils/)
f. External Systems
• Browser engines (Chromium, Firefox, WebKit)
• Application Under Test (ecommerce playground)
• API endpoints
• CI/CD server (Jenkins/AWS CodeBuild)
• Test reporting UI (Playwright HTML report)
Relationships & interactions
• CI Server → triggers Playwright Test Runner
• Test Runner reads Config Layer → sets ENV variables → chooses target URLs & credentials
• Test Runner invokes E2E suite
• Each test uses POM classes to drive browser → interacts with Application Under Test
• Captures screenshots, storage state
• Test Runner invokes API suite
• Sends HTTP requests to API endpoints → validates responses
• Test Runner → writes test results → calls Reporter → HTML reports
• CI Server → archives reports, notifies stakeholders
Architectural patterns & principles
• Page Object Model (separation of UI locators & actions)
• Single Test Runner orchestrating multiple test modalities
• Environment-driven configuration for portability
• Modularity: clear separation of config, POM, tests, utils
• CI/CD integration for continuous validation
Technologies & frameworks
• Node.js + TypeScript
• Playwright Test Runner
• Page Object Model for UI interaction
• Jest-style specs (Playwright uses test() & expect())
• Jenkins/AWS CodeBuild for CI
• .env files & dotenv for config
• npm scripts for ease of use