StatCan/jupyter-apis

Integrate cypress into github workflow

mathis-marcotte opened this issue · 4 comments

Our end-to-end tests can be intergrated into our github workflows to make them run whenenver we push to a pull request so that we don't forget to run them, which also ensures that we notice if we break something.

This is already being done upstream, so we can probably start from how they did it https://github.com/kubeflow/kubeflow/blob/bbc55dd4a981d5c8e7de038715b11b07fa6883c2/.github/workflows/jwa_frontend_tests.yaml#L60.

Cypress also provides documentation for this type of task https://docs.cypress.io/guides/continuous-integration/github-actions.

Looking at the upstream workflow file, they first have this step :
image

The two steps to take notice of are the one that checks the formatting and the one that checks the linting.
npm run format:check runs the prettier package. This is a package that makes your code "prettier" Currently, this fails in our code because we would first need to do npm run format:write. Testing it, this does affect pretty much most of our frontend files to make them "prettier". I don't think we absolutely need to do this step, especially if it will just cause more diversions from kubeflow 1.6. But considering that workflow job is coming from the most recent upstream, I assume that they have run and applied npm rubn format:write to their files, and therefore we should be getting those "prettier" fiels in our next version upgrade.

npm run lint-check runs ng lint which is the angular linter function. Having a lint check is a bit more appealing than just prettier code to ensure we don't do anything poorly, especially with our custom code(as it's possible lint errors come from code written by upstream).

Upstream also has this job in their workflow
image

The npm run test:prod runs ng test which is the angular command to run all the *.component.spec.ts test files we have. Testing this command, it fails at a lot of steps, but mainly it fails in the test files we have under the "rok" tagged stuff. These are not components we are actually using, and it even got removed in the latest upstream. So for now, I will keep this workflow job commented out, and when we remove all that rok stuff, we can look into re-enabling this job.

This step works succesfully for running the cypress tests through the github workflow

image

Screenshot of a succesfull run
image