Cypress
What is it
A framework agnostic end-to-end testing framework for the web. There is a dashboard available which provides insights and control of your test flows.
When to use it
Use Cypress to test entire user flows of your application end-to-end. Cypress tests can be complemented with unit tests. It should be integrated with your CI/CD pipeline and test the application in all supported browsers.
How to learn it
Installation and setup instructions can be found here.
Cypress intercept with GraphQL
Traditional Cypress intercepts use the route url and method to to distinguish requests. Because GraphQL requests go towards the same endpoint, the requests must be aliased within single intercept. For more details on how to do it check the official cypress documentation
It's important to note that if a second intercept is made within a test targeting the same endpoint, it will completely overwrite the old intercept and all requests will have to be re-aliased. In the case of wanting to stub a reply, simply do a 'cy.reply' within the intercept condition:
if (req.operationName === "HelloWorld) {
req.alias = operationName
req.reply(400, { error: 'Something went wrong'})
}