module ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper

def take_failed_screenshot

+take_failed_screenshot+ is called during system test teardown.

failed.
Takes a screenshot of the current page in the browser if the test
def take_failed_screenshot
  return unless failed? && supports_screenshot? && Capybara::Session.instance_created?
  take_screenshot
  metadata[:failure_screenshot_path] = relative_image_path if Minitest::Runnable.method_defined?(:metadata)
end