Created
June 20, 2017 21:58
-
-
Save patbenatar/8c08f89827dca18bd43f8f762af70d03 to your computer and use it in GitHub Desktop.
Percy visual diff scroll fx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def visual_diff_scroll_fx(page, id:, name:) | |
page.evaluate_script('window.scrollTo(0,0)') | |
scroll_top = page.evaluate_script( | |
"document.getElementById('#{id}').getBoundingClientRect().top" | |
) | |
page.evaluate_script("window.scrollTo(0, #{scroll_top})") | |
sleep 0.1 | |
Percy::Capybara.snapshot(page, name: name) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment