/TDD-Jest-Playwright-Demo

Test case of mixing the best of the three words together

Primary LanguageTypeScript

TDD Jest Playwright Demo

Test case of mixing the best of the three words together:

  • Playwright - as the most advanced end-to-end browser automation
  • Jest - the bellowed test runner
  • BDD - principles of testing that helps you to look at the code from the right side

So there we are. We want to mix them together with goals:

  1. To run that together with minimal configuration
  2. To test advanced Gherkin features like outline data, tags
  3. To try if it can run in parallel mode

The result

It works fine. Lets overview the goals:

  1. We have a simple web service with single API and one page. It is written in typescript and includes some small configurations for Babel, Jest, Cucumber (BDD runner) and Typescript. There is also a page model - a simple abstraction over pagess that allows us to make step definitions more straight forward.
  2. The feature file syntax called Gherkin is fully supported. I have configured single tag @excluded to skip some features/steps and tried outline data tables. There are three packages that helps us to integrate Jest with Cucumber (the BDD Runner) - the famous one jest-cucumber (261 stars for now😁), gherkin-jest (34) and jest-cucumber-fusion with 3 (one from me). The last one looked most simple. It allows to use feature files with minimal effort. So I have used that without any trouble at all.
  3. Yes, it works in parallell according Jest settings. It can't of course split outline feature files loops into threads or the scenarios from a single feature file (pitty).

Have nice testing

Tom