Mock GraphQL queries with Cypress and TestCafe

Before we proceed further, I have created a sample graphql-mock-example repository loaded with Client app, cypress, and Testcafe examples. You will find heavy references to that repository.

The GraphQL magic

Quick look into our AUT

How to mock with Cypress

npm i -D cypress-graphql-mock@0.3.1
Have a look into these sample tests to understand different mocking capabilities. 

How to mock with TestCafe

npm i -D testcafe-graphql-mock
Have a look into these sample tests to understand different mocking capabilities with testcafe.

Final Words + Try It Yourself

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhinaba Ghosh

Abhinaba Ghosh

Tech Lead Manager @Postman 🚀 | Space Movie Lover 🪐 | Coder 👨‍💻 | Traveller ⛰️