instance method
take_screenshot
Ruby on Rails 5.2.8.1
Since v5.2.8.1Signature
take_screenshot()
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:
simple(default)-
Only displays the screenshot path. This is the default value.
inline-
Display the screenshot in the terminal using the iTerm image protocol (iterm2.com/documentation-images.html).
artifact-
Display the screenshot in the terminal, using the terminal artifact format (buildkite.github.io/terminal/inline-images/).
Source
# File actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb, line 24
def take_screenshot
save_image
puts display_image
end
Defined in actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb line 24
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper