Cypress: How to test HTML5 built in validation popup?
Asked Answered
G

1

6

How can we catch an HTML5 built in popup validation error when testing an App with Cypress? It does not seem to be showing up in the DOM so I have no clue about how to catch it with a cy command (I'm using testing-library).

enter image description here

Gunrunning answered 16/4, 2021 at 9:19 Comment(0)
R
5

You can refer the cypress FAQ for this.

cy.get('locator').then(($input) => {
  expect($input[0].validationMessage).to.eq('Your error message')
})
Reef answered 16/4, 2021 at 9:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.