0

I am trying to test a webapp with cypress for:

  1. Resources that didn't load (e.g. referenced an image that doesn't exist)
  2. Resources that are loaded from external hosts (e.g. CDNs)

For testing both scenarios, I'd need access to the list of resources. On the network tab of Chrome I can easily see both.

enter image description here

How to get the same information within my cypress test case?

gorootde
  • 4,003
  • 4
  • 41
  • 83
  • This could help for checking if a resource has not been called https://stackoverflow.com/questions/47354360/is-there-a-way-to-assert-that-a-route-has-not-been-called-in-cypress. and asserting a network request https://docs.cypress.io/guides/guides/network-requests#Assertions – return Jan 05 '22 at 16:23
  • I already know about the network assertions. However, I'd need to know the routes / resources in advance. But in my scenario I want to be able to check that the website is e.g. not calling _any_ external resource. – gorootde Jan 05 '22 at 16:37
  • Take a look at: https://docs.cypress.io/api/commands/intercept#Intercepted-responses. You could then check the status and origin of all responses. https://docs.cypress.io/api/commands/intercept#cy-intercept-and-request-caching – first last Jan 05 '22 at 18:28

0 Answers0