by EddyTests · 3y ago · 0 comments
Selenium is a little old and verbose - the biggest issue, imo, is having to handle waiting for elements. Also managing webdrivers suck. Cypress is great for E2E tests but falls apart on edge cases, for example it can't handle multiple domains. Just requiring npm and not needing webdrivers is really nice for CI. Playwright is sort of a combination of both - fixes a lot of issues in Selenium but has the ease of use of Cypress. It is much less documented than Selenium though.
If I was starting a new project I'd use Playwright.
Most of the limitations are around 2 things - Cypress has its own JS runtime separate from the node process which causes weird (non-intuitive) behavior. The other thing is the hand-wavy way Cypress tries to pretend the code is not async. You can’t just write JavaScript and have it work the way you expect, you have to write Cypress-flavored JavaScript, which sets up lots of footguns for junior engineers and causes you to have to be extra vigilant on code reviews.
I have worked heavily with Cypress for years, and if I were starting a new project I would 100% choose Playwright.
It has for well over a year.
https://www.cypress.io/blog/2022/04/25/cypress-9-6-0-easily-...
The main issue with Cypress handling this is, from what I understand, one browser per domain which can cause huge memory usage (which Cypress already has an issue with). Once you try parallelising multi-domain tests you run out of memory on developer laptops pretty quickly :(
But yes ultimately you are right, multi-domain is available, it's just those edge cases that get you once you go beyond simpler cases.
I agree memory usage is an issue, I sure hope we can fix that. It's a hard problem with the frontend execution heavy model Cypress uses, along with the DOM snapshots consuming a ton of memory.
There is a `experimentalMemoryManagement` feature that might be of interest to you [0]. The reason this one is experimental is the implications are not fully understood yet, and as a mature software product, we can't just throw out a big feature and "see what happens", so to speak.
I understand not wanting to use experimental features, but this might be useful to your existing Cypress projects, even if you aren't using it for your new projects anymore.