I just had my capybara updated to 2.0, and all of my save_and_open_page calls return an html page without styling. It has the style sheets links properly at the top of the page. When I revert back to capybara 1.3, the styles work again. Anyone know how to fix this, and/or what the problem is?
thanks, Dave
Update 1.
hack:
I have found a reasonable way to get around the problem following the links recommended by simonmorley: Capybara Webkit problem which points to: capybara-screenshot
It involves using the capybara-screenshot gem to get a screenshot of what the page looks like. When you combine it with the save_and_open_page, which generates the html, you can see what it looks like, and see the HTML.
save_and_open_page
Capybara::Screenshot.screenshot_and_open_image
If I could get Capybara::Screenshot.screenshot_and_save_page
to work, then I think that I might have a solution (if the name implies the action I think it does). However, when I try it, I get cannot load such file -- capybara/util/save_and_open_page
Update 2.
!! wait, the screenshot_and_open_image is not working now (no png image created or displayed). !!
Update 3.
Test App:
I created a test app, and posted it at test_capybara_screenshot on Github.
When I run this test app in development, the page come up with the blaring red background style displayed. When I run the tests, the only thing that works for me is the save_and_open_page, except there is no styling.
Note, when I run any tests, I get the following warning:
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3
Details of the rspec test:
- The save_and_open_page comes up with a boring white background (no styling).
- the screenshot_and_open_image returns with the error:
Rack::Test capybara driver has no ability to output screen shots. Skipping.
Failure in opening /~/Documents/experiments/test_capybara_screenshot/tmp/capybara/screenshot-2012-11-26-07-48-29.png with options {}: No application found to handle '/~/Documents/experiments/test_capybara_screenshot/tmp/capybara/screenshot-2012-11-26-07-48-29.png'
- The screenshot_and_save_page returns:
An error occurred in an after hook
LoadError: cannot load such file -- capybara/util/save_and_open_page occurred at ~/.rvm/gems/ruby-1.9.3-p125@global/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
/assets/blah.css
, and when you save and open the page it opens a raw HTML file from your tmp folder... what CSS files should it be pointing to? – sevenseacat