diff --git a/features/desktop/notifications.feature b/features/desktop/notifications.feature index 70a454d61..2dd5eaee4 100644 --- a/features/desktop/notifications.feature +++ b/features/desktop/notifications.feature @@ -112,7 +112,7 @@ Feature: Notifications When I filter notifications by mentions Then I should see "mentioned you in the post" - Scenario: show aspect dropdown in user hovercard + Scenario: show hovercard in notification dropdown from the profile edit page When I sign in as "bob@bob.bob" And I am on "alice@alice.alice"'s page And I add the person to my "Besties" aspect @@ -120,11 +120,13 @@ Feature: Notifications When I sign in as "alice@alice.alice" And I go to the edit profile page And I follow "Notifications" in the header - And I activate the first hovercard after loading the notifications page - When I press the aspect dropdown + Then the notification dropdown should be visible + When I wait for notifications to load + And I activate the first hovercard in the notification dropdown + And I press the aspect dropdown Then the aspect dropdown should be visible - Scenario: show hovercard in notification dropdown + Scenario: show hovercard in notification dropdown from the stream When I sign in as "bob@bob.bob" And I am on "alice@alice.alice"'s page And I add the person to my "Besties" aspect @@ -132,7 +134,8 @@ Feature: Notifications When I sign in as "alice@alice.alice" And I follow "Notifications" in the header Then the notification dropdown should be visible - When I activate the first hovercard after loading the notifications page + When I wait for notifications to load + And I activate the first hovercard in the notification dropdown And I press the aspect dropdown Then the aspect dropdown should be visible @@ -151,8 +154,9 @@ Feature: Notifications And I follow "Notifications" in the header Then the notification dropdown should be visible Then the notification dropdown scrollbar should be visible + When I wait for notifications to load Then there should be 10 notifications loaded When I scroll down on the notifications dropdown - Then I should have scrolled down on the notification dropdown - And I wait for notifications to load + Then the notification dropdown should load more notifications + When I wait for notifications to load Then there should be 15 notifications loaded diff --git a/features/step_definitions/notifications_steps.rb b/features/step_definitions/notifications_steps.rb index 607cd34b8..87c27ceff 100644 --- a/features/step_definitions/notifications_steps.rb +++ b/features/step_definitions/notifications_steps.rb @@ -1,8 +1,8 @@ -When /^I filter notifications by likes$/ do +When "I filter notifications by likes" do step %(I follow "Liked" within "#notifications_container .list-group") end -When /^I filter notifications by mentions$/ do +When "I filter notifications by mentions" do step %(I follow "Mentioned" within "#notifications_container .list-group") end @@ -18,31 +18,30 @@ Then /^I should( not)? have activated notifications for the post( in the single end And "I wait for notifications to load" do - page.should_not have_selector(".loading") + expect(find("#notification-dropdown")).to have_no_css(".loading") end -And /^I scroll down on the notifications dropdown$/ do +And "I scroll down on the notifications dropdown" do page.execute_script("$('.notifications').scrollTop(350)") end -Then /^I should have scrolled down on the notification dropdown$/ do - expect(page.evaluate_script("$('.notifications').scrollTop()")).to be > 0 +Then "the notification dropdown should load more notifications" do + expect(find("#notification-dropdown")).to have_css(".loading") end -Then /^the notification dropdown should be visible$/ do +Then "the notification dropdown should be visible" do expect(find(:css, "#notification-dropdown")).to be_visible end -Then /^the notification dropdown scrollbar should be visible$/ do - find(:css, ".ps-active-y").should be_visible +Then "the notification dropdown scrollbar should be visible" do + expect(find(:css, ".ps-active-y")).to be_visible end Then /^there should be (\d+) notifications loaded$/ do |n| - result = page.evaluate_script("$('.media.stream-element').length") - result.should == n.to_i + expect(page).to have_css("#notification-dropdown .media.stream-element", count: n) end -And /^I activate the first hovercard after loading the notifications page$/ do - page.should have_css '.notifications .hovercardable' - first('.notifications .hovercardable').hover +When "I activate the first hovercard in the notification dropdown" do + expect(page).to have_css("#notification-dropdown .hovercardable") + first("#notification-dropdown .hovercardable").hover end