1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

tweak test timings for window API to improve reliability on travis

This commit is contained in:
Thomas Walpole 2014-09-19 14:29:41 -07:00
parent e448e959e5
commit 472e70f2d9
2 changed files with 5 additions and 4 deletions

View file

@ -8,7 +8,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
end
after(:each) do
@session.document.synchronize(3, errors: [Capybara::CapybaraError]) do
@session.document.synchronize(5, errors: [Capybara::CapybaraError]) do
raise Capybara::CapybaraError if @session.windows.size != 1
end
@session.switch_to_window(@window)
@ -20,7 +20,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
@session.execute_script('setTimeout(function(){ window.close(); }, 500);')
end
Capybara.using_wait_time 0.1 do
expect(@other_window).to become_closed(wait: 0.7)
expect(@other_window).to become_closed(wait: 2)
end
end
@ -41,7 +41,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
@session.within_window @other_window do
@session.execute_script('setTimeout(function(){ window.close(); }, 500);')
end
Capybara.using_wait_time 0.7 do
Capybara.using_wait_time 1.5 do
expect(@other_window).to become_closed
end
end

View file

@ -126,10 +126,11 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
window.resize_to(screen_width-100, screen_height-100)
expect(@session.evaluate_script("[window.outerWidth, window.outerHeight];")).to eq([screen_width-100, screen_height-100])
window.maximize
sleep 0.5 # The timing on maximize is finicky on Travis -- wait a bit for maximize to occur
expect(@session.evaluate_script("[window.outerWidth, window.outerHeight];")).to eq([screen_width, screen_height])
end
it 'should switch to original window if invoked not for current window' do
it 'should switch to original window if invoked not for current window', requires: [:windows, :js] do
@other_window = @session.window_opened_by do
@session.find(:css, '#openWindow').click
end