Intercepting HTTP requests
As mentioned in previous sections, Cypress is designed as a JavaScript E2E testing solution. This means that it comes with built-ins such as assertions, automatic wait/retries, sane defaults for running the application, and extensive mocking functionality.
HTTP requests can be slow and tend to introduce flaky behavior into tests. What’s meant by flaky is intermittent false negatives – that is, failures that are not caused by an application issue but rather by connectivity issues (for example, between the server running the tests and the backend hosts).
We would also be testing the implementation of the backend system. When using Continuous Integration (CI), this would mean having to run the backend systems in whichever CI pipeline step needs to run E2E tests.
Usually, when the backend requests are intercepted and a mock response is sent, we also say that the HTTP requests are stubbed in order to avoid tests flaking (meaning intermittent...