mardi 17 septembre 2019

Cypress - fake internet failure

I'm writing my code with Cypress and want to test a case where internet failure or server doesn't return any response. I'm looking around Cypress docs but found nothing that can help. The closest thing that I can find is

cy.route({
    method: 'POST',
    url: 'my_url',
    response: {},
})
.as('validate');

The problem is that I can't replace the response with undefined, cause cypress doesn't allow it. And if I remove it, Cypress will stop mocking my API. Any helps?

Aucun commentaire:

Enregistrer un commentaire