Issue
I want to check if the text "You must enter a value"(Screenshot attached) is present in the login screen that I have created. This appears when a user touched the input field and then clicked on a different field or area without typing anything. So I tried to test it with cypress, but it says
".type() will not accept an empty string"
Cypress:
it('Should display You must enter a value if user does not type anything', () => {
cy.get('#username').type('')
cy.contains('You must enter a value')
})
I need help in fixing this, thank you.
Solution
Just focus and blur indeed:
it('Should display You must enter a value if user does not type anything', () => {
cy.get('#username')
.focus()
.blur()
cy.contains('You must enter a value')
})
Answered By - Mr. J.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.