ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper (original) (raw)

Screenshot helper for system testing

Methods

T

Instance Public methods

take_failed_screenshot()Link

Takes a screenshot of the current page in the browser if the test failed.

take_failed_screenshot is included inapplication_system_test_case.rb that is generated with the application. To take screenshots when a test fails addtake_failed_screenshot to the teardown block before clearing sessions.

Source:show | on GitHub

def take_failed_screenshot take_screenshot if failed? && supports_screenshot? end

take_screenshot()Link

Takes a screenshot of the current page in the browser.

take_screenshot can be used at any point in your system tests to take a screenshot of the current state. This can be useful for debugging or automating visual testing.

The screenshot will be displayed in your console, if supported.

You can set the RAILS_SYSTEM_TESTING_SCREENSHOT environment variable to control the output. Possible values are:

Source:show | on GitHub

def take_screenshot save_image puts display_image end