Cypress e2e testing 404 scenario
Unanswered
Nashville Warbler posted this in #help-forum
Nashville WarblerOP
How is everyone handling testing a notFound scenario with Cypress? My test was failing due to the NEXT_NOT_FOUND exception that Next throws. I ended up using a `cypress.on('uncaught:exception', (e, runnable) => { return false}).... but I feel like there must be a better way. I don't want to ingore ALL uncaught exceptions.
3 Replies
that error is how redirect works with nextjs, so i think you will have to test that it is that error for success on test
[Invoking theredirect()
function throws aNEXT_REDIRECT
error and terminates rendering of the route segment in which it was thrown.](https://nextjs.org/docs/app/api-reference/functions/redirect)
@risky that error is how redirect works with nextjs, so i think you will have to test that it is that error for success on test
Nashville WarblerOP
ok thank you