[Useful] Mocking 8base with Cypress

Sharing this because it took a while to work through and may be useful.

Cypress is a fantastic tool (generous free tier) for end-to-end testing. Way simpler and less awful than something like Selenium, and they’ve done some hectic work behind the scenes to make a great developer experience (time-travelling snapshots, can take screenshots and record videos, great support for making assertions). Honestly highly recommend.

Best practice seems to be to mock the backend — tests run faster, they’re deterministic, and no risk of messing up the prod DB in the process.

Took a bit of fiddling to get it working correctly with GraphQL but now going smoothly - here’s a link to the discussion on Github that has the code.

3 Likes

@samwoolertonLW thank you! That’s really fantastic tool.