i have a issue, i would like to click on a button until it disappears but the number of times may vary so i would like to check the visibility state and while visible = true click button, when visible = false end test but the issue is that i don't know how to loop all of the chain from get element to the end. It clicks the button once and stops due to the break; if i remove the break it does not even click it loops forever, the main issue is that the first time it goes through the chain the value is true but it does not reiterate
cy.get('[idElem]')
.then($isVisible => {
return $isVisible.is(':visible');
})
.then(value => {
while (value === true) {
cy.get('[idElem]').click();
break;
}
});