jeudi 23 avril 2020

How to remove all cy.route from beforeEach in Cypress

I'm creating a lot of tests for application in my firm. Before each test I need to create a state to work on it, and it's always the same, so I created some routes in my own method and then in support/index.js file I created beforeEach that looks like this

beforeEach(() => {
    cy.server();
    cy.mockSearches(SHORTEN_SEARCHES); // this only creates mocks
    cy.loginAdmin();
});

And in 99% percent of tests it's working fine, but there is one test, that needs to work on real data. What should I do? Is there a way to ignore global beforeEach? I guess I can move this part of code to each test before each, but that's code repetition? Or maybe I should override this cy.route with empty responses?

Aucun commentaire:

Enregistrer un commentaire