From 38adeed97b131e755fb4207244382c01e7e6068b Mon Sep 17 00:00:00 2001 From: Pavlo Strunkin Date: Mon, 2 Nov 2026 22:52:31 +0200 Subject: [PATCH] chore: example READMEs, root table, Python 3.15 in CI - READMEs with prerequisites, setup, run and what to expect; root table with links to sdk-python - CI on Python 3.15; sdk-python, Playwright and Selenium were current - .gitignore lists what the examples produce, not the SDK's build files - Dependabot open-pull-requests-limit 5 Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 3 +++ .github/workflows/ci.yml | 2 +- .gitignore | 11 +++-------- README.md | 12 +++++++++--- playwright/README.md | 29 ++++++++++++++++++++++++++--- selenium/README.md | 30 +++++++++++++++++++++++++++--- 6 files changed, 69 insertions(+), 18 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 356f3b9..4d19746 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,6 +6,7 @@ updates: - "/selenium" schedule: interval: weekly + open-pull-requests-limit: 5 groups: pip-minor-patch: patterns: @@ -27,6 +28,7 @@ updates: directory: "/.github/vrt" schedule: interval: weekly + open-pull-requests-limit: 5 groups: docker: patterns: @@ -36,6 +38,7 @@ updates: directory: "/" schedule: interval: weekly + open-pull-requests-limit: 5 groups: github-actions: patterns: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e99960..34e2b32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.gitignore b/.gitignore index cd645c7..cef7a01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,4 @@ -.coverage -junit -visual_regression_tracker.egg-info -htmlcov -coverage.xml -build -.idea -dist +__pycache__/ +.venv/ +.idea/ vrt.json diff --git a/README.md b/README.md index 4f6f956..18fd161 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/playwright/README.md b/playwright/README.md index d8dcab5..0ed56d1 100644 --- a/playwright/README.md +++ b/playwright/README.md @@ -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. diff --git a/selenium/README.md b/selenium/README.md index c3607e7..1fbba05 100644 --- a/selenium/README.md +++ b/selenium/README.md @@ -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.