v1.0.2-beta.0
Pre-release
Pre-release
·
11 commits
to main
since this release
✨ New Features
Responsive Snapshot Capture
- Added
responsiveSnapshotCaptureoption to capture DOM across multiple viewport widths in a singlesnapshot()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
🔧 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
⚙️ 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:
options.put("responsiveSnapshotCapture", true);Or via CLI config:
snapshot:
responsiveSnapshotCapture: true📋 Requirements
⚠️ Percy CLIv1.31.10-beta.0or 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: Projects using CORS iframes must update Percy CLI to
v1.31.10-beta.0or 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 #25
New Contributors
- @bhokaremoin made their first contribution in #25
Full Changelog: v1.0.1...v1.0.2-beta.0