Hacker News new | ask | show | jobs
by EddyTests 1053 days ago
3+ testing tools for websites - Selenium, Cypress, and Playwright.

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.

3 comments

I agree with this, after you get past the simple happy path testing, working with Cypress is mostly just wrestling with Cypress and its limitations.

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.

> [Cypress] can't handle multiple domains

It has for well over a year.

https://www.cypress.io/blog/2022/04/25/cypress-9-6-0-easily-...

Not really, it was experimental and only released recently (end of last year?). You can't really build experimental features with potentially breaking changes or even a complete removal into a CI pipeline without a lot of risk.

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.

Hi, I work on Cypress (but not the multi domain feature).

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.

[0] https://docs.cypress.io/guides/references/experiments

Thanks for the info! I’ll check it out :)
I'm with you on this... I'd just assume use simple test/assertion library along with Playwrite/Puppeteer. May even push for straight up Deno as the test base and runtime for that matter.