DEV Community

Raphaël Badia
Raphaël Badia

Posted on

A stupid reason why cy.intercept() doesn't work when you reload Cypress tests

When trying to intercept a search api of my website, a strange bug almost drove me crazy : the first time I ran the test, it worked, but then failed once I tried to reload the test !

It turned out that there was a cache on the api side, so the browser is not doing an actual request once it's cached in the disk :
CleanShot 2021-04-28 at 15.09.54@2x

So from now on, I know that when I want to work with intercepted api responses that are cached, I must tick the "disable cache" checkbox.
CleanShot 2021-04-28 at 15.13.07@2x

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more