Skip to main content

A robust visual regression testing library for Python.

Project description

Visual Guard

Visual Guard is a powerful Python library designed specifically for Visual Regression Testing. It allows you to automatically detect UI changes by comparing screenshots against approved baselines, ensuring your application looks perfect on every release.

Key Features

  • Visual Comparison: Pixel-perfect comparison of full pages or specific elements.
  • Region Masking: Easily exclude dynamic content (like timestamps, ads, or carousels) to prevent flaky tests.
  • Visual Reporting: Generates professional HTML reports with side-by-side views of Baseline, Actual, and Diff images.
  • Cross-Platform: Works seamlessly with Selenium WebDriver (Web) and Appium (Mobile).

Installation

pip install visual-guard

Quick Start

Web Automation

from visual_guard import VisualTester
from selenium import webdriver

# 1. Setup Driver
driver = webdriver.Chrome()
driver.get("https://example.com")

# 2. Initialize Visual Guard
visual = VisualTester()

# 3. Compare Full Page
# First run creates the baseline. Subsequent runs compare against it.
visual.assert_matches(driver, "homepage")

# 4. Compare Specific Element
button = driver.find_element("id", "submit-btn")
visual.assert_matches(button, "submit_button")

Mobile Automation (Appium)

from visual_guard import VisualTester
from appium import webdriver

caps = {
    "platformName": "iOS",
    "app": "path/to/my.app",
    "automationName": "XCUITest"
}
driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)

visual = VisualTester()
visual.assert_matches(driver, "mobile_dashboard")

Region Masking

Ignore dynamic areas to keep tests stable:

# Mask a region (x, y, width, height)
visual.assert_matches(driver, "dashboard", exclude_regions=[(100, 50, 200, 30)])

Reporting

Generate a visual report to see exactly what changed:

from visual_guard import SimpleReporter

reporter = SimpleReporter()
# ... add results ...
reporter.generate("visual_report.html")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

visual_guard-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

visual_guard-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file visual_guard-0.1.0.tar.gz.

File metadata

  • Download URL: visual_guard-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for visual_guard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5fb35e040e76143f6ffbb0f46ac819b7488c79688ad1dfee00f4c25507981f18
MD5 aa2ee8b56a44822aa18973c68b177d0b
BLAKE2b-256 1bc4cadde9d51a0ea6f874bfa71abcdea21990d873b89a0e211d8628c7983d2c

See more details on using hashes here.

File details

Details for the file visual_guard-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: visual_guard-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for visual_guard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e99bd7260ac328b03967cdb0d001b9283af9e82d1e7b04723e349f3e06e7858e
MD5 54d00b15a01fe947dc79571d6e828d62
BLAKE2b-256 6cb34e66de07977f4e19b72a7d5b4400baee6738ee637eb79015af4dd4488b5c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page