In some cases, when I issue a visit, then a click that triggers a post request, I see on the log that the POST occurs, but after the POST, anything I do with capybara I get a Capybara::Driver::Webkit::WebkitInvalidResponseError, saying something like
Unable to load URL: http://127.0.0.1:40583/runs/1
This does not happen on all POSTs. I also made a barebone controller as a "control" and that does not manifest this behavior, so I suspect it's somewhere in my controller for the POST that's causing this, but rack_test and normal browser all work fine on that POST.
Has anyone ran into something like this before?
I had thought the reason was because of the redirect after the POST, but even if I just do POST w/o redirect, subsequent visit via capybara-webkit still gives me this error.
I believe this issue is related to the fact the QTWebkit resends the Content-Type header on redirects. So for instance, if you have a multipart form that submits to an action that redirects, the multipart Content-Type will be sent and Rack will choke on it. There is a fix in the works for this issue and it should be in master today or tomorrow.
Awesome. Thanks for getting back so fast. I didn't check enctype set to multipart. And I can now verify that is exactly what fails. Using a simple controller and view, post w/ multipart content-type fails, but post w/o enctype works.
Redirects should not send content type. Fixes #162
@halogenandtoast it works like an absolute charm, thank you! :)
Can we get a new version of the gem with this fix included? I've got a deploy process that is not setup to build a custom version of a gem and I'd like to avoid revamping my build/deploy process if possible.
This issue has been bugging us for a while ... thanks for fixing it, you're awesome guys!
Any update on this? I am getting the same error :(
Hi jedeleh, thanks a lot for your response. I have tried tons of things including building from the git repo etc, but the problem remains. Funny thing, I think I have managed to isolate what seems to be causing it... it's (if I am right) the jQuery autocomplete... but I am not 100% sure yet and haven't found any workarounds yet :(
I've left my fork up for now with the fix for this and another bug at https://github.com/rud/capybara-webkit, if that is any help.
I'm getting the same issue on get requests: (I tried your git repo too @rud)
1) Main app Should login with correct info
Failure/Error: visit "/calls"
Unable to load URL: http://127.0.0.1:53529/calls
If I use selenium it works just fine....
@cj Over at #13 (comment) I posted some tips on how to get more debug output from both client and server when running with capybara-webkit. First try the webkit_debug driver, it's super easy, and you'll get a better feel for what is happening on the server.
Any update on this issue?
Just tried with the latest HEAD as well as the latest released version and both fail.
Also tried it with @rud HEAD, but didn't work either
Works fine with selenium.
I had same exception at the end of one of my test suites - it seems like webkit tries to send request to webserver (thin), but it is shutted down. I removed thin, so tests run on webrick and exception is gone.
I ran into something similar too. For me it happens when clicking a link within an iframe (using within_frame)
It happens for me as well. But it happens randomly.
Same problem here. Any solution?
Still happening. Selenium works fine.