Move some custom web steps to notifications steps

This commit is contained in:
Steffen van Bergerem 2016-11-20 23:57:54 +01:00 committed by Benjamin Neff
parent d3faed74eb
commit e040002172
2 changed files with 30 additions and 30 deletions

View file

@ -210,36 +210,11 @@ end
And /^I scroll down$/ do And /^I scroll down$/ do
page.execute_script("window.scrollBy(0,3000000)") page.execute_script("window.scrollBy(0,3000000)")
end end
And /^I scroll down on the notifications dropdown$/ do
page.execute_script("$('.notifications').scrollTop(350)")
end
Then /^I should have scrolled down$/ do Then /^I should have scrolled down$/ do
expect(page.evaluate_script("window.pageYOffset")).to be > 0 expect(page.evaluate_script("window.pageYOffset")).to be > 0
end end
Then /^I should have scrolled down on the notification dropdown$/ do
expect(page.evaluate_script("$('.notifications').scrollTop()")).to be > 0
end
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
end
Then /^there should be (\d+) notifications loaded$/ do |n|
result = page.evaluate_script("$('.media.stream-element').length")
result.should == n.to_i
end
And "I wait for notifications to load" do
page.should_not have_selector(".loading")
end
When /^I resize my window to 800x600$/ do When /^I resize my window to 800x600$/ do
page.driver.resize(800, 600) page.driver.resize(800, 600)
end end
@ -321,8 +296,3 @@ end
Then(/^I should have a validation error on "(.*?)"$/) do |field_list| Then(/^I should have a validation error on "(.*?)"$/) do |field_list|
check_fields_validation_error field_list check_fields_validation_error field_list
end end
And /^I activate the first hovercard after loading the notifications page$/ do
page.should have_css '.notifications .hovercardable'
first('.notifications .hovercardable').hover
end

View file

@ -16,3 +16,33 @@ Then /^I should( not)? have activated notifications for the post( in the single
expect(find(selector, match: :first)).to have_no_css(".create_participation", visible: false) expect(find(selector, match: :first)).to have_no_css(".create_participation", visible: false)
end end
end end
And "I wait for notifications to load" do
page.should_not have_selector(".loading")
end
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
end
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
end
Then /^there should be (\d+) notifications loaded$/ do |n|
result = page.evaluate_script("$('.media.stream-element').length")
result.should == n.to_i
end
And /^I activate the first hovercard after loading the notifications page$/ do
page.should have_css '.notifications .hovercardable'
first('.notifications .hovercardable').hover
end