-
Here is a demo of the issue: https://share.getcloudapp.com/JruxdoqQ sample code: test: import { aliasQuery } from '../util/graphql-test-utils' context('Test that a user can get to bookshelf content', () => { utility: // Utility to match GraphQL mutation based on the operation name // Alias query if operationName matches } // Alias mutation if operationName matches |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
hmm I think I solved this, our endpoints do not have an operationName prop all the time so I tried this: Cypress.Commands.add('interceptGQL', (opName, route) => { |
Beta Was this translation helpful? Give feedback.
hmm I think I solved this, our endpoints do not have an operationName prop all the time so I tried this:
Cypress.Commands.add('interceptGQL', (opName, route) => {
cy.intercept('POST',
https://api.adept.at/${route}/graphql
, req => {const { body } = req;
console.log(body.query);
if (body.hasOwnProperty('query') && body.query.includes(opName)) {
req.alias = opName;
}
});
});