mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Test to verify fix for #399
This commit is contained in:
parent
808e23a208
commit
8e80fe635a
1 changed files with 51 additions and 0 deletions
|
@ -131,4 +131,55 @@ describe Capybara::Session do
|
|||
subject.response_headers['X-Capybara'].should == nil
|
||||
end
|
||||
end
|
||||
|
||||
context "slow iframe app" do
|
||||
before do
|
||||
@app = Class.new(ExampleApp) do
|
||||
get '/' do
|
||||
<<-HTML
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
function hang() {
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4){
|
||||
document.getElementById('p').innerText = 'finished'
|
||||
}
|
||||
}
|
||||
xhr.open('GET', '/slow', true);
|
||||
xhr.send();
|
||||
document.getElementById("f").src = '/iframe';
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="#" onclick="hang()">Click Me!</a>
|
||||
<iframe src="about:blank" id="f"></iframe>
|
||||
<p id="p"></p>
|
||||
</body>
|
||||
</html>
|
||||
HTML
|
||||
end
|
||||
|
||||
get '/slow' do
|
||||
status 204
|
||||
sleep 1
|
||||
end
|
||||
|
||||
get '/iframe' do
|
||||
status 204
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "should not hang the server" do
|
||||
subject.visit("/")
|
||||
subject.click_link('Click Me!')
|
||||
Capybara.using_wait_time(5) do
|
||||
subject.should have_content("finished")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue