mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Merge pull request #1402 from jnicklas/travis_window_timing
tweak test timings for window API to improve reliability on travis
This commit is contained in:
commit
1d2529d59c
2 changed files with 5 additions and 4 deletions
|
@ -8,7 +8,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
|
||||||
end
|
end
|
||||||
|
|
||||||
after(:each) do
|
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
|
raise Capybara::CapybaraError if @session.windows.size != 1
|
||||||
end
|
end
|
||||||
@session.switch_to_window(@window)
|
@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);')
|
@session.execute_script('setTimeout(function(){ window.close(); }, 500);')
|
||||||
end
|
end
|
||||||
Capybara.using_wait_time 0.1 do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
|
||||||
@session.within_window @other_window do
|
@session.within_window @other_window do
|
||||||
@session.execute_script('setTimeout(function(){ window.close(); }, 500);')
|
@session.execute_script('setTimeout(function(){ window.close(); }, 500);')
|
||||||
end
|
end
|
||||||
Capybara.using_wait_time 0.7 do
|
Capybara.using_wait_time 1.5 do
|
||||||
expect(@other_window).to become_closed
|
expect(@other_window).to become_closed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -126,10 +126,11 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
|
||||||
window.resize_to(screen_width-100, screen_height-100)
|
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])
|
expect(@session.evaluate_script("[window.outerWidth, window.outerHeight];")).to eq([screen_width-100, screen_height-100])
|
||||||
window.maximize
|
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])
|
expect(@session.evaluate_script("[window.outerWidth, window.outerHeight];")).to eq([screen_width, screen_height])
|
||||||
end
|
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
|
@other_window = @session.window_opened_by do
|
||||||
@session.find(:css, '#openWindow').click
|
@session.find(:css, '#openWindow').click
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue