Playwright or Cypress for Aurelia 2 and 1?

Our Aurelia 2 and 1’s skeletons shipped with an e2e test option with Cypress.

However, over the years, there are few Cypress related unstable tests that hurt our CI over and over again. Cypress also shipped many major versions with breaking changes over the years, we have been keeping up with them, but certainly don’t enjoy the process. Current Cypress v10 seems introduced some issue in our CI that it’s hard to reproduce in standalone run.

I had a brief play with Playwright. It seems delightful with just one very readable config file to start with. In comparison, Cypress requires quite a few placeholder files to start with.

Playwright also pierces the Shadow DOM by default.

I am seriously considering switching our skeletons to use Playwright.

Appreciate anyone with more experience with Playwright and Cypress to share some thoughts. Thanks!

2 Likes

My vote is always for Playwright. My initial encounter with Cypress was not successful, as it failed to run in a CI environment. There might be some misconfiguration on my part, the point is that Playwright is a breeze in comparison. Moreover, you can your favourite test framework and assertion library in combination. Playwright also offers some of those, but you don’t have to use those infra.

2 Likes

playwright or puppeteer, definitely. the difference is also from an architecture standpoint. while Cypress lives within your page and thus needs to simulate lots of things like iframe/frameset handlers, Pptr/Playwright come via the devtools protocol and offer far more flexibility.

1 Like

I heard playwright is puppeteer only with FF and webkit support (-:

well, FF is kinda supported with Pptr as well. the big difference with Playwright though is that the API is more geared towards testing. convenience methods to wait for presence of elements, filling form fields vs click, type, loose focus.

the baseline is the same though, DevTools protocol.

I’m currently building an automated game tester for a Phaser based game and pptr (as would playwright) are just insanely capable and fast. Screenshots, Har file exports, and code injection just work super smoothly

1 Like

I recommend using playwright, as it also supports firefox and webkit. If you want to write tests that are understandable for non-tech people, you may also want to combine cucumber with playwright, as you can use the gherkin syntax to write the tests.

e.g.

# Describe what this feature tests
Feature: As a developer I want to test the basic functionality of the e2e-presets steps

  # Describe what this scenario tests
  Scenario: It is possible to open a page and press a button with the preconfigured steps
    Given I open the url 'https://keycode.info/'
    When I press the key 'Backspace'
    Then I expect the element '.keycode-display' to appear exactly 1 time

  # Run one scenario with different parameters
  Scenario: Check api's are available as anonymous user
    When I call '<url>' as get, then I expect the http status code to be <statusCode>

    Examples:
    | url                    | statusCode |
    | https://fastforward.ch | 200        |
    | https://google.ch      | 200        |

1 Like

Thanks everyone!
Playwright is overwhelmingly the favourite. I will make the switch.

1 Like

v1 and v2 skeletons are migrated to playwright.
Love playwright’s piercing Shadow DOM.

3 Likes