interactors
interactors copied to clipboard
There is no way to get a value from interactor by using `cy.do`
Intreactors have ability to read values from filters by using read function:
await read(TextField('Username'), 'value')
Or by calling filters
await TextField('Username').value()
But if we try to use it in cypress:
cy
.do(TextField('Username').value())
.then(($value) => { /* $value is undefined */ })
We can't get value back and use it in our assertions.
Couldn't you just do this?
cy
.then(TextField('username').value())
.then(username => { /* ... */})
So there's no reason to use cy.do or cy.expect except to show a nice display name in cypress log? I thought the cy.do should be able to return value
I suppose we could, but isn't the point of do to do something imperative? cy.do(TextField().value()) isn't performing an action, it's reading a value.