Hacker News new | ask | show | jobs
by tmd83 1321 days ago
Can someone provide an in depth comparison between Cypress and Playwright? It seems that both of them could be good choice compared to Selenium.

For example I keep seeing auto-wait being talked about for Playwright but doesn't cypress have that too? It seems playwright has better browser support and multi-window/concurrency story and cypress have better built-in tools (like a test-runner UI).

Basically looking for recommendation for test-automation for an old complex app mostly written using server-side tech but has potential for react and such moving forward.

2 comments

Playwright supports webkit by default, even in your linux CI.

Playwright is faster.

It's fully free and OS.

It's written by Microsoft to test their own thousands of services not to sell you anything like Cypress.

The authors of Playwright are the leads from Puppeteeer, Lighthouse, the first node debugger and Chrome Dev Tools, the engineering team has simply no comparisons in the browser automation field.

I haven't used Playwright, but I can tell just by reading about it that the code has more boilerplate and doesn't read as nicely. Example of a Cypress test (pardon the freehand typing here):

  describe(('the google home page') => {
    it(('allows you to search for banana pictures') => {
      cy.visit('https://google.com')
      cy.get('[aria-label="Search"]').type('banana{enter}')
      cy.contains('Images').click()
      cy.get('[alt="Image result for banana"]').should('be.visible')
    })
  })
Nothing too weird, and a lot of the library functions you'd need are available globally without any importing. It even has jQuery and Lodash.