I have an text input field that i would like cypress to check if it's empty.
I've tried:
cy.get('[data-cy=inputField]').should('not.have.value');
cy.get('[data-cy=inputField]').should('be.empty');
both tests pass even though even though there is text in the field.
I've found the solution. It works when i expect it to have the value of an empty string.
cy.get('[data-cy=inputField]').should('have.value', '');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With