Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ updates:
- "/selenium"
schedule:
interval: weekly
open-pull-requests-limit: 5
groups:
pip-minor-patch:
patterns:
Expand All @@ -27,6 +28,7 @@ updates:
directory: "/.github/vrt"
schedule:
interval: weekly
open-pull-requests-limit: 5
groups:
docker:
patterns:
Expand All @@ -36,6 +38,7 @@ updates:
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 5
groups:
github-actions:
patterns:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: docker compose up -d --quiet-pull
- uses: actions/setup-python@v7
with:
python-version: "3.14"
python-version: "3.15"
cache: pip
cache-dependency-path: ${{ matrix.example }}/requirements.txt
- run: pip install -r requirements.txt
Expand Down
11 changes: 3 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
.coverage
junit
visual_regression_tracker.egg-info
htmlcov
coverage.xml
build
.idea
dist
__pycache__/
.venv/
.idea/
vrt.json
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Visual Regression Tracker examples for Python

Both examples use [sdk-python](https://github.com/Visual-Regression-Tracker/sdk-python) 5.0.0 from PyPI (Python 3.10 or later) and open https://the-internet.herokuapp.com headless:
Each folder is a separate project with its own `requirements.txt`, `vrt.json.example` and README, on [sdk-python](https://github.com/Visual-Regression-Tracker/sdk-python) 5.0.0 from PyPI and Python 3.11 or later. The examples open https://the-internet.herokuapp.com headless and track screenshots in a [Visual Regression Tracker](https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker) 6.0 server.

- [Selenium + SDK](selenium)
- [Playwright + SDK](playwright)
| Example | Stack | Client |
| ------------------------ | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| [playwright](playwright) | Playwright, the SDK's Playwright integration | [sdk-python](https://github.com/Visual-Regression-Tracker/sdk-python#integration-with-microsoft-playwright) |
| [selenium](selenium) | Selenium 4 | [sdk-python](https://github.com/Visual-Regression-Tracker/sdk-python) |

The examples connect with `vrt.json` or `VRT_*` environment variables, the way [sdk-python reads its configuration](https://github.com/Visual-Regression-Tracker/sdk-python#configure-connection). `vrt.json.example` holds the URL, API key and project of a fresh local install; copy it to `vrt.json` and change what differs.

CI runs every example against a VRT server started from [.github/vrt/docker-compose.yml](.github/vrt/docker-compose.yml).
29 changes: 26 additions & 3 deletions playwright/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# How to use
# Playwright + SDK

[example.py](example.py) opens https://the-internet.herokuapp.com headless with [Playwright for Python](https://playwright.dev/python/) and tracks the full page and the heading element with the Playwright integration of [sdk-python](https://github.com/Visual-Regression-Tracker/sdk-python), with an ignore area, a diff tolerance and agent details.

## Prerequisites

- Python 3.11 or later
- A running [Visual Regression Tracker](https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker) 6.0 server and its API key

## Setup

- Copy `vrt.json.example` to `vrt.json` and set your connection, or use the [`VRT_*` environment variables](https://github.com/Visual-Regression-Tracker/sdk-python#or-as-environment-variables), which override the file
- Install dependencies: `pip install -r requirements.txt`
- Install the browser: `playwright install chromium`
- Copy `vrt.json.example` to `vrt.json` and set your connection, or use `VRT_*` environment variables
- Run the example: `python example.py`

## Run

```sh
python example.py
```

## What to expect

`enableSoftAssert` is on: the SDK logs a failed check instead of raising, so the script finishes and prints a link to each test run.

- First run: `No baseline` for "Home page" and "Heading". The VRT UI shows a build with two new test runs. Approve them to make them the baseline for the branch.
- Next runs: nothing is logged while the page looks the same. When it changes, `Difference found`, and the build shows the diff to approve or reject.

Set `enableSoftAssert` to `false` to make new and changed screenshots raise an error.
30 changes: 27 additions & 3 deletions selenium/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# How to use
# Selenium + SDK

[example.py](example.py) opens https://the-internet.herokuapp.com in headless Chrome with [Selenium](https://www.selenium.dev/documentation/webdriver/) and tracks two screenshots with [sdk-python](https://github.com/Visual-Regression-Tracker/sdk-python), the second with browser, viewport and device details.

## Prerequisites

- Python 3.11 or later
- Google Chrome; Selenium Manager downloads a matching chromedriver
- A running [Visual Regression Tracker](https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker) 6.0 server and its API key

## Setup

- Copy `vrt.json.example` to `vrt.json` and set your connection, or use the [`VRT_*` environment variables](https://github.com/Visual-Regression-Tracker/sdk-python#or-as-environment-variables), which override the file
- Install dependencies: `pip install -r requirements.txt`
- Copy `vrt.json.example` to `vrt.json` and set your connection, or use `VRT_*` environment variables
- Run the example: `python example.py`

## Run

```sh
python example.py
```

## What to expect

`enableSoftAssert` is on: the SDK logs a failed check instead of raising, so the script finishes and prints a link to each test run.

- First run: `No baseline` for "Home page" and "Checkboxes page". The VRT UI shows a build with two new test runs. Approve them to make them the baseline for the branch.
- Next runs: nothing is logged while the pages look the same. When one changes, `Difference found`, and the build shows the diff to approve or reject.

Set `enableSoftAssert` to `false` to make new and changed screenshots raise an error.
Loading