Assert the first optimized image of the page does (or does not) offer an image format: gatsby-plugin-image lists one <source type="image/..."> per format in the formats option (avif, webp; auto is the main image).
Examples
Then the optimized image should offer the "avif" format
And the optimized image should offer the "webp" format
But the optimized image should not offer the "jpeg" format
Then optimized image should offer the "webp" format
And the optimized image should offer the "avif" format
Pattern
Then(/^(?:the )?optimized image should( not)* offer the "([^"]*)?" format$/, …)
Part of @webship-js/gatsby-steps (github.com/webship/gatsby-steps), a step pack for Webship-js 2.0.x.