I am doing e2e testing with Cypress version 10.9.0
and using
CodePudding user response:
You must escape the /
character in your step file like so \/
.
That also means using a regular expression rather than a string, like this:
/an error message is displayed with the text Invalid username\/password/
Given('I am at the portal login page', () => {
})
When('I enter an invalid username on the login page', () => {
})
Then(/an error message is displayed with the text Invalid username\/password/, () => {
// matches you feature description
})
CodePudding user response:
I'm not sure if that's the problem but this line looks problematic
cy.get('#username').type('portal').invoke('removeAttr', 'value')
.click({ force: true }, { timeout: 30000 })
You should change it to this:
cy.get('#username').type('portal').invoke('removeAttr', 'value')
.click({ force: true, timeout: 30000 })