Skip to content

Commit b9758c6

Browse files
fix: merge .percy.yml config options with snapshot options for serializeDOM
Config options from .percy.yml (like widths, minHeight, enableJavaScript, etc.) were not being passed to PercyDOM.serialize(). Only per-snapshot options were used. Now merges both, with per-snapshot options taking priority. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aab58bb commit b9758c6

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

percy/snapshot.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,19 +500,23 @@ def percy_snapshot(driver, name, **kwargs):
500500
driver.execute_script(percy_dom_script)
501501
cookies = driver.get_cookies()
502502

503+
# Merge .percy.yml config options with snapshot options (snapshot options take priority)
504+
config_options = data['config'].get('snapshot', {})
505+
merged_kwargs = {**config_options, **kwargs}
506+
503507
# Serialize and capture the DOM
504-
if is_responsive_snapshot_capture(data['config'], **kwargs):
508+
if is_responsive_snapshot_capture(data['config'], **merged_kwargs):
505509
dom_snapshot = capture_responsive_dom(
506510
driver=driver,
507511
cookies=cookies,
508512
config=data['config'],
509513
percy_dom_script=percy_dom_script,
510-
**kwargs,
514+
**merged_kwargs,
511515
)
512516
else:
513517
dom_snapshot = get_serialized_dom(
514518
driver, cookies, percy_config=data.get('config'),
515-
percy_dom_script=percy_dom_script, **kwargs)
519+
percy_dom_script=percy_dom_script, **merged_kwargs)
516520

517521
# Strip SDK-local `readiness` from the snapshot POST body. The CLI
518522
# already has it via healthcheck; sending it again here risks future

0 commit comments

Comments
 (0)