Closed tmaier closed 11 years ago
I've had the same problem. The solution for me was put the visit
call at first line inside of it
block (before Factory
calls). For example it could be something like that:
describe "POST /projects/12345/destroy" do
it "destroy", js: true, focus: true do
visit index_path
own_p1 = Fabricate(:project, :name => "Mein Projekt 1", :owner => user.organization)
visit projects_path
Temporary workaround: we found that removing rails_footnotes fixed this error for us. We haven't found what it was about the footnotes that caused an issue.
Any updates?
I am getting similar errors when running on my CI server (ubuntu/jenkins) with both xvfb-run and headless. The test work fine running on my OSX development machine. The tests run for a little while and then I get the error. Once the error appears the rest of the tests fail.
Any work arounds or debugging recommendations?
Here also having the same problems: "No response received from the server" followed by "Broken pipe" error.
Using capybara-webkit 0.7.2
+1 same issue but on capybara-webkit 0.12.1 and capybara 1.1.2
+1 I also get a "No response received from the server" followed by "Broken pipe" errors for all remaining specs. Using capybara-webkit 0.12.1 and capybara 1.1.2 (tried WEBrick and Unicorn as test server)
I have tried QT versions 4.8.0, 4.8.1 and 4.8.2 to no avail. A coworker is on QT 4.7.4 and does not get these errors. I tried switching versions to 4.7.4 with brew, but that bottle is no longer hosted. I then tried to install that version through brew with the --build_from_source option but I get a build error.
@flynfish, @vidriloco do you use twitter-bootstrap-rails? Or any other less css gem? My acceptance specs used to run fine until I moved from a sass version of twitter bootstrap to the less version (twitter-bootstrap-rails).
It might have something to do with this bug or it might be a coincidence..
@andruby I am indeed using less-rails-bootstrap. Were you able to fix the issue?
On a sidenote related to my previous comment, I got QT 4.7.4 installed and my tests are still failing with the same no response from server and broken pipe errors. Not sure why it worked on my coworkers environment.
@flynfish I've not tried many solutions yet. Maybe precompiling assets in test environment might work around the bug? Please let me know when you find a fix.
Having the same issue - none of the other engineers are seeing this. Feels like it might be a version issue. I'm on capybara 1.1.2 and capybara-webkit 0.12.1, but all of the rest of the engineers use the same versions. I'm on qt 4.8.2.
So I think we found the root cause, it has to do with font rendering. Not sure if everyone having the issue is running bootstrap, but if we comment out our @import of the font.less file, then the errors go away.
Hmm - we aren't using bootstrap but we are using zurb foundation. Let me see if there are any fonts being included in our project that might be the cause....
what @flynfish and I found was some console output from capybara-webkit complaining about web font rendering. Bootstrap or not, any web font rendering can randomly cause a font render exception to be thrown in webkit in various version of Qt in our experience.
The only reference to @font in our project is in modernizr - but we do have a javascript library that loads assets from a remote server. I bet the core issue is actually any call to a remote server... Hmmm.. off to do some testing.
Below is the error I'm seeing:
webkit_server[86928]
@mkrisher how are you getting to that log? It's not in the rails stack trace... is webkit generating a separate log?
@apangeajwrubel yes, I'm seeing it in the console. Likewise console output gets rendered when say running RSpec in the terminal.
ok, this is really weird. Apparently when I commented out that import, webkit decided not to throw any errors. After running it again I got the errors again. :rage1:
Ah - that's it. We're not using RSpec. Output must be different. Still looking in to the cause but we're fairly confident it's related to remote asset loading, which would explain the problem happening with web fonts and external js includes.
I started getting this error today. I happened after running a bundle update
. I reverted the updates one by one and tracked it down to the gem twitter-boostrap-rails (2.1.0)
. The update had brought me from 2.0.7
to 2.1.0
.
Reverting to 2.0.7
fixes this problem entirely for me. I'm going to snoop around in twitter-boostrap-rails and see what might be the culprit.
I'm using
gem 'twitter-bootstrap-rails', '= 2.0.7'
to specify the gem since version 2.0.9
also breaks capybara-webkit.
Update: I specified 2.0.8
and it doesn't break. The error is somewhere between 2.0.8
and 2.0.9
Still debugging this on our end since we don't use twitter bootstrap. I happened to have activity monitor up and noticed a very brief flash of fontd soaking CPU when I started up my test suite. I figure it might be a useful data point since others have seen commenting out web font imports solve the problem.
My guess is that there's some sort of timeout threshold that's being hit. Perhaps if the assets take too long to compile this happens.
Gotta be longer than 60 seconds then - that's as high as I set the default wait time and it didn't seem to change the outcomes.
@apangeajwrubel I tried that too. I was so sure that was going to fix it. The hunt continues.
Do any of you know how to install this gem against a specific version of qt? Thought maybe this was a 4.8.x issue so I grabbed 4.7.4 - this article (https://engineering.purdue.edu/elab/wiki/index.php/Torch_7_Installation_on_Mac_OS_X) indicated 4.8.X might have issues. But there's no bottle for the 4.7.x line of qt anymore so I had to install from the .dmg, and now I can't figure out how capybara-webkit is linking to qt when it installs.
twitter-bootstrap-rails 2.0.9 introduces font-awesome support. According to this thread it has something to do with Qt not being able to handle a font on your system. I suspect Qt can't handle font-awesome.
I can confirm that I am having this bug on a non twitter-bootstrap-rails project which independently uses font-awesome
edit: A temp hack fix for me was:
Switch application.css to application.scss.erb and then manually import font-awesome only if Rails.env.test?
is false.
ie: <% unless Rails.env.test? %> @import "font-awesome" <% end %>
@rschmukler thanks, this also works when using twitter-bootstrap-rails
>= 2.0.9 that has font-awesome included.
I use the font-awesome-sass-rails gem and ran into this issue.
While @rschmukler's solution works, I didn't want to change application.css to use ERB. I came up with the following workaround:
First, remove the asset path that the gem inserts by creating an initializer:
# config/initializers/font_awesome.rb
if Rails.env.test?
Rails.application.config.assets.paths.reject! do |path|
path =~ /font-awesome/
end
end
(You can find out which paths Rails are using by running Rails.application.config.assets.paths
in the Rails console.)
Then create an empty placeholder file called font-awesome.sass
and place it under spec/support/assets/stylesheets
:
// spec/support/assets/stylesheets/font-awesome.sass
// Empty placeholder
Finally include spec/support/assets
in the Rails assets load path in spec_helper.rb
:
# spec/spec_helper.rb
# … other stuff …
Rails.application.config.assets.paths << "spec/support/assets"
Now, when you @import "font-awesome"
in application.css
(or any other place), your specs will use the empty one.
You could instead apply this to the whole test
environment, not just rspec, by adding the spec/support/assets
path in config/environments/test.rb
:
# config/environments/test.rb
config.assets.paths << "spec/support/assets"
@msolli Thanks! I followed your steps and was able to quickly fix my capybara-webkit errors with the font-awesome-sass-rails gem installed.
@msolli : Thanks, you saved my day. Btw, for me the initializer has to be using:
path =~ /fonts/
@rschmukler thanks, dude! That worked.
+10 @moslli since this solution works awesome! +1 @gravis for suggesting using /fonts/
Everything was working fine if I was changing the driver to webkit in the setup of my tests but when I made webkit the default_driver in test_helper.rb I started seeing segfaults in reset_sessions! in my teardown method.
I am using bootstrap with font-awesome enabled.
@msolli 's solution worked for me ( modified for test:unit of course ) but I also had to set path =~ fonts as @gravis mentioned.
Please check out the latest master and let us know if these issues have gone away.
@mhoran i put this in my Gemfile (referencing the latest commit on master at the time of this comment):
gem 'capybara-webkit', git: 'git://github.com/thoughtbot/capybara-webkit.git', ref: '67b8a3391'
And it didn't solve my problem.. i keep receiving No response from the server
error from the firs example and the consequent examples throw Broken pipe
errors
Can anyone confirm this too?
I'm on a Mac OS X 10.8.2 with Qt version 4.8.3 and capybara version 1.1.2
@carloslopes can you run using the :webkit_debug
driver and paste the output? That may tell us which command it's running during the crash.
Sure. Here is the output: https://gist.github.com/3959987
@carloslopes from the backtraces there, it looks like it's running the released version of capybara-webkit (0.12.1) and not the ref you mentioned. Did you remember to run bundle install
and bundle exec
? Also, there have been a couple new fixes on master since that ref, so you may want to use master
instead.
@jferris sorry for the last gist, i forgot that i reverted my gemfile to use the version 0.12.1 so i could make the tests pass on my another machine with linux.
here is the new output: https://gist.github.com/3959987
@carloslopes great - thanks. I think that will help us narrow down where the segfault may be occurring.
@jferris great!
if i can help with something else, just ask me :smile:
+1
Seems to be a QtWebKit issue with certain web fonts with on OS X. Possibly this one? https://bugs.webkit.org/show_bug.cgi?id=61031
Using OS X 10.6.8, Qt 4.7 Using capybara (2.0.1) Using capybara-webkit (0.13.0) from git://github.com/thoughtbot/capybara-webkit.git (at master) with native extensions
I get this exception when running my integration tests:
Broken pipe
@ /Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/bundler/gems/capybara-webkit-2eb38b3c0235/lib/capybara/webkit/connection.rb:21:in `write'
/Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/bundler/gems/capybara-webkit-2eb38b3c0235/lib/capybara/webkit/connection.rb:21:in `puts'
/Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/bundler/gems/capybara-webkit-2eb38b3c0235/lib/capybara/webkit/connection.rb:21:in `puts'
/Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/bundler/gems/capybara-webkit-2eb38b3c0235/lib/capybara/webkit/browser.rb:140:in `command'
/Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/bundler/gems/capybara-webkit-2eb38b3c0235/lib/capybara/webkit/browser.rb:30:in `reset!'
/Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/bundler/gems/capybara-webkit-2eb38b3c0235/lib/capybara/webkit/driver.rb:145:in `reset!'
/Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/gems/capybara-2.0.1/lib/capybara/session.rb:72:in `reset!'
/Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/gems/capybara-2.0.1/lib/capybara.rb:261:in `block in reset_sessions!'
/Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/gems/capybara-2.0.1/lib/capybara.rb:261:in `each'
/Users/jesse/.rvm/gems/ruby-1.9.3-p327@corengi.com/gems/capybara-2.0.1/lib/capybara.rb:261:in `reset_sessions!'
test/test_helper.rb:76:in `reset_capybara'
Not importing font-awesome fixes the issue (btw - I am using font-awesome via the compass_twitter_bootstrap gem ).
I second @jesseclark 's comment.
Using OS X 10.7.5, Qt 4.8.2, Capybara 1.1.4, capybara-webkit 0.13.0, removing font-awesome fixes the issue.
For another potential workaround, check out the gists at https://github.com/jonleighton/poltergeist/issues/44. I was able to use one like:
if Rails.env.test?
require 'rack/contrib/simple_endpoint'
Rails.application.config.middleware.insert_after Rack::Runtime, Rack::SimpleEndpoint, /\.ttf$/ do |req, res, match|
res.status = '403'
"I will not serve TTF fonts in test mode."
end
end
(after installing the rack-contrib gem)
Could folks give #442 a shot? I've implemented a workaround that resolves these crashes with Font Awesome.
I am also having this issue with fonts from http://fontello.com/. So this seems not a problem of font-awesome. According to http://code.google.com/p/wkhtmltopdf/issues/detail?id=410 and there comment 11 it seems to be related to qt 4.x... I could not get it working with qt 4.8.4 and latest capybara-webkit master... I also found this http://trac.webkit.org/changeset/113968, but cannot say if it will remove the problems with custom fonts. Will we see support for QT5 in the near future?
This is a followup of #68. Also after upgrade of capybara-webkit (0.7.1) and capybara (1.1.1) the specs still fail when running more than one spec with
js: true
.This is the code of the specs: