module ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper

def take_failed_screenshot

sessions.
fails add +take_failed_screenshot+ to the teardown block before clearing
that is generated with the application. To take screenshots when a test
+take_failed_screenshot+ is included in application_system_test_case.rb

failed.
Takes a screenshot of the current page in the browser if the test
def take_failed_screenshot
  take_screenshot if failed? && supports_screenshot?
end