I have the following sample script to experiment exception handling in Cypress. But the exception is not being caught. What am I missing here?
Cypress.on('uncaught:exception', (err, runnable) => {
Cypress.log("this is top-level exception hadling")
return false
})
context('Actions', () => {
it('sample_testing', () => {
cy.on('uncaught:exception', (err, runnable) => {
cy.log("this is test-level exception hadling")
return false
})
cy.get("#notfound", {timeout:1000})
})
})
Please note that there is no element with id notfound in my web page.