Something I learnt whilst going through Dan’s PR.
Why Cypress Intercept?
It allows you to stub network requests while cypress testing.
src
Cypress docs explain this so well, including scenarios where you might use this stuff, to really help illustrate how it can be useful. Definitely a worthy read.
-
Cypress Docs:
-
Also a good time to understand the difference between stubbing & mocking:
- Differences between Stubbing and Mocking
- Mocking and Stubbing with Cypress — Beginner to Advanced
- Martin Fowler - Mocks Aren’t Stubs - Pointing out behaviour verification (which is used by mocks) vs state verification (used by stubs). Worth a re-read when I have time :)