Assert every <img> on the page has an alt attribute.
Empty alt="" is allowed (decorative images per WCAG); role="presentation"
is also allowed. Only a missing alt attribute fails. Iterates every <img>
in the document, including those nested in shadow-light DOM that the page
has rendered, so it works on infinite-scroll lists and image galleries too.
Step pattern
Then every image should have an alt attributeExamples
Example #1
Then every image should have an alt attributeExample #2
And every image should have an alt attributeExample #3
Given I am on "/photos"
Then every image should have an alt attributeExample #4
When I scroll to the bottom
Then every image should have an alt attributeExample #5
When I follow "Gallery"
Then every image should have an alt attribute