Repository navigation
ci(test): run Cypress E2E workflows in Chrome #1266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -129,6 +129,19 @@ Federated training tests run in separate CI jobs for Titanic and LUS COVID. | |||||
| Each job starts a real server and a Node participant configured for its task; | ||||||
| see `test-e2e-federated` in `.github/workflows/_test.yml` for the setup. | ||||||
|
|
||||||
| ##### Running with a specific browser | ||||||
|
|
||||||
| In CI, Cypress workflows run in Google Chrome (`browser: chrome`). | ||||||
|
|
||||||
| When running end-to-end training tests locally, you can select which browser to run with using the `DISCO_E2E_BROWSER` environment variable (e.g. `chrome`, `firefox`, `edge`): | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The env var sets the browser for every webapp tests, not just end-to-end training no? If so this subsection doesn't need to be nested in "Training end-to-end tests"
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```sh | ||||||
| DISCO_E2E_BROWSER=firefox pnpm -F webapp run test:e2e:local | ||||||
| DISCO_E2E_BROWSER=chrome pnpm -F webapp run test:e2e:local | ||||||
| ``` | ||||||
|
|
||||||
| On Linux, running image tasks (such as LUS COVID) with real browsers like Chrome or Firefox is recommended over headless Electron to leverage hardware WebGL acceleration and avoid CPU software fallback stalls. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can remove any mention of Electron since it is deprecated and will be removed, especially if we set a default fallback browser |
||||||
|
|
||||||
| #### Cypress and Github Actions | ||||||
|
|
||||||
| It is possible to record the cypress tests ran in the Github Actions CI and visualize them in the [Cypress Cloud](cloud.cypress.io). It is currently used only when needed (because the free plan has a limited number of recordings). The [cypress documentation](https://docs.cypress.io/app/continuous-integration/github-actions) describes how to set up the recordings. | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,8 @@ if ( | |
| ); | ||
|
|
||
| export default defineConfig({ | ||
| defaultBrowser: process.env.DISCO_E2E_BROWSER, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. regarding your comment on a fallback browser I think we should set one (I guess chrome is more likely to already be installed) and if contributors want to use a different one they can just use the env var
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would also ensure that new tests still run on chrome in the CI if we forget to specify the browser in the yaml file |
||
|
|
||
| // Cypress.env() is deprecated throw; use cy.env() for sensitive values | ||
| // and Cypress.expose() otherwise | ||
| // allowCypressEnv will be removed in v16.0 so delete this line at that point | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you look into
chrome-for-testing(doc)? mabe this would be a good option for the CIThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to pin the browser version? I don't think we're doing anything particularly fancy + if our tests were to actually fail on a new chrome version it'd be desirable to know. Also we'd have to keep updated the version we use if we decide to pin it. I'll look into it more deeply that's just my first impression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also wondering about this, I also think that failing on different chrome versions is what we want even if it could be flaky depending on the CI machine. Maybe we can ensure that we log the browser version in the CI for troubleshooting?