I have an input that renders some value. I need to check if the value exists, in other words, at least there should be one characters/ letters in the input field.
I have a test like this in Cypress
cy.get('input').should('be.visible').and(($input) => {
expect($input).to.have.value('')
})
which doesn't work since this test checks if the value is exactly ''
. what I want is that the value should be at least of length 1/ non-empty. Is there a way to do it?
You can do this by matching the value against a regex. You can get more info from the cypress docs.