Cypress · Middle · Question 11 of 77
Why must cy.intercept be defined before the action that triggers the request?
- 1Cypress rejects intercepts defined after
cy.visit - 2Requests sent before it was registered won't be caught
- 3Intercepts defined later apply only to the next test
Show the answer
Correct answer: Requests sent before it was registered won't be caught
Explanation
Register intercepts first, then visit or click. Otherwise a fast request slips through and cy.wait times out.