silvenon.com icon indicating copy to clipboard operation
silvenon.com copied to clipboard

Cypress vs. Playwright: end-to-end testing showdown

Open utterances-bot opened this issue 1 year ago • 6 comments

Cypress vs. Playwright: end-to-end testing showdown

Like Cypress, Playwright is also a framework for end-to-end testing. Find out what are some of the differences and write your first Playwright test!

https://silvenon.com/blog/e2e-testing-with-cypress-vs-playwright

utterances-bot avatar Aug 18 '22 13:08 utterances-bot

I have mixed feelings. I like that Playwright is faster, but I do like that Cypress runs tests in the browser itself, i.e. I can use any JavaScript library to run those tests. In Playwright, you will need to rewrite logic to make it playwright specific – like the example of @testing-library/cypress.

punkpeye avatar Aug 18 '22 13:08 punkpeye

You can make your own custom library that provides helpers like Testing Library does, which uses Playwright under the hood, if you want to. Did I understand correctly?

silvenon avatar Aug 21 '22 14:08 silvenon

You can, just means that you are now building tools specific to Playwright, as opposed to using browser APIs.

punkpeye avatar Aug 21 '22 17:08 punkpeye

You can use browser API by evaluating JavaScript, I think that way you can build @testing-library/playwright just like @testing-library/cypress.

silvenon avatar Aug 21 '22 21:08 silvenon

Safari "This helped me catch a CSS bug that I would otherwise probably never catch."

Just curious what the issue is and how you caught it? Normally we write tests that find and do stuff with dom elements, not CSS. did you test pass in chrome but fails in safari?

bugzpodder avatar Sep 01 '22 07:09 bugzpodder

Something was causing the page to overflow horizontally in Safari, I can't remember what, though. The point is that the overflow test was failing on Safari, that's how I caught the problem.

As you say, usually it's hard to test for CSS problems, but in this case the problem was easy to detect.

silvenon avatar Sep 01 '22 08:09 silvenon