You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test runs the cy.intercept in a beforeEach, and includes a single aliasQuery 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 use cy.wait multiple times to get each request's details sequentially.
Example
Before the page loads I use cy.intercept to create an alias for the getData Graphql operation called gqlGetDataQuery
Page loads, Graphql operation getData is called
Make a change on the page that triggers a new request to Graphql operation getData
Make another change on the page that triggers a new request to Graphql operation getData
cy.wait('gqlGetDataQuery') results in the data for step 2
another call to cy.wait('gqlGetDataQuery') results in the data for step 3
cy.wait('gqlGetDataQuery') results in the data for step 4###
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:
Log in to Cypress Dashboard
Copy the "cy_dashboard" cookie using developer tools and update the "cyDashboardCookie" variable below
Select a project to run this, copy the projectId from the URL, and update the "projectId" variable below
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 ids 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
The text was updated successfully, but these errors were encountered: