Then the "Username" field should have the error "Username already exists."

A field of the page shows the server's error under it, or shows none: the field by the label a person reads ("Username", "Email", "Confirm password", "New Password", "One-time code").

Examples

Then the "Username" field should have the error "Username already exists."
Then the "Email" field should have the error "Invalid email address."
Then the "Confirm password" field should have the error "Password confirmation doesn't match."
Then the "Email" field should not have the error "Email already exists."
Then the "First name" field should have the error "Please specify this field."

Pattern

Then(/^the "([^"]*)" field should( not)? have the error "([^"]*)"$/, …)

Part of @webship-js/keycloak-steps (github.com/webship/keycloak-steps), a step pack for Webship-js 2.0.x.