Giter Club home page Giter Club logo

playwright-cucumber's Introduction

PlayWright-CucumberπŸ€–

playWright

cucumber

OverviewπŸ‘‡

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

Required npm Packages

  • cucumber
  • playwright
  • ts-node
  • types/node
  • html-cucumber reporter

Folder Structure

β”œβ”€β”€ 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

Files Description

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

Reports

  • Cucumber html Report
  • Cucumber json Report

Conclusion

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.

playwright-cucumber's People

Contributors

31305meenakshi avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.