Save a screenshot of the page in tmp/capybara when a cucumber test is failing

closes #7912
This commit is contained in:
flaburgan 2018-10-30 22:47:03 +01:00 committed by Benjamin Neff
parent 65e0f90b86
commit b977e9c39a
No known key found for this signature in database
GPG key ID: 971464C3F1A90194

View file

@ -77,3 +77,8 @@ Before do |scenario|
# Reset overridden settings # Reset overridden settings
AppConfig.reset_dynamic! AppConfig.reset_dynamic!
end end
After do |scenario|
Capybara.save_path = ENV["SCREENSHOT_PATH"]
page.save_screenshot("#{Time.now.utc} #{scenario.name}.png", full: true) if scenario.failed? && ENV["SCREENSHOT_PATH"]
end