Skip to content

Commit

Permalink
Adding HTML form validation to FAQ, closes #1824 (#1919)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpedersen42 authored and jennifer-shehane committed Jul 30, 2019
1 parent b647daf commit 4762fd5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions source/faq/questions/using-cypress-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ describe('The Document Metadata', () => {
})
```

## {% fa fa-angle-right %} Can I check that a form's HTML form validation is shown when an input is invalid?

You certainly can.

```javascript
it('check validation message on invalid input', () => {
cy.get('input:invalid').should('have.length', 0)
cy.get('[type="email"]').type('not_an_email')
cy.get('[type="submit"]').click()
cy.get('input:invalid').should('have.length', 1)
cy.get('[type="email"]').then(($input) => {
expect($input[0].validationMessage).to.eq('I expect an email!')
})
})
```


## {% fa fa-angle-right %} Can I throttle network speeds using Cypress?

You can throttle your network connection by accessing your Developer Tools Network panel. Additionally, you can add your own custom presets by selecting **Custom > Add** from the Network Conditions drawer.
Expand Down

0 comments on commit 4762fd5

Please sign in to comment.