method

take_screenshot

Importance_2
v6.1.7.7 - Show latest stable - 0 notes - Class: ScreenshotHelper
take_screenshot() public

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. You can take multiple screenshots per test to investigate changes at different points during your test. These will be named with a sequential prefix (or ‘failed’ for failing tests)

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

You can set the RAILS_SYSTEM_TESTING_SCREENSHOT_HTML environment variable to save the HTML from the page that is being screenhoted so you can investigate the elements on the page at the time of the screenshot

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-to-html/inline-images/).

Show source
Register or log in to add new notes.