Hi there I'm new at cypress so I'm not sure if what I'm trying to write makes any sense. With the below, I would like to remove the cookies notification by clicking on it, but in case the cookies notification is not visible, I would like to skip this step and move to the next one.
//cookies notification close button
it('cookies notification', () => {
const $body = cy.get("body")
if ($body.find('[class="pg-layer cookie pg-layer-open state-app-home"]'))
{
cy.get('[class="fa-fw far fa-times fa-1-5x mxn material-icons"]').click()
}
else {shouldSkip}
})
The above function is not working, could anyone help out please? thanks