I been working for quite some time with Selenium and Cypress, and I strongly believe those two frameworks are the leaders of the Web UI testing.

So here is my comparison table for those two.

Cross browser supportChrome, Firefox, Edge, IEChrome, Firefox, Edge
Programming LanguagesJava, C#, JavaScript, PythonJavaScript (TypeScript)
Cross domain origin supportYesNo (Could be painful if you use 3rd party services, ex Stripe payment)
API testing out of the boxNoYes (Cypress can intercept and stub responses, which is quite handy if front-end development ahead of backend)
XPath supportYesYes (but requires extra plugin)
DebuggingYes (but not obvious what went wrong have to setup breakpoints)Yes ( Cypress takes snapshots of each step and keeps it in memory which helps faster identify the problem)
ReportingYes (Supports multiple reporting tools which outputs results in XML, HTML, JSON)Yes (same as Selenium, plus easy integration with Cypress dashboard, which helps to record video of the tests and tracks down flaky tests)
Test RunnerSupports any test runner of your choice, which is very convenient Cypress using their own runner which has limitations like tests tagging
Memory usageHeavy, but never seen Selenium crashes because of the memory problemsSuper heavy and requires optimization, I have seen the situations where Cypress fails after typing long strings (to be fair it can be optimized by minimizing number of tests in memory)
CI/CD integrationYesYes
DocumentationYesYes (Cypress goes far and beyond with their documentation, you can find example for pretty much anything)
LoopsYes in many cases Not really, Cypress using asynchronous JavaScript, which makes it hard working with loops, specially when you need throw simple While loop.
Dynamic Text interactionYes and simple enoughYes, but painful. Again since cypress using asynchronous JavaScript to return value you would need to use either framework defined methods, which not always applicable. Or use Promises which is kinda makes everything a little more complicated

Here is my overall feeling about both of those tools. If I had to pick universal tool which can do almost everything I would go with Selenium. If I want follow the trends and write UI tests faster and less flaky I would go with Cypress. I’m big fan of Cypress and there is a lots of things I really enjoy about it, but it have some cons:

  • Cross-domain testing (in one of my projects I had to drop Cypress, just because it was not supporting payment on Stripe domain)
  • Test runner support, not much to choose from (I really like Python Selenium and how it supports Pytest with all the features Pytest have to offer including tests tagging with markers)
  • Heavy on memory

But with cons you get pros:

  • Cypress intercept allows you to use fixtures and stub the responses
  • Nice and clean UI test runner, saves lots of time to debug tests
  • JavaScript only, it kind of implies that your test framework needs to live within front-end source code which helps get on testing board front-end developers

Each project is different so you have to weigh in and select the right tool for the job. Hope with this blog you will have more insights on which tool to pick.