question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update Cypress to latest version (10)

See original GitHub issue

This is a follow-on Cypress enhancement request from the closed issue “Cypress migration to 10.2?” https://github.com/corona-warn-app/cwa-website/issues/2980.

In the meantime the npm package Cypress 10.11 has been released. No further releases of the Cypress 9.x series are expected.

Issue

cwa-website is currently configured to use Cypress version 9.7.0 This version does not support the Apple M1 ARM architecture natively and requires Rosetta to run. (See blog Running Cypress on the Apple M1 ARM Architecture using Rosetta 2).

Cypress 10.2.0 introduces M1 support and alleviates this issue for this version and later versions. See blog Cypress 10.2.0: Run tests up to 2x faster on Apple silicon (M1)

Suggested change

Update cwa-website to the latest version of Cypress, which is currently 10.11.0.

See Cypress Changelog.

Impact

Cypress 10 introduces breaking changes due to the new functionality of component testing which is added alongside the existing end-to-end testing (e2e). For instance, new folders are introduced, so that the existing cypress/integration folder is migrated to cypress/e2e. Also test specs are renamed: app_to_web.js becomes app_to_web.cy.js. See the Cypress Migration Guide for more detail.

In Cypress 10 the “Run all specs” is no longer available in the UI. Only individual tests can be run from the UI. To run all tests the CLI needs to be used. See Discussion: ‘Run all specs’ removal in Cypress 10.

Migration Steps

Close or merge any existing PRs relating to Cypress tests otherwise these PRs will become stranded and will not work as intended if merged without modification after the Cypress version is migrated.

Install Cypress 10

  1. npm install -D cypress@latest (installs cypress@10.11.0 - see Changelog)
  2. npx cypress open
  3. Click “Continue to Cypress 10”

Migration tool

In the migration tool which automatically starts in the Cypress UI:

  1. Click “Rename these specs for me”
  2. Click “Rename the support file for me”
  3. Click “Migrate the configuration for me”
  • “E2E Testing” is now marked as “Configured”
  • “Component Testing” is left as “Not Configured”
  1. Close Cypress test runner window

Post installation

  1. Edit .github/workflows/cypress-test-prod.yml
  2. Modify the cypress:open script in package.json to use e2e and browser Chrome i.e. "cypress:open": "cypress open --e2e --browser chrome"
  3. Update README.md regarding change of folder and removal of “all tests” option in open command.

Verification

Execute the following and check that all tests pass:

npm run test:chrome
npm run test:firefox
npm run test
npx cypress run -s 'cypress/e2e/*.js' -c baseUrl=https://coronawarn.app --headless --browser chrome

Execute npm run test:open and check that the list of e2e test specs is shown immediately and the default browser is Chrome. Select and run one of the tests listed, such as mime.cy.js.

Test on:

  • Windows 11
  • Ubuntu 20.04
  • macOS

Test the workflow .github/workflows/cypress-test-prod.yml and ensure that it passes.



Internal Tracking ID: EXPOSUREAPP-14080

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:30 (30 by maintainers)

github_iconTop GitHub Comments

2reactions
Ein-Timcommented, Oct 28, 2022

@MikeMcC399

I re-checked just now, everything works on my environment.

1reaction
MikeMcC399commented, Nov 9, 2022

“In case you use a Mac computer with Apple Silicon, make sure that Rosetta is installed.”

macOs users with M1 ARM hardware should be able to use:

npm test

to build and test the cwa-website now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Update Cypress Version - ProgramsBuzz
Step 1: Open Cypress Application using any of below command ; (10.8.0) is available and current version 8.4.1 and also the link for...
Read more >
Upgrade Cypress to Version 10 - Medium
Even though version 10 is a major version upgrade for cypress, turns out it's very simple and straightforward to do. You can read...
Read more >
Migration Guide | Cypress Documentation
This guide details the changes and how to change your code to migrate to Cypress version 11.0. See the full changelog for version...
Read more >
Cypress 10 Upgrade - TestersDock
Note: In case after following all the steps under Step 10, if you are still getting errors, then update the Node JS to...
Read more >
Upgrade Cypress to latest version not working without force ...
npx cypress install --force Cypress 7.2.0 is installed in C:\Users\<UN>\AppData\Local\ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found