diff --git a/percy/snapshot.py b/percy/snapshot.py index 746bd3b..61b93c0 100644 --- a/percy/snapshot.py +++ b/percy/snapshot.py @@ -372,18 +372,22 @@ def percy_snapshot(driver, name, **kwargs): driver.execute_script(percy_dom_script) cookies = driver.get_cookies() + # Merge .percy.yml config options with snapshot options (snapshot options take priority) + config_options = data['config'].get('snapshot', {}) + merged_kwargs = {**config_options, **kwargs} + # Serialize and capture the DOM - if is_responsive_snapshot_capture(data['config'], **kwargs): + if is_responsive_snapshot_capture(data['config'], **merged_kwargs): dom_snapshot = capture_responsive_dom( driver=driver, cookies=cookies, config=data['config'], percy_dom_script=percy_dom_script, - **kwargs, + **merged_kwargs, ) else: dom_snapshot = get_serialized_dom( - driver, cookies, percy_dom_script=percy_dom_script, **kwargs) + driver, cookies, percy_dom_script=percy_dom_script, **merged_kwargs) # Post the DOM to the snapshot endpoint with snapshot options and other info response = requests.post(f'{PERCY_CLI_API}/percy/snapshot', json={**kwargs, **{