Skip to content

Commit d1aefb6

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 bea2879 commit d1aefb6

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
@@ -372,18 +372,22 @@ def percy_snapshot(driver, name, **kwargs):
372372
driver.execute_script(percy_dom_script)
373373
cookies = driver.get_cookies()
374374

375+
# Merge .percy.yml config options with snapshot options (snapshot options take priority)
376+
config_options = data['config'].get('snapshot', {})
377+
merged_kwargs = {**config_options, **kwargs}
378+
375379
# Serialize and capture the DOM
376-
if is_responsive_snapshot_capture(data['config'], **kwargs):
380+
if is_responsive_snapshot_capture(data['config'], **merged_kwargs):
377381
dom_snapshot = capture_responsive_dom(
378382
driver=driver,
379383
cookies=cookies,
380384
config=data['config'],
381385
percy_dom_script=percy_dom_script,
382-
**kwargs,
386+
**merged_kwargs,
383387
)
384388
else:
385389
dom_snapshot = get_serialized_dom(
386-
driver, cookies, percy_dom_script=percy_dom_script, **kwargs)
390+
driver, cookies, percy_dom_script=percy_dom_script, **merged_kwargs)
387391

388392
# Post the DOM to the snapshot endpoint with snapshot options and other info
389393
response = requests.post(f'{PERCY_CLI_API}/percy/snapshot', json={**kwargs, **{

0 commit comments

Comments
 (0)