-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XHR is not being logged when request is being made using fetchJson, NextJS #8227
Comments
To give more info on what all were tried before raising this issue:
|
Can you provide a smaller reproducible example that we can run? I don't see any reason why this wouldn't log from the screenshot provided. Are the other XHRs logging? Because I don't see any logs in the current screenshot. |
@Naren-Hub your request isn't an xhr, but a fetch. Look at type column in devtools ( + fetchJson is a wrapper over fetch.) @jennifer-shehane are you planing to add something like that ? or are you aware of any solution for that? I looked at cypress proxy, but there is no simple solution to pull request/response logs form there. edit: |
@Naren-Hub please use cy.intercept to spy on @lilaja not sure what you mean by "something like that" Could you open a new proposal with ideas for improving Ajax logging |
@bahmutov i mean log all requests not just |
We are using the NextJS framework in which a request is being made using 'fetchJson'. But, the issue is that the XHR request is not being logged by cypress.
Below is the logs displayed in the 'Network' - the address request is being made and it received 200. The logic in the programming is that when I enter Pincode that matches length 6, the fetchJson method is being called which makes the request.
Below is my test case:
Current behavior:
Currently, as shown in the screenshot above, even the GET requests are getting logged, but the POST request for which I have started my server is not getting logged.
Desired behavior:
The expectation is that I want to see if an API request is being made or not.
Test code to reproduce
The dev code cannot be produced as it is private repo. However, the steps to reproduce are explained above
Versions
Cypress Version - 4.9.0
NextJS version - 9.3
The text was updated successfully, but these errors were encountered: