Assert the first optimized image of the page is (or is not) loaded: the main image is decoded and shown (opacity: 1) and the placeholder has faded out. A lazy image further down the page is not loaded until the visitor scrolls to it, which the negative form proves.
Examples
Then the optimized image should be loaded
And the optimized image should be loaded
But the optimized image should not be loaded
Then optimized image should be loaded
And the optimized image should be loaded
Pattern
Then(/^(?:the )?optimized image should( not)* be loaded$/, …)
Part of @webship-js/gatsby-steps (github.com/webship/gatsby-steps), a step pack for Webship-js 2.0.x.