Cypress Quick Tip: Mock API Failures
This is a real quick one! If you need to test on an API failure, it's super easy to make one with cy.server
and cy.route
like so.
it('Write a test for failed API response!', () => {cy.server()cy.route({method: 'POST',url: '/api/endpoint',status: 500,response: {}});})
There are so many other things you can do but you sure better be testing your failure conditions.