Skip to content

Instantly share code, notes, and snippets.

@jennifer-shehane
Last active June 28, 2019 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jennifer-shehane/3d07be568934b1f8a3af17fe156e0987 to your computer and use it in GitHub Desktop.
Save jennifer-shehane/3d07be568934b1f8a3af17fe156e0987 to your computer and use it in GitHub Desktop.
it('check validation message on invalid input', () => {
cy.visit('index.html')
cy.get('input:invalid').should('have.length', 0)
cy.get('#mail').type('f') // type something invalid into input
cy.get('button').click() // submit the form
cy.get('input:invalid').should('have.length', 1)
cy.get('#mail').then(($input) => {
expect($input[0].validationMessage).to.eq('I expect an email!')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment