Giter Site home page Giter Site logo

ortonikc / playwright_cucumber_ts Goto Github PK

View Code? Open in Web Editor NEW
59.0 3.0 34.0 164 KB

Playwright + Cucumber BDD + Typescript, simple & easiest way to learn and implement

Home Page: https://www.youtube.com/playlist?list=PL699Xf-_ilW6KgK-S1l9ynOnBGiZl2Bsk

Gherkin 6.89% TypeScript 86.90% JavaScript 6.21%
playwright playwright-cucumber playwright-typescript playwright-bdd

playwright_cucumber_ts's Introduction

Playwright (TS binding) + Cucumber (BDD)

Cucumber is a popular behavior-driven development (BDD) tool that allows developers and stakeholders to collaborate on defining and testing application requirements in a human-readable format. TypeScript is a powerful superset of JavaScript that adds optional static typing, making it easier to catch errors before runtime. By combining these two tools, we can create more reliable and maintainable tests.

Features

  1. Awesome report with screenshots, videos & logs
  2. Execute tests on multiple environments
  3. Parallel execution
  4. Rerun only failed features
  5. Retry failed tests on CI
  6. Github Actions integrated with downloadable report
  7. Page object model

Sample report

image

Project structure

  • .github -> yml file to execute the tests in GitHub Actions
  • src -> Contains all the features & Typescript code
  • test-results -> Contains all the reports related file

Reports

  1. Mutilple Cucumber Report
  2. Default Cucumber report
  3. Logs
  4. Screenshots of failure
  5. Test videos of failure
  6. Trace of failure

Get Started

Setup:

  1. Clone or download the project
  2. Extract and open in the VS-Code
  3. npm i to install the dependencies
  4. npx playwright install to install the browsers
  5. npm run test to execute the tests
  6. To run a particular test change
  paths: [
            "src/test/features/featurename.feature"
         ] 
  1. Use tags to run a specific or collection of specs
npm run test --TAGS="@test or @add"

Folder structure

  1. src\pages -> All the page (UI screen)
  2. src\test\features -> write your features here
  3. src\test\steps -> Your step definitions goes here
  4. src\hooks\hooks.ts -> Browser setup and teardown logic
  5. src\hooks\pageFixture.ts -> Simple way to share the page objects to steps
  6. src\helper\env -> Multiple environments are handled
  7. src\helper\types -> To get environment code suggestions
  8. src\helper\report -> To generate the report
  9. config/cucumber.js -> One file to do all the magic
  10. package.json -> Contains all the dependencies
  11. src\helper\auth -> Storage state (Auth file)
  12. src\helper\util -> Read test data from json & logger

Tutorials

  1. Learn Playwright - Playwright - TS
  2. BDD in detail - TS binding

playwright_cucumber_ts's People

Contributors

ortonikc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

playwright_cucumber_ts's Issues

After following you instrction

npm ERR! Missing script: "test"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DELL\AppData\Local\npm-cache_logs\2023-09-28T07_55_30_284Z-debug-0.log

Can you submit the latest code?

Hi Koushik,
It is very good framework you have developed and I have implemented the same in my project.
But can you submit the latest code. The repo code is old one.
There should be the methods in step definitions which we call from page classes but those are not updated.
May be, if you check the code then you will come to know it

Detail info is required for configure Playwright + cucumber + Allure

I tried to configure Playwright + cucumber + Allure, i could generate the report but it is not showing up all information under steps.
Example:
In the cucumber steps, i included multiple assertion, those information should be present under steps but it is not showing up

image

can we integrate this with cypress and typescript

I am currently using cypress and cypress-cucumber-preprocessor library. We have to execute tests parallelly, this library does everything. Would like to know if there is a way to integrate this with cypress and typescript. Thank you. Can you provide some examples.

How to print or attach the custom values to report

Scenario: Create a new sales order
Given launch the application.
When user creates the sales order
Then Verify sales order id is created
And Save the sales order id

this is the scenario and when ever i execute this, then I will get dynamic sales order id ex: 12345
I just want to attach this as text in the report under scenario. how can I do that?

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.