Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Raise errors with the requested URL and not the last loaded URL

  • Loading branch information...
commit 7a8cd4cc2fe7c4dd13b5d10552f0edf5ccd3eb56 1 parent 85ac9c1
Joe Ferris jferris authored
Showing with 29 additions and 4 deletions.
  1. +28 −3 spec/driver_spec.rb
  2. +1 −1  src/WebPage.cpp
31 spec/driver_spec.rb
View
@@ -546,17 +546,42 @@
end
end
+ context "error app" do
+ before(:all) do
+ @app = lambda do |env|
+ if env['PATH_INFO'] == "/error"
+ body = "error"
+ [404, {}, []]
+ else
+ body = <<-HTML
+ <html><body>
+ <form action="/error"><input type="submit"/></form>
+ </body></html>
+ HTML
+ [200,
+ { 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
+ [body]]
+ end
+ end
+ end
+
+ it "raises a webkit error for the requested url" do
+ expect {
+ subject.find("//input").first.click
+ subject.find("//p")
+ }.
+ to raise_error(Capybara::Driver::Webkit::WebkitError, %r{/error})
+ end
+ end
+
context "slow error app" do
before(:all) do
@app = lambda do |env|
if env['PATH_INFO'] == "/error"
- puts "time for an error"
body = "error"
sleep(1)
- puts "done with error"
[304, {}, []]
else
- puts "time for great success"
body = <<-HTML
<html><body>
<form action="/error"><input type="submit"/></form>
2  src/WebPage.cpp
View
@@ -87,6 +87,6 @@ bool WebPage::isLoading() const {
}
QString WebPage::failureString() {
- return QString("Unable to load URL: ") + currentFrame()->url().toString();
+ return QString("Unable to load URL: ") + currentFrame()->requestedUrl().toString();
}
Please sign in to comment.
Something went wrong with that request. Please try again.