Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
with: { name: all-builds }
- uses: cypress-io/github-action@v7
with:
browser: chrome

Copy link
Copy Markdown
Collaborator

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 CI

Copy link
Copy Markdown
Collaborator Author

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

Copy link
Copy Markdown
Collaborator

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?

working-directory: webapp
install: false
start: pnpm exec vite --mode test --port 1351
Expand All @@ -85,6 +86,7 @@ jobs:
env:
DISCO_TRAINING_E2E: "1"
with:
browser: chrome
working-directory: webapp
install: false
start: pnpm exec vite --mode test --port 1351
Expand All @@ -111,6 +113,7 @@ jobs:
DISCO_SCRIPTED_SERVER_E2E: "1"
VITE_SERVER_URL: http://server:8080
with:
browser: chrome
working-directory: webapp
install: false
start: pnpm exec vite --mode test --port 1351
Expand Down Expand Up @@ -142,6 +145,7 @@ jobs:
DISCO_TRAINING_E2E: "1"
DISCO_E2E_FEDERATED_TASK: ${{ matrix.task }}
with:
browser: chrome
working-directory: webapp
install: false
start: >-
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/record-cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- run: pnpm -F webapp run test:unit
- uses: cypress-io/github-action@v7
with:
browser: chrome
working-directory: webapp
install: false
start: pnpm start
Expand Down
13 changes: 13 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`):
When running end-to-end training tests locally, you can choose the browser with the `DISCO_E2E_BROWSER` environment variable (e.g. `chrome`, `firefox`, `edge`):


```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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.
Expand Down
2 changes: 2 additions & 0 deletions webapp/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ if (
);

export default defineConfig({
defaultBrowser: process.env.DISCO_E2E_BROWSER,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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
Expand Down
Loading