Improve Cypress testing against non-functioning app.js
See original GitHub issueWhere to find the issue
Cypress test suite for cwa-website https://github.com/corona-warn-app/cwa-website/tree/master/cypress
Describe the issue
Running the Cypress test suite against the production webserver https://www.coronawarn.app on May 10, 2022 when there were multiple website issues occurring (see #2870) failed to identify any issue. The test suite passed although at the time the Google Chrome console was showing the error:
www.coronawarn.app/:1 Refused to execute script from 'https://www.coronawarn.app/assets/js/app.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
This error condition prevented many essential functions on the website from being available.
Steps to reproduce
Local clone
To simulate the mime problem locally, test with a removed app.js JavaScript file. From a bash prompt at the root of the cloned cwa-website repository execute:
npm run test:open
- Manually delete
/public/assets/js/app.js
from generated local directory undercwa-website
- Go to page http://localhost:8000/en/analysis/ in web browser and confirm “No data to display” in dashboard graphs (showing that web is broken)
- In Cypress test runner click on “Run 6 integration tests”
- Note that 87 tests pass and 0 tests fail, even though
app.js
is not available
Production server
To run the Cypress test suite against the production server, navigate in a bash prompt to the root of the cloned cwa-website repository and execute
npx cypress run -c baseUrl=https://coronawarn.app
or
npx cypress open -c baseUrl=https://coronawarn.app
to run individual tests
Suggested enhancement
Add a new Cypress test to check for correct mime types.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
@Ein-Tim
You can view the test code in PR #2890 now. Its purpose is to check the mime types, which was the root cause of the problem https://github.com/corona-warn-app/cwa-website/issues/2870. If
app.js
is missing, the test will also fail with a 404 error, however that was not a problem in production, I just used the file deletion as a way to simulate the issue.