https://cypress.io logo
Network Requests not detected in cypress UI, but s...
# i-need-help
h
Hi everyone, I'm running into an issue in component testing in Angular where the network requests are being sent (XHR) and are displayed in the network tab when I inspect the cypress browser, but they don't display in the left hand column of the cypress UI. This is preventing me from intercepting the xhr requests. Environment: - Cypress 12.7.0 - Google Chrome Browser - Typescript Since its a company project I cant share much of the code here, but I can probably share the component test's cypress code on request. What could be the issue?
w
Hi! What do you see if you open up the “routes” section in the conman log (right under the test name of the failing test in this screenshot)? Possibly just your intercept you that isn’t working? Seeing the code for the test would be useful, sure!
h
Hello, thanks for the response, this is the routes section that im seeing
Here is the cypress component test code that Im currently using.
Also, I've tried to use the "*" url matcher to catch all of the xhr requests but none of them matched
w
I'm not experienced in Angular but I think this comment here might apply: https://github.com/cypress-io/cypress/issues/23479#issuecomment-1224734937 - where Angular is treating the API request as a route change. It also links to our CT example of intercept working normally which could provide a clue as to what's different in your case.
h
Oh thanks! I think adding a dummy url may have solved the issue, although im wondering how this would work in the application end to end outside of cypress. Something for me to look into I guess.
6 Views