How to force fail a test in Cypress.io
You can just throw a JavaScript Exception to fail the test: throw new Error(“test fails here”) However, in your situation, I would recommend using the .should(‘not.exist’) assertion instead: cy.contains(“Sorry, something went wrong”).should(‘not.exist’)