Playwright VS Cypress – Limitations OR Why Not Use?

One of the most common questions asked on search engines at the moment by people new to automation. What tool.

"What’s the best tool to start with? “-my company uses both?” “What’s better playwright or cypress”.

It could even be that the company use neither but wants to start using only one of them as approved by security for example.

How can we help those people. Step into the mindset of a Quality Coach or experienced senior, or just give your opinion.

4 Likes

Prototype writing a small number of tests using both and then assess, discuss, and make a decision.

5 Likes

Take a moment to read the best practices section of the documentation for each. You will soon notice they have quite different technical, philosophical, opinions.

Cypress:

Playwright:

One big difference, is the recommended locator strategies.

Cypress encourages the use of data-cy test id’s, so make a unique test only id.

Playwright recommends using accessibility based selectors, and finding elements on the page as a user, or screen reader, would interact with them.

This one different is a great example about how as pools they have different intentions.

4 Likes
  • Cypress doesn’t support multi-tabs
  • If you are planning to do API testing, it’s not that big of a deal but Cypress still spins up a browser in order to just to API testing (without any UI tests)
  • Playwright is also backed by Microsoft

But it’s not about “what’s the best tool”, you have to pick the tool that fits your (team-)organization. Playwright might have a higher learning curve for your team.

4 Likes

Good idea, but do keep in mind that your experience can be different when you have a large number of tests.

You then have 1) a lot of test code and a lot of file that you need to keep clean and orderly and 2) a CI pipeline that may take long

1 Like

I wrote an article about this question focusing on clean code, easy debugging, and a short runtime in the CI pipeline - plus some links to resources that turned out useful for me.

1 Like