Hacker News new | past | comments | ask | show | jobs | submit login

Don’t use cypress.

I can’t be clearer than that.

It’s got a lot of frustrating edge cases and problems that mean your tests will always be brittle and break. A short list of the issues I’ve personally found is:

- they invented their own non compliant promises spec that means you can’t use async functions or methods.

- the 1st party xpath plug-in is not fully implemented and fails to have a sub selector (get xpath in this element).

- the runner doesn’t support individual tests in the ui, only test groups

- the plug-in ecosystem is weak, and many plugins only work with “happy path” scenarios, meaning you have to fork them to fix bugs

- you can’t catch a failed promise and try something else (see stupid promises implementation) meaning it’s always a hack to have a fallback test

- I can’t even begin to describe how frustrating the ‘.wrap()’ api is. The people who wrote this used jquery as their programming model, and it shows. Every object gets a magical wrapper to use the magical cypress functions, but promises sometimes return objects not wrapped objects. Your code starts looking very familiar if you alias “cy.wrap” to “$”.

It’s pretty, it’s smooth for trivial tests. …but do you need trivial tests?

Probably, you don’t need trivial tests. For trivial things, you can use unit tests.

Cypress makes it easier to throw away your tests and write them again than it does to maintain the ones you have.




I came here to say that, too! Thanks.

(Prefer other types of tests whenever possible, but if you really do need drive-the-entire-browser E2E tests, use Playwright[1]. It's years ahead of Cypress.)

[1]: https://playwright.dev


Just tried this out. The user experience is really incredible. So much better than Puppeteer (not sure if it's really a valid comparison, though).


Do you have a recommendation for a better alternative?


In this thread, others seem to strongly suggest Playwright as an alternative.


> invented their own non compliant promises spec > that means you can’t use async functions

what does one thing has to do with the other, please elaborate

> the 1st party xpath... > runner doesn’t support individual tests...

seem minor

> sometimes return objects not wrapped objects

sounds like lodash chaining, which is fine once you understand the library

> the plug-in ecosystem is weak

big deal? I use a tool like cypress for itself, not plugins, whatever they do

I get it, the tool isn't perfect and has things you don't like, but I don't see how this warrants a "do not use", seems pretty disproportionate




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: