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
  take_screenshot if failed? && supports_screenshot? && Capybara::Session.instance_created?
end