VRFS-2001 - fixing test for www

This commit is contained in:
Anthony Davis 2014-09-11 14:49:54 -05:00
parent 446108e9f4
commit a2897d78c3
2 changed files with 5 additions and 6 deletions

View File

@ -49,8 +49,8 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe
it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do
as_monitor(user1) do
puts "\n *** #{user1}'s client *** \n"
sign_in_poltergeist user1
sign_in_poltergeist(user1)
sleep 5 # www really doesn't like going fast here
repeat_for(30.seconds) do
expect(page).to_not have_selector('.no-websocket-connection') #looks for reconnect dialog every 1 second
end
@ -61,7 +61,6 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe
# this example heavily based on text_message_spec.rb in 'web'
as_monitor(user1) do
puts "\n *** #{user1}'s client *** \n"
sign_in_poltergeist(user1)
end
@ -70,7 +69,6 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe
test_goodbye = "#{SecureRandom.uuid} - OK bye!"
as_monitor(user2) do
puts "\n *** #{user2}'s client *** \n"
sign_in_poltergeist(user2)
expect(page).to have_xpath(
"//div[@class='friend-name' and @user-id='#{user1.id}']/span[@class='friend-status']",
@ -84,7 +82,6 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe
end
as_monitor(user1) do
puts "\n *** #{user1}'s client *** \n"
expect(page).to have_xpath(
"//div[@class='friend-name' and @user-id='#{user2.id}']/span[@class='friend-status']",
:text => "Available" )
@ -96,7 +93,6 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe
end
as_monitor(user2) do
puts "\n *** #{user2}'s client *** \n"
sign_out_poltergeist
end
end

View File

@ -53,6 +53,7 @@ def as_monitor(name)
session_name = name.class == JamRuby::User ? name.id : name
Capybara.session_name = mapped_session_name(session_name)
page.driver.headers = { 'User-Agent' => 'monitor' }
puts "\n *** #{name}'s client *** \n"
yield
end
@ -175,8 +176,10 @@ def wait_to_see_my_track
end
def repeat_for(duration=Capybara.default_wait_time)
puts "Running for #{duration} seconds..."
finish_time = Time.now + duration.seconds
loop do
print '.' # "#{(Time.now - finish_time + duration.seconds).round(3)} "
yield
sleep 1 # by default this will execute the block every 1 second
break if (Time.now > finish_time)