Use `scroll_to` helper instead of relying on a large viewport
Description
We are currently relying on a very large viewport, to make it possible to click buttons / things that are at the bottom of a page.
But this is not enough, because we have pages that are very long (like Admin -> Settings).
Proposal
Use scroll_to helper:
def save_settings
scroll_to '.form-actions' do
click_button 'Save'
end
end
# Implementation in Page::Base
def scroll_to(css, &block)
page.execute_script <<~JS
document.getElementsByClassName("#{css.sub(/^\./, '')}")[0].scrollIntoView();
JS
page.within(css, &block)
end
It works, but we can improve this helper even further.
This is implemented in Geo tests MR (not pushed yet).