playwright-automation-bdd
v1.0.11
Published
<br> # core-playwright-automation
Readme
Overview:
This is a sample test automation framework developed using Playwright with Cucumber.
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.
Cucumber is a tool for running automated tests written in plain language. Because they're written in plain language, they can be read by anyone on your team. Because they can be read by anyone, you can use them to help improve communication, collaboration and trust on your team. Cucumber supports behavior-driven development. Central to the Cucumber BDD approach is its ordinary language parser called Gherkin.
Features
- This testing framework supports Behavior Driven Development (BDD). Tests are written in plain English text called Gherkin
- Framework has built in library to operate on UI, API (REST API).
- Supports execution of tests in different browsers.
- Supports running scenarios in parallel mode. It runs 2 scenarios in parallel by default.
- Flaky scenario can be Retried multiple times until either it passes or the maximum number of attempts is reached. You can enable this via the retry configuration option.
- Supports rerun of the failed scenarios.
- Scenarios can be easily skipped by adding @ignore tag to scenarios
- Supports dry run of scenarios this helps to identifies the undefined and ambiguous steps.
- Has utility built in for file download, Read PDF files etc.
- Generates Cucumber HTML Report & HTML Report.
- HTML reports are included with snapshots and video in case of failed scenarios.
- Test execution logs are captured in the log file.
- All the configuration are controlled by .env file and environment variables can be modified at runtime.
- Easy and simple integration to CI/CD tools like Jenkins.
Supported Browsers
- Chrome - default browser
- Firefox
- MS Edge
- WebKit - web browser engine used by Safari
Steps to use
1. Installation
Playwright framework requires Node.js v14+ to run.
Code from github need to be cloned using git command or install package.
Install playwright-automation-bdd package using below command.
npm i playwright-automation-bddInstall playwright, cucumber, typescript, ts-nod.
npm i --save-dev playwright @cucumber/cucumber ts-node typescriptnpm i --save-dev @types/nodeGenerate tsconfig.json and change value of stric to false to turn off all strict type checking rules, making the code more flexible but reducing type safety
npx tsc --initInstall the missing libraries in the package to use it, such as: dotenv, moment, randomstring, xpath,...
