what is expected from the below code is get_plz_ChooseGroup
will be skipped and not trigger a test failure if the element is not visible after 5000 seconds
Login_Page_POS.get_plz_ChooseGroup({ timeout: 5000 })
.then(($element) => {
if ($element.is(":visible")) {
Login_Page_POS.chooseGroup(groupName)
} else {
cy.log("Element not visible after 5 seconds, skipping this part")
}
})
.catch(() => {
cy.log("Element not found after 5 seconds, skipping this part")
})
and :
this.plz_group_Label = "//span[contains(text(),'Please choose your group')]"
get_plz_ChooseGroup() {
return cy.xpath(this.plz_group_Label)
}
fails at .catch(() => {:
_Login_Page_POS.default.get_plz_ChooseGroup(...).then(...).catch is not a function