diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index 406d47ef4..e16375e53 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -63,6 +63,7 @@ jobs: with: { name: all-builds } - uses: cypress-io/github-action@v7 with: + browser: chrome working-directory: webapp install: false start: pnpm exec vite --mode test --port 1351 @@ -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 @@ -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 @@ -142,6 +145,7 @@ jobs: DISCO_TRAINING_E2E: "1" DISCO_E2E_FEDERATED_TASK: ${{ matrix.task }} with: + browser: chrome working-directory: webapp install: false start: >- diff --git a/.github/workflows/record-cypress.yml b/.github/workflows/record-cypress.yml index f737d29e8..248b12bf4 100644 --- a/.github/workflows/record-cypress.yml +++ b/.github/workflows/record-cypress.yml @@ -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 diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 9fb2d2be2..016c4d569 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -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`): + +```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. + #### 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. diff --git a/webapp/cypress.config.ts b/webapp/cypress.config.ts index 738464585..0f4593bf7 100644 --- a/webapp/cypress.config.ts +++ b/webapp/cypress.config.ts @@ -51,6 +51,8 @@ if ( ); export default defineConfig({ + defaultBrowser: process.env.DISCO_E2E_BROWSER, + // 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