I have an API that returns times in a day and if those times are all taken then it won't return any. I want to move to the next day and try and check for times there but my test gets stuck and will crash.
So if there are no times go to the next day and wait for the response and check again for times. If there are times return we can exit the loop. Anyone see where this is going wrong?
Thanks
cy.get('body').then(($body) => {
while (true) {
if ($body.find('.time').length) {
break
} else {
cy.get('.day').eq(4).click()
cy.wait('@apiCheck2')
cy.wait(500)
}
}
})