This project implements a real-world CI/CD pipeline for running Playwright UI automation tests using Jenkins, Docker, and Allure reports on AWS EC2. The pipeline automatically runs tests on every push to the main branch and publishes reports reliably.
- โ Automatically run UI tests on every code push
- โ Use Docker for clean, isolated test execution
- โ Generate reports even when tests fail
- โ Avoid Jenkins / EC2 disk space issues
- โ Follow production-grade CI/CD practices
| Technology | Purpose |
|---|---|
| Playwright | UI Automation |
| Jenkins | CI/CD Orchestration |
| Docker | Containerized Execution |
| Allure | Test Reporting |
| AWS EC2 + EBS | Infrastructure |
| GitHub | Version Control |
graph LR
A[Code Push] --> B[GitHub Webhook]
B --> C[Jenkins Triggered]
C --> D[Clone Repository]
D --> E[Build Docker Image]
E --> F[Run Tests in Container]
F --> G[Generate Allure Results]
G --> H[Publish Report]
H --> I[Docker Cleanup]
- Code pushed to
mainbranch - GitHub webhook triggers Jenkins
- Jenkins clones repository
- Docker image is built
- Tests run inside Docker container
- Allure results are generated
- Allure report is published
- Docker cleanup runs to save disk space
Install from Manage Jenkins โ Plugins:
- โ Git Plugin
- โ Pipeline Plugin
- โ Docker Pipeline Plugin
- โ Allure Jenkins Plugin
All sensitive values are stored in Jenkins Credentials, not in code.
Examples:
- Application URLs
- Login usernames
- Passwords / tokens
Injected into Docker using environment variables.
โ
Secure
โ No hardcoded secrets
Jenkins cannot run Docker commands by default.
Give Docker permission to Jenkins user:
sudo usermod -aG docker jenkins
sudo systemctl restart jenkinsdocker ps- Jenkins built-in node uses limited root storage
- Docker images + reports quickly fill disk
- Pipelines start failing with space errors
- Attach EBS volume to EC2
- Use it for Jenkins workspace
- Clean Docker after every pipeline run
post {
always {
sh 'docker system prune -af || true'
}
}This keeps Jenkins stable long-term.
- โ Tests run inside Docker
- โ
Container removed after execution (
--rm) - โ No leftover state between builds
- โ Same environment every run
- Generated after each test run
- Helpful for debugging failures
- Generated even if tests fail
- Must be published in
post { always {} }
post {
always {
allure(results: [[path: 'allure-results']])
}
}AccessDeniedException: allure-results/testrun.json
Docker creates files as root, Jenkins cannot write to them.
sudo chown -R jenkins:jenkins /var/lib/jenkins/workspace
sudo chmod -R 755 /var/lib/jenkins/workspaceSnapshots created locally on Windows/Mac:
*-chromium-win32.png
CI runs on Linux:
*-chromium-linux.png
Playwright treats them as different โ tests fail every time.
-
Generate snapshots on Linux:
-
Commit Linux snapshots only:
*-chromium-linux.png
- GitHub Webhook
- Instant trigger on push
- Industry standard
- SCM polling (not recommended for production)
| Challenge | Resolution |
|---|---|
| Docker permission issues in Jenkins | Added jenkins user to docker group |
| EC2 disk getting full | Attached EBS volume + Docker cleanup |
| Allure report not generating on failure | Used post { always {} } block |
| Snapshot mismatch across OS | Generated Linux snapshots only |
| Jenkins workspace permission errors | Fixed ownership and permissions |
- โ Fully automated CI
- โ Stable Docker execution
- โ Reliable Allure reporting
- โ Production-ready setup
This project reflects real QA / SDET CI pipelines used in companies and is suitable for:
- ๐ฏ QA Automation roles
- ๐ฏ SDET interviews
- ๐ฏ DevOps + QA hybrid roles
โญ Star this repo if you find it helpful!