How to intercept multiple events having same URL #23491
akhila2589
started this conversation in
General
Replies: 1 comment 1 reply
-
If it is a graphQL request, you'll have to use a cy.intercept() with a condition on the operationName. cy.intercept('POST', '/v1/graphQL', (req) => {
// check request has property and operation name
const hasOperationName = req.body.hasOwnProperty('operationName') && body.operationName === 'operation-name'
if(hasOperationName) {
// create alias so you can wait on the call
req.alias = 'operation-name-alias'
}
})
// button click
cy.wait('operation-name-alias') Docs has examples. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After a button click multiple xhr requests are happening with same URL. I want to verify whether the payload of one of those requests contains a specific text. How can I do that?
Beta Was this translation helpful? Give feedback.
All reactions