This project automates end-to-end testing using Playwright, TypeScript, and Cucumber (BDD framework).
Ensure you have the following installed:
- Node.js (LTS recommended) β Download
- Playwright β Installed via dependencies
- Cucumber.js β Installed via dependencies
- Clone the repository:
git clone https://github.com/your-repo/PlaywrightTypeScriptUsingBDD.git cd PlaywrightTypeScriptUsingBDD - Install dependencies:
npm install
- Install Playwright browsers:
npx playwright install
π PlaywrightTypeScriptUsingBDD
β£ π features/ # Cucumber feature files (Scenarios & Gherkin syntax)
β£ π steps/ # Step definitions mapping Gherkin steps to Playwright actions
β£ π support/ # Hooks, utilities, and helper functions for tests
β£ π reports/ # Generated test reports (HTML & JSON)
β£ π package.json # Project dependencies & npm scripts
β£ π package-lock.json # Auto-generated dependency lock file
β£ π report.js # Script for generating multiple-cucumber-html-reporter
β£ π tsconfig.json # TypeScript configuration
β£ π cucumber.js # Cucumber configuration file
β£ π playwright.config.ts # Playwright test configuration (Browsers, timeouts, etc.)
β π README.md # Documentation and setup instructions
Feature: Login to Sauce Demo
As a user
I want to be able to log in with valid and invalid credentials
So that I can access the inventory page or see an error message
@positive
Scenario Outline: Successful Login
Given I navigate to the Sauce Demo login page
When I enter username "<username>" and password "<password>"
And I click the login button
Then I should see the products page
Examples:
| username | password |
| standard_user | secret_sauce |
@negative
Scenario Outline: Invalid Login
Given I navigate to the Sauce Demo login page
When I enter username "<username>" and password "<password>"
And I click the login button
Then I should see an error message
Examples:
| username | password |
| invalid | wrong_pass |npx cucumber-jsnpx cucumber-js --tags "@positive"npx cucumber-js --tags "@negative"HEADLESS=false npx cucumber-js"generate_multiplehtml_report": "node report.js",If you encounter issues, try:
npx playwright test --debugPlaywright-TypeScript.mp4
This project is licensed under the MIT License.