From b977e9c39af1dc65c6d84382dd5812a8f0649cc9 Mon Sep 17 00:00:00 2001 From: flaburgan Date: Tue, 30 Oct 2018 22:47:03 +0100 Subject: [PATCH] Save a screenshot of the page in tmp/capybara when a cucumber test is failing closes #7912 --- features/support/env.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/features/support/env.rb b/features/support/env.rb index 631a207ac..aa4efa134 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -77,3 +77,8 @@ Before do |scenario| # Reset overridden settings AppConfig.reset_dynamic! 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