Assert an error message is, or is not, visible and, when a text is given, that it contains that text. Core shows one for a failed validation, for rejected credentials and for access notices alike. Found by aria-label="Error message" or a role="alert" element inside the data-drupal-messages region, then the .messages--error class of core's themes, or the "error message" named selector.
Examples
Then I should see an error message
And we should see a validation error
Then should see a form error
And I should see a login error "Unrecognized username or password."
Then we should not see an error message
Pattern
Then(/^(I |we )*should( not)* see an? (?:validation |form |login |sign-?in |authentication )?error(?: message)?(?: "([^"]*)")?$/, …)
Part of @webship-js/drupal-cms-steps (github.com/webship/drupal-cms-steps), a step pack for Webship-js 2.0.x.