In my Cypress test, I am trying to wait for a GET request & validate it's response. However, the test is timing out as the request never occurs.
Here is the request I am trying to wait for:
Here are some details around the test:
- The URL of the app I am visiting in the test is
https://ts-e2e-challenge.netlify.app/list
. - In my test, an action is performed that sends a GET request to the URL
https://bookshelf.jk/api/list-items
, as you can see in the screenshot.
And here is my test code:
cy.intercept('GET', '/list-items').as('getListItems')
cy.wait('@getListItems').then((interception) => {
});
Full error message:
Timed out retrying after 5000ms: cy.wait() timed out waiting 5000ms for the 1st request to the route: getListItems. No request ever occurred
I assume the URL that I am trying to intercept is incorrect, but I have tried to update it to the full path https://bookshelf.jk/api/list-items
, but the request is still not being made.
Can someone please point out what the request URL should be based on the above screenshot?