Taking screenshots during tests with Poltergeist
This recipe illustrates how to take screenshots from Capybara using Poltergeist, and it points out a couple of things that differ from taking screenshots under PhantomJS.
Getting ready
To run this recipe, we will need the following items installed and available on the system:
Ruby 1.9.3 or greater, and the RubyGems package management framework
Capybara
Poltergeist
A suite of functional tests or browser automation scripts set to run in Capybara
Note
Details on how to locate and install the preceding software are discussed in the Adding Poltergeist to a Capybara suite recipe earlier in this chapter.
The script we will use in this chapter is available in the downloadable code repository as recipe04.rb
under chapter05
. If we run the provided example, we must change to the root directory for the book's sample code.
Lastly, the functional test in this recipe runs against the demo site that is included with the cookbook's sample code repository. To run that...