Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no way to get a value from interactor by using cy.do #110

Open
wKich opened this issue Oct 28, 2021 · 3 comments
Open

There is no way to get a value from interactor by using cy.do #110

wKich opened this issue Oct 28, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@wKich
Copy link
Member

wKich commented Oct 28, 2021

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.

@wKich wKich added the bug Something isn't working label Oct 28, 2021
@cowboyd
Copy link
Member

cowboyd commented Nov 3, 2021

Couldn't you just do this?

cy
  .then(TextField('username').value())
  .then(username => { /* ... */})

@wKich
Copy link
Member Author

wKich commented Nov 8, 2021

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

@cowboyd
Copy link
Member

cowboyd commented Nov 15, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants