Releases: percy/percy-playwright-python
v1.0.2
✨ New Features
Responsive Snapshot Capture
- Capture DOM snapshots across multiple viewport widths in a single
percy_snapshot()call - Viewport widths and heights are fetched dynamically from Percy CLI's
GET /percy/widths-configendpoint - For each configured width: resizes viewport → waits for resize → optionally reloads → optionally sleeps → captures DOM
- Original viewport is preserved and restored after all captures
- Automatically disabled when
percy.deferUploads: true
percy_snapshot(page, "Homepage", responsiveSnapshotCapture=True, widths=[375, 768, 1280])Cookie Context Capture
- Page cookies are collected via
page.context().cookies()before each DOM serialization - Cookies (
name,value,domain,path,expires,httpOnly,secure,sameSite) are attached in the snapshot payload, enabling the CLI to use them during asset discovery
Cross-Origin (CORS) Iframe Capture
- Detects cross-origin iframes by comparing each frame's host against the main page host
- For each cross-origin frame: injects Percy DOM script → serializes frame DOM independently → matches to main page via
data-percy-element-id - Serialized CORS iframe data stored in
domSnapshot.corsIframesfor CLI-side stitching
🔧 Enhancements
- Structured Logging —
log()now POSTs{message, level}JSON to Percy CLI's/percy/logendpoint - HTTP Timeout — 600-second socket/connect timeout prevents hangs during CLI sync mode
- CLI Config Caching — Healthcheck response stores CLI's
configobject forresponsiveSnapshotCaptureanddeferUploadsbehavior
⚙️ Configuration
| Environment Variable | Description |
|---|---|
RESPONSIVE_CAPTURE_SLEEP_TIME |
Delay (seconds) between each viewport-width capture |
PERCY_RESPONSIVE_CAPTURE_RELOAD_PAGE |
Reload page between captures (true/false) |
PERCY_RESPONSIVE_CAPTURE_MIN_HEIGHT |
Adjust capture height to account for browser chrome |
Or via CLI config:
snapshot:
responsiveSnapshotCapture: true💥 Breaking Changes
Caution
DOM Snapshot Structure Change — The DOM snapshot format has changed from a plain string to a structured object:
{ "html": "...", "cookies": [...], "corsIframes": [...] }Any downstream tooling or integrations that parse the DOM snapshot as a raw HTML string will break. Update consumers to read from the html key of the snapshot object.
Caution
CORS Iframe Support Requires CLI Update — Projects using cross-origin iframes must update Percy CLI. Older CLI versions do not process the domSnapshot.corsIframes field, causing CORS iframe content to be silently dropped from snapshots.
Caution
Responsive Capture + Defer Uploads Incompatibility — Responsive snapshot capture is automatically disabled when percy.deferUploads: true is set. If you rely on deferred uploads, responsive capture will not function.
📋 Requirements
Important
Percy CLI v1.31.10 or higher is required. This is a hard dependency for both:
- Responsive Snapshot Capture — uses the new
GET /percy/widths-configendpoint introduced in CLIv1.31.10 - CORS Iframe Capture — requires CLI-side handling of the
domSnapshot.corsIframesfield
Neither feature will function correctly on earlier CLI versions. Please upgrade before using this SDK version:
npm install -g @percy/cli@^1.31.10🧪 Testing
- Added 59 new test cases achieving 100% code coverage
- Coverage enforcement enabled with
fail_under = 100threshold
What's Changed
- Add responsive snapshot capture and CORS iframe support by @bhokaremoin in #124
- 🔖 Release 1.0.2-beta.1 by @bhokaremoin in #130
- 🔖 Release v1.0.2 by @bhokaremoin in #132
New Contributors
- @bhokaremoin made their first contribution in #124
Full Changelog: v1.0.1...v1.0.2
v1.0.2-beta.1
✨ New Features
Responsive Snapshot Capture
- Added
responsiveSnapshotCaptureoption to capture DOM across multiple viewport widths in a singlepercy_snapshot()call - Viewport widths and heights are fetched dynamically from the Percy CLI
GET /percy/widths-configendpoint - For each configured width: resizes the viewport → waits for resize (via
PercyDOM.waitForResize()) → optionally reloads → optionally sleeps → captures DOM - Original viewport is preserved and restored after all widths are captured
- Each snapshot is tagged with its capture width for accurate comparison
- Automatically disabled when
percy.deferUploads: true
Cookie Capture
- Before each DOM serialization, all page cookies are collected via
page.context().cookies()(with graceful fallback on failure) - Cookies (
name,value,domain,path,expires,httpOnly,secure,sameSite) are attached ascookiesin the snapshot payload, enabling the CLI to use them during asset discovery
Cross-Origin (CORS) Iframe Capture
- Detects cross-origin iframes by comparing each frame's host against the main page host
- For each cross-origin frame: injects the Percy DOM script → serializes the frame DOM independently → matches it to the main page via
data-percy-element-id - Serialized CORS iframe data is stored in
domSnapshot.corsIframesfor CLI-side stitching - Sequential frame processing to avoid Playwright thread-safety issues
🔧 Enhancements
Structured Logging
log()now POSTs{message, level}JSON to the Percy CLI/percy/logendpoint in addition to printing to stdout- Debug-level messages are suppressed from stdout unless
PERCY_LOGLEVEL=debugis set
HTTP Timeout (Percy CLI Sync Feature)
request()now applies a 600-second socket/connect timeout to support Percy CLI's synchronous processing mode, preventing long snapshot POST operations from hanging indefinitely while the CLI processes and uploads snapshots synchronously
CLI Config Caching
- The healthcheck response now stores the CLI's
configobject - Drives
responsiveSnapshotCaptureanddeferUploadsbehavior without requiring a CLI restart
DOM Snapshot Structure Change
- DOM snapshot structure changed from string to object:
{"html": "...", "cookies": [...], "corsIframes": [...]}
Testing & Coverage
- Added 59 new test cases achieving 100% code coverage
- Coverage enforcement enabled with
fail_under = 100threshold - New test file
tests/test_init.pyfor wrapper tests
⚙️ Configuration Options
New environment variables:
| Variable | Description |
|---|---|
RESPONSIVE_CAPTURE_SLEEP_TIME |
Delay in seconds between each viewport-width capture |
PERCY_RESPONSIVE_CAPTURE_RELOAD_PAGE |
Reload page between captures (true/false) |
PERCY_RESPONSIVE_CAPTURE_MIN_HEIGHT |
Adjust capture height to account for browser chrome (outerHeight - innerHeight + minH) |
Enable responsive capture via SDK option:
percy_snapshot(page, "Homepage", responsiveSnapshotCapture=True)Or via CLI config:
snapshot:
responsiveSnapshotCapture: true📋 Requirements
⚠️ Percy CLIv1.31.10or higher is required — this version is a hard dependency for both Responsive Snapshot Capture (uses the newGET /percy/widths-configendpoint) and CORS Iframe Capture (requires CLI-side handling of thedomSnapshot.corsIframesfield). Neither feature will function correctly on earlier CLI versions.
- CLI must expose
GET /percy/widths-configfor responsive capture width resolution - CLI must process
domSnapshot.corsIframesfor cross-origin iframe DOM stitching
💥 Impact
- Breaking: DOM snapshot structure changed from string to object format
- Breaking: Projects using CORS iframes must update Percy CLI to
v1.31.9-beta.5or higher - Compatibility: Responsive capture is automatically disabled when
deferUploadsis enabled - Performance: 600-second HTTP timeout prevents silent hangs on large snapshot payloads during CLI sync mode
What's Changed
- feat: add responsive snapshot capture, cookie capture, and cross-origin iframe support by @bhokaremoin in #124
New Contributors
- @bhokaremoin made their first contribution in #124
Full Changelog: v1.0.1...v1.0.2-beta.1
v1.0.1
What's Changed
- added region changes by @amandeepsingh333 in #54
- 🔖 Releasing 1.0.1-beta.0 by @amandeepsingh333 in #57
- 🔖 Release v1.0.1 by @amandeepsingh333 in #61
New Contributors
- @amandeepsingh333 made their first contribution in #54
Full Changelog: v1.0.0...v1.0.1
v1.0.1-beta.0
What's Changed
- added region changes by @amandeepsingh333 in #54
- 🔖 Releasing 1.0.1-beta.0 by @amandeepsingh333 in #57
New Contributors
- @amandeepsingh333 made their first contribution in #54
Full Changelog: v1.0.0...v1.0.1-beta0