When I save "width" x "height" screenshot

Resizes the browser viewport to the given width and height (in pixels) and then saves a screenshot of the visible viewport at that size, as an action step within a scenario. A PNG image and a matching .html snapshot of the page source are written to the screenshot directory (default ./screenshots, configurable with WEBSHIP_SCREENSHOT_DIR).

Use this variant when the capture happens mid-flow, for example checking a responsive layout at several sizes in one scenario. Keep in mind the viewport remains at the new size for all following steps, so chain multiple sizes deliberately, from largest to smallest or vice versa. Only the viewport is captured; the fullscreen variant captures the full scrollable page at the given width.

Accepted phrasings

When I save 1440 x 900 screenshot
When we save 1440 x 900 screenshot
When save 1440 x 900 screenshot
Then I save 375 x 667 screenshot
And I save 768 x 1024 screenshot

Examples

When I save 1200 x 800 screenshot
When I save 375 x 667 screenshot
When I save 1366 x 768 screenshot
When I save 414 x 896 screenshot

In a real scenario

Scenario: Compare the news page across common device sizes
  Given I am on "/news"
   When I wait 2 seconds
    And I save 1920 x 1080 screenshot
    And I save 768 x 1024 screenshot
    And I save 375 x 812 screenshot
   Then I should see "Latest news"

Related steps

Back to Screenshot Steps