corona-warn-app / cwa-website

Corona-Warn-App website. The CWA development ended on May 31, 2023. You still can warn other users until April 30, 2023. More information:
https://coronawarn.app/en/faq/#ramp_down
Apache License 2.0
522 stars 225 forks source link

Add short Cypress test script npm run test:short #3309

Closed MikeMcC399 closed 1 year ago

MikeMcC399 commented 1 year ago

This PR implements one suggestion from https://github.com/corona-warn-app/cwa-website/issues/3308 "Improve testing for PR submission".

It provides a new script which can be run with:

npm run test:short

This runs all Cypress tests except cypress/e2e/hybrid/check_links.cy.js.

Verification

Execute

npm run test:short

and confirm that there are no errors reported.


Internal Tracking ID: EXPOSUREAPP-14530

MikeMcC399 commented 1 year ago

Unfortunately there is a problem with the syntax running on Ubuntu. It runs, but gives a warning:

⚠ Warning: It looks like you're passing --spec a space-separated list of arguments:

"cypress/e2e/app_to_web.cy.js cypress/e2e/applink.cy.js cypress/e2e/blog.cy.js cypress/e2e/check_anchor_links.cy.js cypress/e2e/check_videos.cy.js cypress/e2e/eventRegistration.cy.js cypress/e2e/faq.cy.js cypress/e2e/faq_link_attr.cy.js cypress/e2e/hotline.cy.js cypress/e2e/mime.cy.js"

This will work, but it's not recommended.

If you are trying to pass multiple arguments, separate them with commas instead:
  cypress run --spec arg1,arg2,arg3

The most common cause of this warning is using an unescaped glob pattern. If you are
trying to pass a glob pattern, escape it using quotes:
  cypress run --spec "**/*.spec.js"

There is no warning on Windows, which is why I didn't notice it before I submitted the PR.

MikeMcC399 commented 1 year ago

npm run test:short is successful on:

with Node.js 18.12.1

Perhaps somebody would be kind enough to test it on macOS? @Ein-Tim? @larswmh?

dsarkar commented 1 year ago

@MikeMcC399 Many thanks for this PR. (On my older 2.7 GHz i5 Mac the test still takes about 10 min...)

MikeMcC399 commented 1 year ago

@dsarkar

Many thanks for this PR.

You're welcome!

(On my older 2.7 GHz i5 Mac the test still takes about 10 min...)

The run time is quite dependent on the available hardware. On my Windows 11 laptop (SSD drive, intel i5, 8GB) the Cypress test shows "All specs passed 02:47". The screenshot from @larswmh was even faster with 01:24.

Maybe you need to speak to someone nicely to get a hardware upgrade sometime? 😉