cypress: Timed out retrying after 5000ms: cy.wait() timed out waiting 5000ms for the 1st request to the route:

Current behavior

I’m trying to reproduce the documentation example of intercept and then wait alias of intercept but it’s giving this error

CypressError Timed out retrying after 5000ms: cy.wait() timed out waiting 5000ms for the 1st request to the route: getSettings. No request ever occurred.Learn more

Test code to reproduce

      describe('settings', () => {
        it('should settings ', () => {
         cy.intercept('http://example.com/settings').as('getSettings')
         cy.wait('@getSettings')     
        })
     })

Cypress Version

^9.3.1

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 15
  • Comments: 15 (4 by maintainers)

Most upvoted comments

“Timed out retrying after 5000ms: cy.wait() timed out waiting 5000ms for the 4th request to the route: currentUserRequest. No request ever occurred.” I’m getting this error after I upgraded to Cypress 10 from Cypress 7 and it was working properly before the upgrade. Anyone else experienced this and knows how to fix it?

Closing because of the inactivity.

I have the same problem…

it("Should redirect to '/school-admin' if School Admin is authenticated", () => {
    cy.intercept('POST', `${Cypress.env('API_URL')}/auth/local`).as('login');
    cy.visit('/');
    cy.findByPlaceholderText(/login/i).type('test_admin');
    cy.findByPlaceholderText(/hasło/i).type('*********');
    cy.findByText(/zaloguj/i).click();
    cy.wait('@login').then(() => {
      cy.url().should('include', '/school-admin');
    });
  });

Locally works perfect, but when GH actions starting work - this test it’s failing.

Ran into the same problem. Turns out the default request timeout for the request to leave the browser is 5000ms. As it is stated in the docs:

The duration is configured by the requestTimeout option - which has a default of 5000 ms.

I fixed it by simply overwriting that, example:

cy.intercept('https://httpbin.org/post*').as('fetchData')

cy.wait(20000) // default request Timeout will be overwritten by this value
cy.wait('@fetchData')

This issue should not be closed. Like many of you, I am experiencing this issue after upgrading from Cypress 7 to Cypress 10+ (I’m on 12.11.0). This wasn’t a problem before. I’m not sure if there’s something wrong in my Cypress tests/config or if the newer version of Cypress just has a race-condition type of bug. The most frustrating part is that the errors aren’t reproducible on my local machine --they only happen intermittently on my CI pipeline in GitHub actions 😞.

I’m going to respond to each comment here separately, since I’m not sure you’re all talking about the same thing. 😃

@asmakhalfallah2018 - Your provided test could should fail. You’re registering an intercept, then waiting to see if anything calls it. Nothing ever does. This makes sense, your sample code doesn’t include visiting a page, making a request, or anything like that.

@JakubLog - Something is probably different between your local environment and CI. You could try enabling video recording on your test, or taking some screenshots at various stages, to see if that provides any additional information. https://docs.cypress.io/guides/guides/screenshots-and-videos

@Lux589 - Probably the same thing, something is going on differently locally and in GH actions. Same suggestion as for Jakub - try recording a video of the test running in CI, which will show you the command log and might provide hints as to what’s going on.

I have the same issue on my environment