-
Notifications
You must be signed in to change notification settings - Fork 415
Conversation
Thanks man, you got a whole lot further than I did! Really looking forward to getting the last spec fixed. I might give it a try this weekend if work situation is willing. |
@mhenrixon no problem ;) Please give it a try to confirm everything still works as expected |
Good work! |
Great job. Regarding multiple-file upload, I assume this test actually tries to upload two files with one file picker? Unfortunately that's not supported by PhantomJS yet. I thought it was supported in master but it doesn't look like it. So I will probably need to work on adding it to PhantomJS (or somebody here is welcome to have a go, but you'll need to mess around with Qt and C++). In the meantime, is it possible to ignore the test / mark as pending for now? I don't know if the new stuff in Capybara 2.0 permits this. |
Also, let's not remove support for calling |
@jonleighton I was trying to turn it off, but because those specs are not tagged, currently we can't. We need capybara to tag those specs for us and then we can add |
Rebased with aliased save_screenshot and a couple of small details |
Awesome! |
@@ -14,13 +14,13 @@ Gem::Specification.new do |s| | |||
s.summary = "PhantomJS driver for Capybara" | |||
s.description = "PhantomJS driver for Capybara" | |||
|
|||
s.add_dependency "capybara", "~> 1.1" | |||
s.add_dependency "capybara", ">= 2.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd rather stick with ~> 2.0
here, wdyt?
Nice @brutuscat 👍 |
@carlosantoniodasilva Capybara 2.0 had some quirks that can be a bit uncanny. See diff here teamcapybara/capybara@2.0.0...2.0.1 |
@timonv Ok, got it, but any bundle update would give you 2.0.1 anyway. It's just that I don't feel safe using |
Can't disagree on that, +1 on making it ~> |
There you go @carlosantoniodasilva |
@brutuscat ❤️ Lets wait @jonleighton thoughts now :) |
work great here, good job |
There were slight API changes between 2.0.0 and 2.0.1, which is why capybara-webkit locks at 2.0.1. It's technically incorrect for the gemfile to be compatible with 2.0.0 because of those API changes. It probably doesn't matter much, except for those using the #source/#html methods, or node equality. |
can't we do this: s.add_dependency "capybara", "~> 2.0", ">= 2.0.1" ? |
It looks like we can http://rubygems.rubyforge.org/rubygems-update/Gem/Specification.html#method-i-add_runtime_dependency EDIT I see you are doing it with faye-websocket |
@@ -324,8 +324,10 @@ Include as much information as possible. For example: | |||
|
|||
### Next release ### | |||
|
|||
#### Features #### | |||
#### Bug fixes #### | |||
* Add Capybara 2.0 support. (Mauro Asprea) [Issue #163] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a nitpick, but please insert a newline above the start of the list to be consistent (and the same for the "Features" bit below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I consider Capybara 2 support to be a feature, not a bug fix ;)
PhantomJS 1.8 will be release around 20th December. I am going to try and see if I can implement support for multiple file upload and get it in the release. |
Awesome news :) |
@jonleighton, not sure if it's of much help given the architectural differences between PhantomJS and capybara-webkit, but you can see how I implemented multiple file upload here: thoughtbot/capybara-webkit@ea2f785. |
@mhoran thanks, it's a useful demonstration of how to use QtWebKit's crazy API ;) |
Multiple file upload implemented in ariya/phantomjs#357. |
The patch is now merged into phantomjs and so will be supported by 1.8. @brutuscat, if you are keen to update your PR you could compile phantomjs master and get it passing. or we can just wait until 1.8 is out. |
@jonleighton I have no idea what to do actually. I guess it would be better to wait till 1.8 my env is kind of broken and I couldn't compile it so... Let me know what I should do to push this ;) |
@brutuscat ok, let's wait for 1.8 to be out. it's only a few days away. |
Aaaand it's out :) |
Regarding that failure, see #228. |
What can be done to help this get fixed? I want Capybara 2 and Poltergeist. I have time and energy. |
There is a bug in poltergeist cookie handling:
This fails if no expires value is passed in. It should handle a nil/blank value |
Can't wait ⏰! |
Tested with phantomjs 1.8.1 and all specs passing now.
Also synced with master (readme was conflicting) @jonleighton could you confirm that all specs are passing? It seems that Travis doesn't like non fast-forward commits(?) |
Travis is failing for rubies v1.8 https://travis-ci.org/brutuscat/poltergeist |
Awesome work @brutuscat! I do however wonder why the test suite has gotten so slow though. Is it something capybara did or is it new phantomjs version or is there something we can do in the tests? |
@brutuscat So take out 1.8 for Travis and you're fine. |
@mhenrixon I think I read somewhere that Capybara server is not using Thin anymore because of being not thread safe or something like that... @HangingClowns is good to know that. Thanks! Will see what @jonleighton says about it |
@mhenrixon You can see it here in the 2.0.1 compare against 2.0.2 teamcapybara/capybara@2.0.1...2.0.2#L3R177 |
Since we are using unicorn for hosting our app on heroku I thought I should give it a whirl. Capybara.server do |app, port|
Unicorn::Configurator::RACKUP[:port] = port
Unicorn::Configurator::RACKUP[:set_listener] = true
server = Unicorn::HttpServer.new(app)
server.start
end That shaves of between 15-20 seconds every minute on our test suite but it's still much much slower than poltergeist on capybara 1 with thin and when I tried running it against the poltergeist features I had a lot of failures. |
@brutuscat just ran the test and everything looks good except this performance issue. we really need to resolve the performance problem before we can release this. I'll try to look at it but any help is appreciated. |
Profiling reveals a lot of time is being spent in
Seems like there are a number of specs that are taking a long time synchronising. BTW I don't think this is to do with using/not using thing as the web server. Thin is not used for Poltergeist master's tests. |
It looks like Capybara now sets Previously, we were using a 0 wait time everywhere. Monkey-patching that method to set it to 0 makes the tests run at normal speed again. But it also results in some failures. I need to investigate why they've made this change but I've run out of time for tonight. |
Looks like the timeout was changed here: teamcapybara/capybara@0b28aa2. The commit message confirms the flickering failures. |
@jonleighton that´s correct. I've taken a look at my slowest test and I can see that there is one second of delay per assert: https://github.com/jnicklas/capybara/blob/master/lib/capybara/spec/session/has_select_spec.rb#L24
|
Ok, now all is green again
What I did was to Comments? |
I think that's ok then, since poltergeist is faster than selenium by default I don't think that should affect us much. I don't know about you but those minutes really count! |
@brutuscat I'm currently using your branch and it's not quite working like how it should be. This scenario works fine on Selenium, but seems to error out on yours. I have a complete Backbone app on top of a Rails backend, so it would be nice to switch to poltergeist, but if poltergeist keeps failing, then it's kind of a pain in the butt to have to wait on selenium. According to Capybara 2, they removed the wait_until, and the waiting is supposed to be better, but poltergeist doesn't seem to be waiting at all. It's the same error I have for Issue #239. As you can see, I've also tried the find_button instead, but still no use. In fact, I'm getting a Here is my step: Given /^I am logged in$/ do
visit('/login')
fill_in "user_email", :with => @user.email
fill_in "user_password", :with => FactoryGirl.build(:user).password
# find_button("Sign in").trigger('click')
click_button("Sign in")
sleep 1
find_link('Login').should_not be_visible
find('li.dropdown').should be_visible
end |
@HangingClowns, guys if you take a look at the code I've "changed", I didn't introduce any behavioural change. Particularly in your case, and from what I understand, you should not need the |
Well, i know it's working this far because it took a screenshot when it fails with capybara-screenshot gem and it's always on that spot. I'm also positive that it's using capybara for more than one reason. Main reason is that the only HTML page I have is a blank template, and the screenshot has content put in from a Backbone view. The other reason I know It's using Poltergeist is because I've changed the default driver to poltergeist and the javascript driver as selenium. When I tag it with javascript, it passes with flying colors, when I untag it, it fails immediately after the button press. It doesn't seem to wait for the menus to switch. I have 2 menus. Upon successful login, the "guest navbar" gets hidden and the "user navbar" becomes visible. Both items are on the same page already. Does it actually wait for this user navbar to become visible, like selenium or does it just immediately fail after clicking the button? |
@mhoran thanks for digging out that commit. that's kinda interesting. I previously assumed that @brutuscat great work on reducing the test time! could you rebase the code please? then I think we're ready to merge! @HangingClowns I reckon your issue is unrelated to this - best thing to do would be file a new bug report with steps to reproduce. |
@jonleighton Already filed and linked at #239. The reason I mention it here as it is kind of covered under upgrading because I shouldn't have to sleep to make this pass. It could be dieing for another reason, since I also wasn't able to get it to pass before under 1.1.2. |
@jonleighton it's already rebased right? Or you want me to merge in your last commit too? I did synced with master your changes because some conflicts in the README (that was 5 days ago) |
weird, GH it saying " This pull request cannot be automatically merged. " I'll try to merge it manually. |
Merged, thank you everyone who helped with this! |
See: #136 Capybara 2.0 support
Things changed:
:domain => '127.0.0.1'
(for a failing spec)All but one capybara's spec are passing:
@jonleighton I'm calling for help here to fix multiple file uploads