When I save screenshot

Saves a screenshot of the page at the current viewport size, as an action step in the middle of a scenario. Two files are written to the screenshot directory (default ./screenshots, configurable via WEBSHIP_SCREENSHOT_DIR or the screenshot.dir world parameter): a PNG image of the visible viewport and a matching .html snapshot of the page source. Filenames follow the configured pattern, which defaults to a timestamp plus the feature file name and step line.

Only the visible viewport is captured. To capture the entire scrollable page, use the fullscreen variant instead, or set WEBSHIP_SCREENSHOT_FULLSCREEN=true to make every capture full-page. Note that webship-js also captures a screenshot automatically when a step fails, so you only need this step for deliberate captures of passing states.

Accepted phrasings

When I save screenshot
When we save screenshot
When save screenshot
Then I save screenshot
And I save screenshot

Examples

When I save screenshot
When we save screenshot
When save screenshot
And I save screenshot

In a real scenario

Scenario: Capture the contact form after it has been filled in
  Given I am on "/contact"
   When I fill in "email" with "user@example.org"
    And I fill in "message" with "Requesting a product demo"
    And I save screenshot
   When I press "Send"
   Then I should see "Thank you for contacting us"

Related steps

Back to Screenshot Steps