mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Make sure to wait for the desired window to load, not just any window
This commit is contained in:
parent
82f84fbde1
commit
baf21c99ef
1 changed files with 9 additions and 1 deletions
|
@ -1584,7 +1584,15 @@ describe Capybara::Driver::Webkit do
|
|||
it "waits for the new window to load" do
|
||||
subject.visit("/new_window?sleep=1")
|
||||
subject.within_window(subject.window_handles.last) do
|
||||
lambda { Timeout::timeout(1) { subject.find("//p") } }.should_not raise_error(Timeout::Error)
|
||||
subject.find("//p").first.text.should == "finished"
|
||||
end
|
||||
end
|
||||
|
||||
it "waits for the new window to load when the window location has changed" do
|
||||
subject.visit("/new_window?sleep=2")
|
||||
subject.execute_script("setTimeout(function() { window.location = 'about:blank' }, 1000)")
|
||||
subject.within_window(subject.window_handles.last) do
|
||||
subject.find("//p").first.text.should == "finished"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue