question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test gets into runaway loop if cy.wrap is inside cy.should

See original GitHub issue

Cypress v6.3.0

it('gets into a loop', () => {
  cy.wrap('bar')
    .should(() => {
      cy.wrap('foo')
    })
})

Runs away, never finishes

https://user-images.githubusercontent.com/2212006/105213850-39648400-5b1d-11eb-92fe-0d04751496e6.mp4

Example in https://github.com/cypress-io/cypress-test-tiny/tree/runaway

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bahmutovcommented, Nov 5, 2021

Just randomly hit this again, ughh, and aside from this I do see runaway tests sometimes, but larger ones, seems there might be edge cases in the internal logic

it('never finishes', () => {
  cy.wrap(1).should(() => cy.log('here'))
})

https://user-images.githubusercontent.com/2212006/140448613-37acd0d6-3106-4977-8559-f9f2dc4ddbe9.mp4

0reactions
bahmutovcommented, Nov 17, 2022

Super

Read more comments on GitHub >

github_iconTop Results From Across the Web

wrap - Cypress Documentation
cy.wrap() , when its argument is a promise, will automatically wait until the promise resolves. If the promise is rejected, cy.wrap() will fail...
Read more >
A Better cy.each Iteration - Gleb Bahmutov
We need a way to avoid queuing unnecessary commands. To do this, we can queue cy. then(callback) inside the each(callback) . Inside the...
Read more >
Where do we use cy.wrap() command in Cypress Test - Medium
I try to find the element of the email input field using the cy.get() command, this cy.get() command will yield us an element....
Read more >
Cypress IO- Writing a For Loop - Stack Overflow
While cy.wrap().each() will work (one of the answers given for this question), I wanted to give an alternate way that worked for me....
Read more >
Wlj - River Thames Conditions - Environment Agency - GOV.UK
Programme 25 minutes workout, Surf and save turtles in costa rica. ... of trying to be perfect, Optative sentences worksheets, Niagara falls skywheel...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found