I'm using rspec features with capybara for testing my rails 3.1 application. Sometimes it's useful to save the static html of a page we're breaking on and have a glance on it. That what the save_and_open_page method is for.
But capybara generates an html file in a directory called tmp/capybara, so if my paths for stylesheets and javascripts look like this:
<script src="/javascripts/application.js?1362462583" type="text/javascript"></script>
they won't be found, because this absolute path assumes we're in a /public directory.
What is the best solution to save a page and open it properly?
Asset pipeline support for save_and_open_page will be available in Capybara v2.1, see https://github.com/jnicklas/capybara/pull/958
In the meantime you have to use the selenium driver and halt the test execution using methods sleep gets or binding.pry so that you can interact with the selenium browser
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With