My web page is having one panel and to make visible/disable I have a button. So now my panel is disabled (assume I have clicked to disable) and I should verify if panel selector doesn't exist I should click on button to enable it and if panel selector found I should process further. I have tried few solutions but still can't get complete solution. My code is below,
if(cy.get('.event-master-jumpto').should('not.exist')){
cy.get('#btnIssueEventJumpTo').click()
}
This is working only when element is not exist, if element is exist this causing to fail the test. I also tried using below code,
cy.get('.event-master-jumpto').then(($ele)=>{
if($ele.length < 0){
cy.get('button').click()
}
})
This is working only when element is exist, if not exist test is fails. Can someone advise correct way to solve this?