I have a test case where I am expecting a value to be displayed in the page, but this value is displayed in the page only after multiple page refresh. How can I achieve this. Currently this is what I am doing -
function isDisplayed() {
cy.get(selectors.searchInput)
.type(this.data.email)
.then(() => {
cy.get(selectors.email).then((ele) => {
if (ele.length == 0) {
cy.reload(true)
cy.then(isDisplayed)
}
else if (ele.length == 1) {
cy.log('Inside Else If')
return
}
})
})
}
cy.then(isDisplayed)
but every time it fails as cy.get(selectors.email) as on the first go it is not able to find the element.
Aucun commentaire:
Enregistrer un commentaire