Using Cypress for end-to-end testing

I’ve been using Cypress since last year. It’s an end-to-end testing platform, that uses Chrome (and now other browsers) to run its tests, which are developed in nodejs.

What I liked about it:

  • Easy to write test cases using nodejs
  • Single package installation does everything you need
  • You get screenshots and videos when something goes wrong
  • Allows headless run for integrating it into CI/CD printing a nice report
  • It comes with a nice UI to run your tests locally

When I’m developing my projects, I’m always concerned that I may break something while adding a new feature or bug fix (I know how angry customers may get when something breaks). Since I want to push to production as often as I can, and I don’t have a permanent QA team, I write tests in Cypress that allow me to check that at least the main features keep working before any new change is deployed to production. And I even run the same tests in production just to be sure that everything keeps working, without needing to manually go and check things.

Since I also deploy infrastructure as code (using CloudFormation for example), it’s better to make sure with some end-to-end tests that everything keeps working.

Cypress integrates easily with GitLab using its already built docker images. I use image cypress/browsers:node10.2.1-chrome74, which runs as a step in my Gitlab CI flow. Using gitlab’s artifacts, the screenshots and videos can be exported to see that everything looks good.

If you don’t like to manually tests things as I do, want to integrate tests in your CI/CD flow, and do everything as fast and painless as possible, I recommend you to give it a try.

Software developer. I enjoy building stuff.