How mythilysenthil/playwright_etr works
Purpose and Entry Points
This is a TypeScript end-to-end test automation repository for an employee/course-management application. It runs Cucumber BDD scenarios against a browser through Playwright. Primary execution configuration is in cucumber.js, with browser setup in playwright.config.ts and dependency/scripts definitions in package.json.
BDD Feature Layer
Business workflows are expressed as Gherkin features: course creation/editing, employee deletion/filtering, Excel export, and application launch. Feature files define the test suite’s externally visible behavior and map to step implementations.
• src/test/features/Addcourse.feature
• src/test/features/EditCourse.feature
• src/test/features/ExcelExport.feature
Step and World Orchestration
Step-definition modules bind Gherkin phrases to page actions and assertions. A custom Cucumber World carries shared scenario state—such as Playwright browser/page context and scenario-specific data—across steps. Hooks establish and tear down that runtime around scenarios.
• src/test/steps/AddcourseSteps.ts
• src/test/world/CustomWorld.ts
• src/test/hooks/hooks.ts
Page Object Boundary
Page objects isolate UI locators and browser interactions from BDD steps. BasePage likely supplies common interaction/navigation primitives; workflow-specific page objects model the home screen, sidebar, course forms, and filtering controls. This is the primary boundary between test intent and the target application UI.
• src/test/pages/BasePage.ts
• src/test/pages/HomePage.ts
• src/test/pages/AddcoursePage.ts
Test Data and Typed Input Models
Scenarios consume structured JSON, CSV, and Excel fixtures rather than embedding all values in feature files. Type definitions describe expected data shapes, while reader utilities load external data for data-driven tests such as employee filtering, course management, and export validation.
• src/test/test-data/addcourse.json
• src/test/test-data/EmpID_Data.xlsx
• src/test/utilities/ExcelReader.ts
Runtime Configuration and Reporting
Environment-specific values are kept outside test logic and read through an environment utility, with QA settings present under env/. The suite produces custom reporting through the report module, and execution timing behavior is centrally represented by timeout constants.
• env/.env.qa
• src/test/utilities/envReader.ts
• src/test/helper/report.mts
Execution Infrastructure
Node.js is the host runtime, TypeScript is the implementation language, Cucumber is the scenario runner, and Playwright drives browser automation. CI executes the suite through GitHub Actions, with a dedicated Playwright workflow. rerun/ appears to retain rerun-related execution output or scenario references.
• .github/workflows/playwright.yml
• cucumber.js
• rerun/@rerun.txt
Main entry points: AddcourseSteps.ts Step definitions · cucumber.js Cucumber runner · CustomWorld.ts Custom World · BasePage.ts Base page
Components 18
BDD Suite
Feature specifications and scenario orchestration.
- Gherkin features · Course and export workflows define visible test behavior.
src/test/features/Addcourse.feature - Step definitions · Binds feature phrases to page actions and assertions.
src/test/steps/AddcourseSteps.ts - Custom World · Carries browser context, page, and scenario data.
src/test/world/CustomWorld.ts - Scenario hooks · Creates and tears down scenario runtime.
src/test/hooks/hooks.ts
Browser Automation
Page-object boundary over the application UI.
- Base page · Shared navigation and interaction primitives.
src/test/pages/BasePage.ts - Home page
src/test/pages/HomePage.ts - Course form page · Models course creation and editing UI.
src/test/pages/AddcoursePage.ts - Playwright browser · Drives the target application in a browser.
playwright.config.ts
Data & Environment
External fixtures and runtime settings.
- Course JSON fixture · Structured input for course scenarios.
src/test/test-data/addcourse.json - Employee Excel fixture · Input or validation data for employee workflows.
src/test/test-data/EmpID_Data.xlsx - Excel reader · Loads spreadsheet data for data-driven tests.
src/test/utilities/ExcelReader.ts - Environment reader · Loads environment-specific values outside test logic.
src/test/utilities/envReader.ts - QA environment
env/.env.qa
Execution & CI
Runner configuration, reporting, and continuous execution.
- Cucumber runner · Primary scenario execution configuration.
cucumber.js - Custom report
src/test/helper/report.mts - GitHub Actions · Runs the Playwright test workflow.
.github/workflows/playwright.yml - Rerun references · Stores scenarios or output used for reruns.
rerun/@rerun.txt - Node project · Defines scripts and TypeScript test dependencies.
package.json
Connections 20
- Gherkin features → Step definitions: maps phrases to
- Step definitions → Custom World: uses scenario state
- Scenario hooks → Custom World: initializes
- Step definitions → Home page: drives
- Step definitions → Course form page: drives
- Home page → Base page: extends
- Course form page → Base page: extends
- Base page → Playwright browser: uses
- Step definitions → Course JSON fixture: consumes
- Step definitions → Excel reader: reads data through
- Excel reader → Employee Excel fixture: loads
- Custom World → Environment reader: reads runtime settings
- Environment reader → QA environment: loads
- Cucumber runner → Gherkin features: executes
- Cucumber runner → Scenario hooks: runs lifecycle
- Cucumber runner → Custom report: produces
- GitHub Actions → Cucumber runner: runs suite
- Cucumber runner → Rerun references: writes or consumes
- Node project → Cucumber runner: provides scripts and dependencies
- Node project → Playwright browser: provides dependency