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.git
Once you have cloned the repository, navigate to the project directory:
cd playwright-project
Then, install the project dependencies using npm:
npm install
Project 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 postinstall
To run all tests and open serenity report
npm run test
At the end, will be generated a serenity report like this
To run all tests without open serenity test:execute
npm run test:execute
To open serenity report
npm run test:report
To clean old serenity reports
npm run clean
Note If you are using
npm run test:execute
ornpm 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])
}
}
}
}