exit loop based on if/else condition #15576
-
| How do I successfully run this code block. | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
| Cypress commands are asynchronous, thus the  | 
Beta Was this translation helpful? Give feedback.
Cypress commands are asynchronous, thus the
whileorforloops will always NOT work as you expect them. Instead you need to use recursion. See this recipe https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/testing-dom__page-reloads and implement your logic using https://github.com/bahmutov/cypress-recurse