Playwright and SerenityJs is a powerful combination of technologies for web application testing. It provides reliable and maintainable automated testing with Playwright for browser automation and SerenityJs for testing framework.
To get started with this project, you'll need to have Node.js and Git installed on your machine.
First, clone the repository:
git clone https://github.com/username/playwright-project.gitOnce you have cloned the repository, navigate to the project directory:
cd playwright-projectThen, install the project dependencies using npm:
npm installProject overview
Run, the following command to set some depencies needed after install like rimraf is a Node.js package that provides a cross-platform command line interface (CLI) for deleting files and directories.
npm run postinstallTo run all tests and open serenity report
npm run testAt the end, will be generated a serenity report like this
To run all tests without open serenity test:execute
npm run test:executeTo open serenity report
npm run test:reportTo clean old serenity reports
npm run cleanNote If you are using
npm run test:executeornpm run test, this command is not required.
To run test cases by tags
npx playwright test -g "@hb-0001"Tags that you can use
| 📘 Test Case | 📗 Story | 📓 Others |
|---|---|---|
| 1️⃣ @hb-0002 | 📗 @hb-0001 | 🌀 @regression |
| 1️⃣ @hb-0003 | 📗 @hb-0005 | |
| 1️⃣ @hb-0004 | 📗 @hb-0008 | |
| 2️⃣ @hb-0006 | ||
| 2️⃣ @hb-0007 | ||
| 3️⃣ @hb-0009 | ||
| 3️⃣ @hb-0010 | ||
| 3️⃣ @hb-0011 | ||
| 3️⃣ @hb-0012 | ||
| 3️⃣ @hb-0013 |
pipeline {
agent any
tools {
nodejs 'NodeJS 17.5.0'
}
stages {
stage('Dependencies') {
steps {
bat 'npm ci'
bat 'npm install rimraf'
}
}
stage('e2e Tests') {
steps {
bat 'npm run test:execute'
}
}
stage('Deploy Test Reports') {
steps {
publishHTML([
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: false,
reportDir: 'target/site/serenity',
reportFiles: 'index.html',
reportName: 'Serenity Report',
reportTitles: '',
useWrapperFileDirectly: true])
}
}
}
}
