Giter Site home page Giter Site logo

hdorgeval / playwright-fluent-ts-cucumber6-starter Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 373 KB

Starter project for e2e tests with playwright-fluent and cucumber-js

TypeScript 93.41% Gherkin 6.59%
playwright playwright-fluent ts cucumber-js typescript e2e-tests scenarios html-report gherkin

playwright-fluent-ts-cucumber6-starter's Introduction

playwright-fluent-cucumber-ts-starter

Build Status Build status

Starter project to write E2E tests with cucumber-js and playwright-fluent in TypeScript language.

!!! Use this template only with cucumber-js v6: do not update cucumber-js dependencies to the v7 versions. If you want to use cucumber-js v7 please use this template !!!

After cloning the repo

  • run the command npm install.

To execute the tests locally

  • run the command npm test.
    • tests will run by default with the chromium version installed by playwright

To execute the tests on a specific browser

  • to run the tests with webkit : npm run test-webkit
  • to run the tests with firefox : npm run test-firefox
  • to run the tests with chrome : npm run test-chrome

To debug a scenario in Visual Studio Code

  • tag the scenario with @debug
  • set the breakpoints in the typescript code
  • Start debugging

To run only specific scenarios

  • tag the scenario(s) with @only
  • run script:
npm run only

To run scenarios in headfull/live mode

  • tag the scenario(s) with @live
  • run script:
npm run live

The browser will stay opened at the end of the tests execution.

To ignore a scenario

  • tag the scenario with @ignore

To check for typescript, linting and gherkin errors

  • run the command npm run build.

To view the html report of the last run

  • run the command npm run report.
  • the HTML report will automatically include:
    • a screenshot whenever an error occured,
    • all page errors (uncaught exceptions in the console) if any
    • all failed requests if any
    • the last ten requests

To view the steps usage

  • run the command npm run steps-usage.

To create a new step

  • first write the Given/When/Then sentence:

    Given I push "foo" on "bar"
  • tag the scenario with @live and save the feature file.

  • run the npm script:

    npm run snippets
  • the script will report the missing step(s): you just need to copy and paste them in the step definitions file:

    Given('I push {string} on {string}', async function (string, string2) {
      // Write code here that turns the phrase above into concrete actions
      return 'pending';
    });

To use a custom option on the CLI

  • add your custom option to the CLI that starts cucumber:
./node_modules/.bin/cucumber-js features/**/*.feature --foo=bar 
  • use it at runtime:
if (this.cliArgs.foo === 'bar') {
  // custom code for option --foo=bar
}

To use a custom World Objet

playwright-fluent-ts-cucumber6-starter's People

Contributors

hdorgeval avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

playwright-fluent-ts-cucumber6-starter's Issues

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.