Perfector — Visual Regression Testing
Automated UI visual testing to prevent unintended layout changes. Page snapshots + OpenCV diffing + automated reports for the team.
Table of Contents
Project Context
Classic web‑dev problem: with dozens or hundreds of pages sharing components and styles, a small CSS tweak can break layouts elsewhere.
Typical scenarios:
- Changed spacing in Button → login form shifted on another page
- Updated grid layout → catalog cards misaligned
- Added a new breakpoint → mobile version broke
- Refactored CSS variables → colors changed in unexpected places
Why manual testing fails:
- ❌ You can’t check every page after each change
- ❌ Human error — subtle changes slip through
- ❌ Time — checking hundreds of pages takes hours
- ❌ No history — hard to see when something broke
Real case: dev changed z‑index for a modal. It broke dropdowns on 15 pages and was noticed a week later by a user.
Goal
Build an automated visual regression testing system that:
- Takes baseline (reference) screenshots of critical pages
- Captures new screenshots on each deploy
- Compares via computer vision (OpenCV)
- Flags visual differences
- Sends a report with changes to the tech lead for review
- Integrates into CI/CD
Solution
Architecture
CI/CD Trigger (push / PR / schedule)
→ Screenshot Engine (Selenium + Headless Chrome in Docker)
→ Visual Comparison (OpenCV + Pillow)
→ Report Generator (HTML/email)
→ CI status + Slack/email notifications- Screenshot engine opens URLs from config, waits for full load, and saves full‑page images.
- Comparator aligns images and computes diffs, aggregates changed regions, outputs annotated images and scores.
- Reporter produces human‑readable reports and pushes artifacts to CI.
Code excerpts (trimmed for brevity) are kept close to the original implementation; logic is self‑documenting.
CI/CD Integration
- Runs on push/PR and on schedule
- Stores baseline artifacts
- Fails build on significant regressions (configurable threshold)
- Links to visual diff artifacts in the job summary
Results
Lessons
- Guardrails beat guidelines: automation prevents “I forgot to check page X.”
- Reproducibility matters: Dockerized headless browser = stable screenshots.
- Keep thresholds sane: reduce false positives so teams trust the signal.
Similar projects
Projects with similar technologies and tasks
PVS‑Studio — Automated E2E Testing System
Comprehensive Selenium‑based E2E test system covering critical journeys on pvs‑studio.com. Prevents regressions on a business‑critical site.
- Selenium
- Python
- pytest
- Docker
- CI/CD
Digital Tutor
Analytics platform for university management with tools for assessing student learning outcomes and recommendations for optimizing educational processes
- Python
- Django
- PostgreSQL
- Redis
- Celery
- +2
Viva64 Trial CRM — Email Marketing Automation
Trigger‑based email automation to convert PVS‑Studio trial users into paying customers. Trial CRM to manage the lifecycle of trial users.
- Python
- Django
- Celery
- PostgreSQL
- SMTP
- +1