https://cypress.io logo
Test delayed network response
# i-need-help
g
Hi. I'm testing a web app. When one specific HTTP call takes longer than 30s to respond (that means
pending
status) the app is displaying some network error notification. I want to test that: - before 30s a spinner is visible - after 30s a network error notification is visible I've added an intercept for this call and delayed the response for more than 30s and it works, test is passing, but the test takes too much time. So my question is: can I use
cy.clock
and
cy.tick
somehow to control the time on the frontend and make the test to run much faster? 🙏
g
sounds like a good lesson idea for my paid course https://cypress.tips/courses/network-testing