We have a few tests where we have to wait for a different page to load in order to check some elements on it. So when we visit the first page it redirects to another one. I've tried using cy.route() but with no success. I keep getting the error: CypressError: Timed out retrying: cy.wait() timed out waiting 5000ms for the 1st request to the route: 'getSecondPage'. No request ever occurred. The only way it currently functions is if we use cy.wait(3000) which is not the recommended way. Sample code below:
cy.visit(firstPage);
cy.server()
cy.route({
url: '**/secondPage/**',
method: 'GET'
})
.as('secondPage');
cy.wait(@secondPage)
I've researched a bit and it seems a lot of people are getting the same error. Is there any solution to this or an alternative?