Open betawind opened 2 weeks ago
I believe we may be hitting something similar with this, so commenting mainly to follow development, but what we're seeing is an apparent issue where cy.wait(queryAlias.all
) will return the correct number of intercepted requests (4) when we send back a stub in the response (ie: req.reply()
) but will for some reason respond with 6 when we don't send back a stub and allow the request to pass through to the server
attached is the result of calling cy.get('${alias}.all')
Potentially related to the problem, I am seeing redundant id
s with "interceptedRequest562"
and "interceptedRequest597"
showing up twice
Current behavior
I'm using the pattern defined below to intercept and assert on graphql requests and responses: https://docs.cypress.io/app/guides/network-requests#Alias-multiple-queries-or-mutations
The test runs the
cy.intercept
in a beforeEach, and includes a singlealiasQuery
call in the route handler function.The page uses Graphql to populate data in a table, and interacting with the page results in additional requests to Graphql for new data. When using
cy.wait
on a request that occurs after several have already occurred, the resultant request object is for a prior request. I can usecy.wait
multiple times to get each request's details sequentially.Example
getData
Graphql operation calledgqlGetDataQuery
getData
is calledgetData
getData
Desired behavior
cy.wait returns the request/response for the most recent Graphql query
Test code to reproduce
NOTE: The test code uses Cypress Dashboard and it's Graphql endpoint to demonstrate the issue. To run this you'll need to do the following:
REPO WITH THE ISSUE: https://github.com/betawind/cypress-30507
Cypress Version
13.15.1
Node version
v20.17.0
Operating System
macOS 15.1
Debug Logs
No response
Other
No response