Created
August 7, 2016 20:44
-
-
Save kovalevsky/2d055726fa617c9c33f2a7c339dfce70 to your computer and use it in GitHub Desktop.
Make a screenshots and page dumps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.after(:each, js: true) do |example| | |
begin | |
result_filebase = Rails.root.join('tmp', 'screenshots', "#{DateTime.now.to_i}_#{example.description.gsub(%r{[\x00\/\\:\*\?\"<>\|\s]}, '_')}") | |
Capybara.page.save_page("#{result_filebase}.html") | |
Capybara.page.save_screenshot("#{result_filebase}.png", full: true) | |
rescue | |
puts 'Capybara driver doesn\'t support screenshot feature' | |
end if example.exception | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment