|
|
|
Ask HN: What are some good arguments in favor of Cypress over Playwright?
|
|
3 points
by _ot2g
1400 days ago
|
|
I have seen a flood of articles recently about the benefits of Playwright over Cypress. They make good arguments, mainly around Playwright using async/await over cy chaining and Playwright being more powerful (multiple tab support is often mentioned). What are some good reasons to use Cypress over Playwright in a new project? or is it game over for Cypress? |
|
The main reason there are lots of articles about Playwright is it's newer and solves some issues people have with E2E testing in Cypress (like multi-tab support) and is more idiomatic JS (using async/await instead of how Cypress does it, which is waiting for each `cy` command to finish before running the next one (it queues them up and runs each one sequentially, so await/async isn't required)).
Cypress has also invested heavily in the developer experience; it has a UI that shows all the commands that executed, and lets you do "time travel" debugging, where you can go back and see the state of the test/DOM after each Cypress command ran. From what I can tell, Playwright is more focused being a solid, cross browser automation tool first. I'm not aware of any kind of interface that exists that is similar to Cypress (I haven't kept up; it's possible something similar exists).
As far as the tools go, Cypress has a lot of opinions and recommendations about how best to use the tool; Playwright seems less opinionated. Some people like tools that come with a lot of guide rails; other people prefer to take a tool and use it how they want.
Another thing to consider is target user; a lot of JS engineers who understand async/await well will have no problem with Playwright; some QA engineers I've worked with who don't come from a JS background found the Cypress API more intuitive.
To answer your original question "What are some good reasons to use Cypress over Playwright in a new project" - I think if you value the Cypress interact runner with the snapshots and command log, or if you value the style of test that the Cypress API encourages (take a look at API) it's a good choice. If you prefer a less opinionated tool, or you value certain features Cypress doesn't have (multi-tab, etc) Playwright might be a better fit.