Cypress · Middle · Question 8 of 77
How do you simulate a slow API in Cypress?
- 1
cy.wait(3000)right before the request is sent out - 2
cy.intercept('/api/*', (req) => req.reply({ delay: 3000 })) - 3Throttle the network card of the CI machine in its BIOS
Show the answer
Correct answer: cy.intercept('/api/*', (req) => req.reply({ delay: 3000 }))
Explanation
Delays let you test loading states and timeouts. throttleKbps simulates slow bandwidth.