Page MenuHomePhabricator

Use Cypress for Browser tests
Closed, ResolvedPublic

Description

We decided to switch from SauceLabs + Nightwatch to Cypress in (for now) GitHub Actions for Browser testing. (Included in the discussions and approved by @conny-kawohl_WMDE)

The main motivations for this step are:

  • Cypress supports native mocking of requests and we already have a nice PoC that showcases that request mocking
    • Nightwatch would need plugins or a mock-server
  • We may have to move the repository to Gerrit/WMF-Gittiles at some point (T272130#6792307) and it is unclear if it is even possible to keep using SauceLabs with Gerrit
    • at the very least the effort to integrate Cypress into the WMF CI stack will be smaller, there even exists some prior work (T230729)
  • Cypress supports running with multiple browser width and allows for visual regression testing at multiple break-points
    • We are not using this feature yet, but it might be a nice to have in the future
  • Cypress can run in Headless mode, which might make it more suitable for CI
  • This project is a good candidate to test Cypress under real conditions. It should be suitable to give us data about test-flakiness in day-today use.
    • that data can then inform the decision on whether we should migrate more projects to Cypress

The main drawback:

  • Cypress only supports testing on Chrome and Firefox, not Internet Explorer 11 and Safari like SauceLabs/Nightwatch does
    • however, that is in line with our current testing standards for projects hosted on Gerrit/Gittiles which are only tested on Chrome anyway
    • QueryBuilder does not support Internet Explorer 11 at all
    • QB uses browserlist in Babel and PostCSS to ensure compatibility with all required Browsers, so Safari should be fine as well 🤞

Event Timeline

Michael updated the task description. (Show Details)
Michael added a subscriber: conny-kawohl_WMDE.
Addshore subscribed.

it is unclear if it is even possible to keep using SauceLabs with Gerrit

Yes it is possible to use sauce labs from gerrit

it is unclear if it is even possible to keep using SauceLabs with Gerrit

Yes it is possible to use sauce labs from gerrit

While probably not relevant for this ticket for now, but could you share a link that describes how to do that? Or point me to a job/repository that has this implemented?

it is unclear if it is even possible to keep using SauceLabs with Gerrit

Yes it is possible to use sauce labs from gerrit

While probably not relevant for this ticket for now, but could you share a link that describes how to do that? Or point me to a job/repository that has this implemented?

A vaugly similar job (that includes secrets) would be the browser test jobs that already run against beta and or test in an authenticated fashion.
As far as I can tell that is the only thing needed in the case of pointing browser tests to saucelabs for example? some sort of auth?
Everything else is just the same as locally, install the dependencies, run the code / command.

As far as I can tell that is the only thing needed in the case of pointing browser tests to saucelabs for example? some sort of auth?

No, the other way around. We are not pointing the browser tests to Saucelabs. Saucelabs is running the browsertests and needs, besides the test instructions, to be pointed to some reachable server hosting the current commit.

But yes, on some level this works via some API and so it should be doable via Gerrit/Jenkins. Probably we also would need to keep the Netlify deploy?

amy_rc claimed this task.