diff options
Diffstat (limited to 'spec/support/helpers/capybara_helpers.rb')
-rw-r--r-- | spec/support/helpers/capybara_helpers.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/support/helpers/capybara_helpers.rb b/spec/support/helpers/capybara_helpers.rb index a7baa7042c9..13ec179b734 100644 --- a/spec/support/helpers/capybara_helpers.rb +++ b/spec/support/helpers/capybara_helpers.rb @@ -46,4 +46,14 @@ module CapybaraHelpers def javascript_test? Capybara.current_driver == Capybara.javascript_driver end + + def scroll_to(element) + raise 'JS not available' unless javascript_test? + + script = <<-JS + arguments[0].scrollIntoView(true); + JS + + page.driver.browser.execute_script(script, element.native) + end end |