This repository contains a robust automation framework using Playwright with TypeScript and Cucumber BDD.
├── features/
│ └── login.feature # Gherkin feature file with positive & negative scenarios
├── src/
│ ├── pages/
│ │ ├── LoginPage.ts # Page Object for Rahul Shetty Client Login page
│ │ └── DashboardPage.ts # Page Object for Client Portal Dashboard page
│ ├── test/
│ │ ├── steps/
│ │ │ └── loginSteps.ts # Cucumber step definitions
│ │ └── hooks/
│ │ ├── customWorld.ts # Cucumber World with Playwright instances
│ │ └── hooks.ts # Before/After hooks (browser lifecycle, screenshots on failure)
│ ├── test-data/
│ │ └── loginData.json # JSON test data file for credentials and expected values
│ └── utils/
│ └── dataUtils.ts # Reusable JsonReader utility to load & extract test data
├── cucumber.json # Cucumber configuration and profiles
├── tsconfig.json # TypeScript compiler settings
└── package.json # Dependencies and npm test runner scripts
npm run test:cucumberLocally every browser (chrome, chromium, firefox, webkit) launches headed; Chrome is maximized and the
others open at the default 1280x720 size. Only on GitHub Actions does it run headless. This is
controlled globally in src/test/hooks/browserConfig.ts.
Supported: chrome (default), firefox, webkit, chromium. Set it per run with the BROWSER
variable, or change DEFAULT_BROWSER in src/test/hooks/browserConfig.ts.
BROWSER=firefox npx cucumber-js --tags "@smoke" # macOS / Linux
npx cross-env BROWSER=webkit cucumber-js --tags "@smoke" # any OS, incl. WindowsThe Cucumber Tests workflow (.github/workflows/cucumber.yml) runs manually only, never on push
or pull request. Go to Actions → Cucumber Tests → Run workflow, pick a browser and a tag (or
all, or enter a custom tag expression), then download the cucumber-report artifact
from the finished run.
npx cucumber-js --tags "@negative"
npx cucumber-js --tags "@smoke"
npx cucumber-js --tags "@positive or @negative"# By scenario name
npx cucumber-js --name "Successful login"
# By feature file and line number
npx cucumber-js features/login.feature:9
npx cucumber-js features/login.feature:16After test execution, a rich HTML report is automatically generated at:
test-results/cucumber-report.html
Open it in any browser to inspect step-by-step results and screenshots. On GitHub Actions it is in the
cucumber-report artifact.