fixing test driver related errors in notification_highlighter_spec
This commit is contained in:
parent
49ab06180d
commit
5db2cdeca4
|
|
@ -11,15 +11,17 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
|
|||
|
||||
shared_examples_for :notification_badge do |options|
|
||||
it "in correct state" do
|
||||
sign_in_poltergeist(user) unless page.has_selector?('h2', 'musicians')
|
||||
badge = find("#{NOTIFICATION_PANEL} .badge", text:options[:count])
|
||||
badge['class'].include?('highlighted').should == options[:highlighted]
|
||||
save_screenshot("notification_highlighter.png")
|
||||
#sign_in_poltergeist(user) unless page.has_selector?('h2', 'musicians')
|
||||
sign_in_poltergeist(user) unless page.has_selector?('h2', text: 'musicians')
|
||||
badge = find("#{NOTIFICATION_PANEL} .badge", text: options[:count], visible: :all)
|
||||
badge['class'].include?('highlighted').should == options[:highlighted]
|
||||
|
||||
if options[:action] == :click
|
||||
badge.trigger(:click)
|
||||
badge = find("#{NOTIFICATION_PANEL} .badge", text:0)
|
||||
badge['class'].include?('highlighted').should == false
|
||||
end
|
||||
if options[:action] == :click
|
||||
badge.click
|
||||
badge = find("#{NOTIFICATION_PANEL} .badge", text:0, visible: :all)
|
||||
badge['class'].include?('highlighted').should == false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -36,6 +38,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
|
|||
user.reload
|
||||
end
|
||||
|
||||
|
||||
it_behaves_like :notification_badge, highlighted: false, count:0
|
||||
|
||||
describe "sees notification" do
|
||||
|
|
@ -53,13 +56,13 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
|
|||
notification = Notification.send_text_message("text message", user2, user)
|
||||
notification.errors.any?.should be false
|
||||
end
|
||||
|
||||
|
||||
it_behaves_like :notification_badge, highlighted: true, count:1, action: :click
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "and realtime notifications with sidebar open" do
|
||||
describe "and realtime notifications with sidebar open" do
|
||||
before(:each) do
|
||||
# generate one message so that count = 1 to start
|
||||
notification = Notification.send_text_message("text message", user2, user)
|
||||
|
|
@ -101,7 +104,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "user with new notifications" do
|
||||
|
|
@ -154,7 +157,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
|
|||
in_client(user2) do
|
||||
sign_in_poltergeist(user2)
|
||||
find_musician(user)
|
||||
find(".result-list-button-wrapper[data-musician-id='#{user.id}'] .search-m-friend").trigger(:click)
|
||||
find(".result-list-button-wrapper[data-musician-id='#{user.id}'] .search-m-friend").click
|
||||
end
|
||||
|
||||
in_client(user) do
|
||||
|
|
|
|||
Loading…
Reference in New Issue