Fix notification cukes

closes #7210
This commit is contained in:
Steffen van Bergerem 2016-11-21 00:49:32 +01:00 committed by Benjamin Neff
parent e040002172
commit c765909914
2 changed files with 24 additions and 21 deletions

View file

@ -112,7 +112,7 @@ Feature: Notifications
When I filter notifications by mentions When I filter notifications by mentions
Then I should see "mentioned you in the post" 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" When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page And I am on "alice@alice.alice"'s page
And I add the person to my "Besties" aspect And I add the person to my "Besties" aspect
@ -120,11 +120,13 @@ Feature: Notifications
When I sign in as "alice@alice.alice" When I sign in as "alice@alice.alice"
And I go to the edit profile page And I go to the edit profile page
And I follow "Notifications" in the header And I follow "Notifications" in the header
And I activate the first hovercard after loading the notifications page Then the notification dropdown should be visible
When I press the aspect dropdown 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 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" When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page And I am on "alice@alice.alice"'s page
And I add the person to my "Besties" aspect And I add the person to my "Besties" aspect
@ -132,7 +134,8 @@ Feature: Notifications
When I sign in as "alice@alice.alice" When I sign in as "alice@alice.alice"
And I follow "Notifications" in the header And I follow "Notifications" in the header
Then the notification dropdown should be visible 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 And I press the aspect dropdown
Then the aspect dropdown should be visible Then the aspect dropdown should be visible
@ -151,8 +154,9 @@ Feature: Notifications
And I follow "Notifications" in the header And I follow "Notifications" in the header
Then the notification dropdown should be visible Then the notification dropdown should be visible
Then the notification dropdown scrollbar 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 Then there should be 10 notifications loaded
When I scroll down on the notifications dropdown When I scroll down on the notifications dropdown
Then I should have scrolled down on the notification dropdown Then the notification dropdown should load more notifications
And I wait for notifications to load When I wait for notifications to load
Then there should be 15 notifications loaded Then there should be 15 notifications loaded

View file

@ -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") step %(I follow "Liked" within "#notifications_container .list-group")
end end
When /^I filter notifications by mentions$/ do When "I filter notifications by mentions" do
step %(I follow "Mentioned" within "#notifications_container .list-group") step %(I follow "Mentioned" within "#notifications_container .list-group")
end end
@ -18,31 +18,30 @@ Then /^I should( not)? have activated notifications for the post( in the single
end end
And "I wait for notifications to load" do And "I wait for notifications to load" do
page.should_not have_selector(".loading") expect(find("#notification-dropdown")).to have_no_css(".loading")
end 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)") page.execute_script("$('.notifications').scrollTop(350)")
end end
Then /^I should have scrolled down on the notification dropdown$/ do Then "the notification dropdown should load more notifications" do
expect(page.evaluate_script("$('.notifications').scrollTop()")).to be > 0 expect(find("#notification-dropdown")).to have_css(".loading")
end 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 expect(find(:css, "#notification-dropdown")).to be_visible
end end
Then /^the notification dropdown scrollbar should be visible$/ do Then "the notification dropdown scrollbar should be visible" do
find(:css, ".ps-active-y").should be_visible expect(find(:css, ".ps-active-y")).to be_visible
end end
Then /^there should be (\d+) notifications loaded$/ do |n| Then /^there should be (\d+) notifications loaded$/ do |n|
result = page.evaluate_script("$('.media.stream-element').length") expect(page).to have_css("#notification-dropdown .media.stream-element", count: n)
result.should == n.to_i
end end
And /^I activate the first hovercard after loading the notifications page$/ do When "I activate the first hovercard in the notification dropdown" do
page.should have_css '.notifications .hovercardable' expect(page).to have_css("#notification-dropdown .hovercardable")
first('.notifications .hovercardable').hover first("#notification-dropdown .hovercardable").hover
end end