Why we chose Cypress over other end-to-end testing tools
This post is part of a (just started) series of articles covering the journey of developing EFI4 Digital Banking Platform, our bank in the box. Drop me a line to efi4@efigence.com to schedule a live demo.
An IT product in the type of our “bank in the box” EFI4 Digital Banking Platform needs end-to-end testing for obvious reasons — we want to check real life scenarios that our final users would encounter when actually working with the platform and make sure that systems meets all the crucial use cases. I don’t think I need to be persuading anyone why you would want your E2E test to be automated. In large complex systems it’s simply a necessity.
“Selenium” is an obvious choice, right?
So, when we faced the choice of an end-to-end automated testing framework a while ago, our 1st thought — which should not be surprising for anyone interested in the topic — was to employ a Selenium-based solution. After a short hesitation between Nightwatch.js and Protractor we went with the latter.
But, that’s where “Selenium based” part comes into question. The installation and configuration of Selenium is a hassle. You need to use binary files for it, different for your computer and different for the servers. Then, you need to take care of drivers and dependencies and configure stuff. This all takes time, produces multiple obstacles in the process and unnecessary engages your sysadmins.
Eventually after getting some serious headache we’ve made Protractor up and running on the local machines, but the server configuration was a constant pain in the neck. We decided to abandon Selenium and look for an alternative. Bartek, one of our colleagues heard some good things about Cypress.io and so we gave it a shot.
Love from the first sight
And a great shot it was. First contact with Cypress.io is a bliss. You can simply install it through node/npm like any other dependency and you don’t need any drivers. The process looks identically on local machines and servers. Assuming you have node.js on your machines beforehand (I guess if you’re reading this, you probably do) it takes literally 10 minutes and Cypress is running.
We were even more pleased with the fact that later it actually gets better when you start using it. Cypress really does work out of the box. It’s very easy to use and writing tests for it is very fast. Whereas Selenium is more targeted to testers — I guess — and requires their attention, Cypress can be operated 100% by developers. Also it’s much more consistent. In our experience Selenium-based E2E tools are somewhat erratic and tests get broken every now and then without apparent reason.
Cypress vs. Selenium — differences in working
The whole approach also differs a bit. In our case, for the better. Selenium WebDriver runs remotely outside the browser and executes commands into it. Cypress on the other hand runs entirely inside the browser and is executed in the same run loop as your application. It gives you native access to every single Dom element. And for the tasks happening outside the browser it utilizes Node.js server.
So, unless you need to run your tests against various browsers (which Selenium will do for you), Cypress wins here hands down both in terms of accuracy and speed — especially if you run a Single Page Application as we do.
The post-test analysis is one of the biggest advantages of Cypress. It provides you with screenshots and videos of your failed test, lets you debug directly in Chrome DevTools and provides step by step snapshots resulting in a feature they call Time Travel, which certainly feels like one.
Finally, their documentation is a fairly good one, accompanied by a useful best practices guide. You can also go premium with paid support plan (which we didn’t so far and don’t feel like we need to).
Having said all that, we chose Cypress simply because it works best for our team. Obviously it doesn’t need to be the best solution for everyone else. But for us it quickly became the unbeatable part of EFI4 Digital Banking Platform’s stack. Try it.