diff --git a/features/desktop/change_settings.feature b/features/desktop/change_settings.feature index 4655b2a9d..02b199ccf 100644 --- a/features/desktop/change_settings.feature +++ b/features/desktop/change_settings.feature @@ -19,12 +19,12 @@ Feature: Change settings Scenario: Change my email preferences When I uncheck "user_email_preferences_mentioned" - And I scroll a bit + And I scroll to "change_email_preferences" And I press "change_email_preferences" Then I should see "Email notifications changed" And the "user_email_preferences_mentioned" checkbox should not be checked When I uncheck "user_email_preferences_mentioned_in_comment" - And I scroll a bit + And I scroll to "change_email_preferences" And I press "change_email_preferences" Then I should see "Email notifications changed" And the "user_email_preferences_mentioned_in_comment" checkbox should not be checked diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index ac5302e6f..040106fae 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -167,10 +167,6 @@ Then /^I should see (\d+) contacts$/ do |n_posts| has_css?("#people-stream .stream-element", count: n_posts.to_i).should be true end -When /^I scroll a bit$/ do - page.execute_script("window.scrollBy(0,200)") -end - And /^I scroll down$/ do page.execute_script("window.scrollBy(0,3000000)") end diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 4067ad5f4..952bcbee0 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -195,3 +195,8 @@ Then /^I wait until ajax requests finished$/ do loop until page.evaluate_script("jQuery.active") == 0 end end + +When /^I scroll to "([^"]*)"$/ do |element_id| + element = find_by_id(element_id) # rubocop:disable Rails/DynamicFindBy + page.scroll_to(element, align: :bottom) +end