Please cypress is giving me undefined error when I want to check that the input is not empty like this:
cy.get('car').find('input').should('not.be.empty');
When I put a value into input like bmw and use a code like this, all is fine
cy.get('car').find('input').should('have.value', 'bmw');
So it finds the input and can read the value, but why the not.be.empty is not working? Is there some workaround to that? I do not want to specific the value of the field, could be random. Thx
I assume you want to check whether your value
is empty or not. You can do something like this:
cy.get('car').find('input').invoke('val').should('not.be.empty')
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