Skip to content

About

This repository will be used to create a robust automation framework using playwright with Type Script

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AutomationUsingPlaywright

This repository contains a robust automation framework using Playwright with TypeScript and Cucumber BDD.


📁 Project Structure

├── 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

🚀 Running the Cucumber Tests

1. Run all scenarios

npm run test:cucumber

Locally 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.

Choose the browser

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. Windows

Run on GitHub Actions

The 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.

2. Run by tag

npx cucumber-js --tags "@negative"
npx cucumber-js --tags "@smoke"
npx cucumber-js --tags "@positive or @negative"

3. Run a specific scenario by name or line number

# 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:16

📊 Reports

After 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.

About

This repository will be used to create a robust automation framework using playwright with Type Script

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages