Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Apr 6, 2024
1 parent d1c65e0 commit 807b983
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/recipes/yield-value.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ The following code block will cause an error "mixing up async and sync code"
cy.get('#person')
.invoke('text')
.then((text) => {
// INCORRECT: mixing a Cypress command
// and a return value
cy.log('text', text)
cy.wrap(text.split(' ')[1])
return text.split(' ')[1]
})
.should('equal', 'Smith')
```
Expand All @@ -32,6 +34,8 @@ Printing using `cy.log` can unexpectedly cause an error, because you do not assu
cy.get('#person')
.invoke('text')
.then((text) => {
// INCORRECT: mixing a Cypress command
// and a return value
cy.wrap('Anna')
return text.split(' ')[1]
})
Expand Down

0 comments on commit 807b983

Please sign in to comment.