DEV Community

Ben Halpern Subscriber for The DEV Team

Posted on

Cypress vs.....

Hey folks, we're considering adopting Cypress for E2E testing on DEV, but want to get some feedback if anyone wants to propose other tools in this genre.

We currently do some E2E in rspec (Rails), but it's also a component of the app and process which is under-developed.

So feedback is much appreciated, thanks a lot!

Oldest comments (47)

Collapse
 
ccleary00 profile image
Corey Cleary

I'd take a look at TestCafe too. It's similar to Cypress in that it's a non-Selenium based E2E testing tool.

Anecdotally, at my job we initially tried using Cypress but found some limitations that were unfortunately deal-breakers. Cypress seems to have an opinionated view of how you should write your tests. After switching to TestCafe we haven't had any problems.

A downside to Cypress in my opinion is that it seems like it's trying to do too much. In addition to being a full E2E tool, you can write unit/integ tests with it. Which is really nice, but it's hard enough to get that piece of the puzzle right let alone get the E2E piece right too. Mocha and Jest, for example, are solely unit/integ testing tools and both of those tools still have issues...

Collapse
 
nickytonline profile image
Nick Taylor • Edited

It’s true you could write integration and unit tests in Cypress, but you don’t have to. I’ve been pretty happy with Cypress at work and for my own site.

I’m definitely open to hearing about other tools like test cafe.

Some people chimed in a while ago here.

Collapse
 
nickytonline profile image
Nick Taylor

I just read through the Test Cafe docs. Looks solid as well. It'd be good to do a comparison.

Collapse
 
shadowwarior5 profile image
Konstantin Meiklyar • Edited

Just curious, what were the limitations? Was it some functional limitation or more the concept and the way things must be done?

Collapse
 
pavelloz profile image
Paweł Kowalski

I prefer TestCafe.

Here are some of the reasons: dev.to/pavelloz/comment/ggn8

Collapse
 
popescunsergiu profile image
Sergiu Popescu

Why does plain Selenium isn’t suddenly good enough anymore? Remember that it is the most used, support can be found everywhere and I can speak of a lot more reasons why to keep using it.
Neither Cypress, nor TestCafe give me reasons to use them. More that this, both gave me reasons not to. Tests have to be as close as possible to the real life usage of the app. Do cypress or testcafe help you build such tests? Or both help you build fast, green tests?

Collapse
 
aleccool213 profile image
Alec Brunelle

I have used both extensively and the dev experience of Cypress is about one million times better. Very good documentation and modern developer experience where Selenium is the opposite. Most docs for Selenium are in Java and finding the Javascript api's wastes time. I usually had to use Stackoverflow for documentation on Selenium where I always used the official docs for Cypress.

Collapse
 
popescunsergiu profile image
Sergiu Popescu

I think this is exactly what I said, build fast, green tests. Try to do some database manipulation in Cypress before running your tests. I found it difficult comparing with nodejs. What happens if you need extensive grouping and need multiple layers of test hooks? Support here is not that great. Try to explain to stakeholders the test coverage, maybe linking the 'it' or the 'describe' functions to requirements as it seems that more often they are written in Gherkin.
Don't get me wrong, Cypress is wonderful for max 6 months projects but if you want to go enterprise and need environment matrix support the I don't see Cypress as a good choice.
I always encourage the use of the right tool for the right job and sometimes Cypress is good, other times Selenium, or paid tools, most of them build upon Selenium.

Have anyone wonder why most of the great paid testing tools are built on Selenium. I don't think it is because Selenium is not good.

Collapse
 
ecyrbe profile image
ecyrbe • Edited

Here at work we tried cypress... and after running into it's limitations, we switched to testcafe.
Testcafe is browser agnostic (works on all of them even esoteric ones thanks to it's proxy impl).
Cypress is overrated

Collapse
 
leob profile image
leob

What are the limitations of Cypress, apart from it not being cross-browser? I'm asking because I've used TestCafe for a bit, but I'm curious about Cypress ...

Collapse
 
sesamechicken profile image
sesamechicken

Speaking from my experience when creating a POC, we couldn't use it because

  • it's Chrome/Electron only
  • each test is bound to a single origin
  • no support for multiple tabs

I will say, it was easy to use, write tests, and it was awesome to see its output. It really would've made developers hate functional tests a lot less. ymmv

Thread Thread
 
leob profile image
leob • Edited

Right ... point 1 (Chrome only) is a known issue, if you need cross browser testing then it's a no-go. Point 2 and 3 are indeed documented in their official docs:

docs.cypress.io/guides/references/...

I guess there's a large number of projects where these limitations are not a showstopper, but if you do need these particular features, well yes then Cypress is indeed not an option.

TestCafe with its "proxy" architecture is probably just a bit more flexible, OTOH for a very large percentage of projects you may not need that flexibility ... ymmv indeed.

Collapse
 
mintzworld profile image
Michael Mintz

If there are Python developers on your team, you may want to check out SeleniumBase: github.com/seleniumbase/SeleniumBase
It’s a framework that combines pytest and Selenium in a simplified, but very powerful way. Like some other frameworks, it has smart waiting built-in, which means the framework will wait for page elements to fully load and be interactive before performing Selenium actions on them. Includes a lot of useful built-in methods such as assert_no_404_errors() and assert_no_js_errors(). Lots of examples from the GitHub page. Multiple browsers are supported. Proxy servers are supported. Easily connect to a Selenium Grid. Includes JavaScript injectors for building on top of websites. Screenshots, test reports, ad-blocking, visual testing, and more.

Collapse
 
anwar_nairi profile image
Anwar • Edited

Tried Jest for my SPA, had an hard time with the puppeteer plug-in... Dunno how this could be relevant in your e2e test tool choice 🤔

Collapse
 
sduduzog profile image
Sdu

TestCafe runs as a node tool, which allows me to create helpers that can prepare and cleanup test data from the database as almost how a backend server would. Cypress is loaded and runs on a browser so to do the same you either add endpoints to your api just for testing or spawn up a separate testing server.

Collapse
 
dasdaniel profile image
Daniel P 🇨🇦

Cypress is a superb choice if you're only testing using Chrome. The ability to step through your test makes writing tests easier.

If you want to test with other browsers, like IE, Edge, Firefox, Safari, and any mobile browsers, TestCafe is a way better choice (given that it is browser agnostic). They also offer the studio ($), so you can create the tests without writing it.

In short, I'd say overall the cypress experience is better, but the usefulness of TestCafe is broader.

Collapse
 
leob profile image
leob • Edited

Debuggability (as in, the ability to step through a test script using the debugger) was harder in TestCafe than I'd hoped (I think mainly due to "async"), would it be easier in Cypress? That would definitely be a big "plus" ...

Collapse
 
dasdaniel profile image
Daniel P 🇨🇦

Have a look their Toggling + Debugging video

youtu.be/ofrGbDUuEcQ?t=260

You can see that when the assertion fails, it gives you an interface to see the current state of the testing script. Hovering over the failed assertion shows where the failure happened.

In TestCafe, you can use --debug-on-fail flag or debugOnFail:true in config during test creation/debug. This will prevent the test from ending on error and is quite helpful, but the ability for cypress to step through the test after the failure makes debugging test easier.

Collapse
 
xvier profile image
Xavier

A colleague of my wrote 2 blogs comparing Cypress and Testcafe.

Atm I used Cypress at multiple clients and for our use cases it worked. But I can understand that the limitations of 1 browser and no cloud testing can be a big limitation for people to start using Cypress.

Here is the first part of the blog:

xebia.com/blog/cypress-and-testcaf...

Collapse
 
razgandeanu profile image
Klaus

I can get you a free PRO Plan subscription for Endtest.
You'll get everything you need, including a cross-browser cloud infrastructure to run your tests on.

Collapse
 
verycoolgreg profile image
Greg Goldshteyn

Hello Klaus, I am a QA Manager at Fox Studios and was looking at the Endtest tool as an option.
How do I get the free Pro account?
Regards

Greg

Some comments may only be visible to logged-in visitors. Sign in to view all comments.