diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-06-19 20:30:56 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-06-19 20:30:56 +0300 |
commit | 6c9e7f283fa655ff895bf830dea2ec6cb5aea511 (patch) | |
tree | e48fcaddb98a1228740c8a378bbd3ba1e8ae4481 /features | |
parent | 865c36bc8a96d3af86d20d0a24bdc41f30adcc51 (diff) | |
parent | 6fadfb30fed1461d1c66b1a692d594c3ba08abe4 (diff) |
Merge branch 'next-minor' into develop
Diffstat (limited to 'features')
-rw-r--r-- | features/desktop/change_settings.feature | 4 | ||||
-rw-r--r-- | features/step_definitions/custom_web_steps.rb | 8 | ||||
-rw-r--r-- | features/step_definitions/notifications_steps.rb | 2 | ||||
-rw-r--r-- | features/step_definitions/publisher_steps.rb | 16 | ||||
-rw-r--r-- | features/step_definitions/web_steps.rb | 9 | ||||
-rw-r--r-- | features/support/publishing_cuke_helpers.rb | 4 |
6 files changed, 18 insertions, 25 deletions
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 19eb58138..81c9f879c 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -173,14 +173,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 - Then /^I should have scrolled down$/ do expect(page.evaluate_script("window.pageYOffset")).to be > 0 end diff --git a/features/step_definitions/notifications_steps.rb b/features/step_definitions/notifications_steps.rb index 9088dacc2..9c521a908 100644 --- a/features/step_definitions/notifications_steps.rb +++ b/features/step_definitions/notifications_steps.rb @@ -24,7 +24,7 @@ And "I wait for notifications to load" do end And "I scroll down on the notifications dropdown" do - page.execute_script("$('.notifications').scrollTop(350)") + find(".notifications").scroll_to(0, 350) end Then "the notification dropdown should be visible" do diff --git a/features/step_definitions/publisher_steps.rb b/features/step_definitions/publisher_steps.rb index 5afa5f5fe..56c7917a5 100644 --- a/features/step_definitions/publisher_steps.rb +++ b/features/step_definitions/publisher_steps.rb @@ -13,9 +13,11 @@ Then /^the publisher should be expanded$/ do end When /^I click to delete the first uploaded photo$/ do - page.execute_script("$('#photodropzone .x').css('display', 'block');") image_count = all(".publisher_photo img", wait: false).count - find("#photodropzone .x", match: :first).trigger "click" + within "ul#photodropzone" do + first("img").hover + find(".x", match: :first).trigger "click" + end page.assert_selector(".publisher_photo img", count: image_count - 1) end @@ -68,12 +70,6 @@ When /^I post an extremely long status message$/ do end When /^I select "([^"]*)" on the aspect dropdown$/ do |text| - page.execute_script( - "$('#publisher .dropdown .dropdown_list, #publisher .aspect-dropdown .dropdown-menu') - .find('li').each(function(i,el){ - var elem = $(el); - if ('" + text + "' == $.trim(elem.text()) ) { - elem.click(); - }});" - ) + find("button.dropdown-toggle").click + find(".dropdown-menu li", text: text).click end diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index a5136747e..e65f200d1 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -171,8 +171,8 @@ Then /^the "([^"]*)" bootstrap-switch should be (on|off)$/ do |label, state| end end -Then /^I toggle the "([^"]*)" bootstrap-switch$/ do |label| - page.execute_script("return $('#{label}').bootstrapSwitch('toggleState')") +Then /^I toggle the "#([^"]*)" bootstrap-switch$/ do |id| + find(".bootstrap-switch-id-#{id}").click end Then /^(?:|I )should be on (.+)$/ do |page_name| @@ -196,3 +196,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 diff --git a/features/support/publishing_cuke_helpers.rb b/features/support/publishing_cuke_helpers.rb index a7c59a6cc..7d0951275 100644 --- a/features/support/publishing_cuke_helpers.rb +++ b/features/support/publishing_cuke_helpers.rb @@ -27,10 +27,10 @@ module PublishingCukeHelpers end def upload_file_with_publisher(path) - page.execute_script(%q{$("input[name='qqfile']").css("opacity", '1');}) image_count = all(".publisher_photo img", wait: false).count with_scope("#publisher-textarea-wrapper") do - attach_file("qqfile", Rails.root.join(path).to_s) + find('input[name="qqfile"]', visible: false) + .attach_file(Rails.root.join(path).to_s, make_visible: true) # wait for the image to be ready page.assert_selector(".publisher_photo.loading", count: 0) page.assert_selector(".publisher_photo img", count: image_count + 1) |