This project implements an UI testing using Playwright with cucumber framwork, which is a Behavior Driven Development tool used to develop test cases for the behavior of software's functionality. The name of Website is Swag Labs
- cucumber
- playwright
- ts-node
- types/node
- html-cucumber reporter
βββ src
β βββ helperπ
β βββ report.ts
β βββ hooksπ
β βββ hooks.ts
β βββ pageFixture.ts
β βββ testπ
β βββ featuresπ
β βββ login.feature
β βββ product.feature
β βββ checkOutStepOne.feature
β βββ checkOutStepTwo.feature
β βββ stepsπ
β βββ login.ts
β βββ product.ts
β βββ checkOutStepOne.ts
β βββ checkOutStepTwo.ts
βββ test-resultsπ
β βββ screenshotsπ
β βββ cucumber-report.html
β βββ cucumber-report.json
-
report.ts it containig the
multiple-cucumber-html-reporter
package to generate an HTML report for Cucumber test results. -
hooks.ts it sets up the necessary hooks for Playwright and Cucumber integration, launches a browser, creates a new page for each scenario, takes screenshots after each step and test, and attaches the screenshots to the test report.
-
pageFixture.ts provide a shared fixture or utility for storing the Playwright page object that can be accessed and modified across different modules or files in your test suite.
-
login.feature, product.feature, checkOutStepOne.feature, checkOutStepTwo.feature these feature files describes the
login feature, product feature, checkout feature
with multiple scenarios, each with different input data. The Examples tables provide the specific values to be substituted in the corresponding steps. -
login.ts, product.ts, checkOutStepOne.ts, checkOutStepTwo.ts provided code is a set of step definitions written in the Cucumber syntax with Playwright and Playwright Test. These step definitions are used to define the behavior and actions for the
login feature, product feature, checkout feature
scenarios described in the feature file.
- Cucumber html Report
- Cucumber json Report
This project demonstrates how to implement an UI Automation in Playwright with Cucumber features and stepDefinitions. By executing all these step definitions with Cucumber,different scenarios can be automated and validated against the expected behavior.