diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-23 03:06:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-23 03:06:01 +0000 |
commit | 8c7eab92cd0009f55cb999bbade43e0f969c137e (patch) | |
tree | 180cac6632448a211ddbe555191574c98e8dc385 /spec/support/helpers/capybara_helpers.rb | |
parent | dffeff5520e861dc6e7319b690c573186bbbd22e (diff) | |
download | gitlab-ce-8c7eab92cd0009f55cb999bbade43e0f969c137e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
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 |