From 08d873ab870d0aeb6370accd8e4924c4826519fe Mon Sep 17 00:00:00 2001 From: mahach666 <79989386+mahach666@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:23:22 +0300 Subject: [PATCH] Run viewer regression tests in Firefox CI --- .github/workflows/ci.yml | 9 +++++++-- CONTRIBUTING.md | 6 ++++++ src/IOViewer/Viewer/package.json | 2 +- src/IOViewer/Viewer/playwright.config.js | 14 +++++++++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfc7556..cf971ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,6 +61,11 @@ jobs: global-json-file: global.json dotnet-version: | 8.0.x + - name: Build the viewer fixture and benchmark tools + working-directory: . + run: | + dotnet build tests/fixtures/viewer/generate-fixtures.cs -c Release + dotnet build tools/SyntheticModel/SyntheticModel.cs -c Release - uses: actions/setup-node@v7 with: node-version: 24 @@ -71,5 +76,5 @@ jobs: # dist/viewer.js is committed and embedded in the library: it must match the sources. - run: git diff --exit-code dist/ - run: npm test - - run: npx playwright install --with-deps chromium - - run: npm run e2e + - run: npx playwright install --with-deps chromium firefox + - run: xvfb-run -a npx playwright test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1cd6a01..4dc0289 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -83,6 +83,12 @@ fails when it differs from the committed file. The end-to-end tests need the .NET SDK and a Chromium for Playwright (`npx playwright install chromium`). Fixtures are in `tests/fixtures/viewer`. +CI also runs the smoke, selection and section tests in Firefox and builds `tests/fixtures/viewer/generate-fixtures.cs` +and `tools/SyntheticModel/SyntheticModel.cs`. To run the Firefox project locally, build the viewer, install Firefox +with `npx playwright install firefox` and run `npx playwright test --project=firefox`. On Linux, install browser +system dependencies with `npx playwright install --with-deps chromium firefox` and prefix the Firefox command with +`xvfb-run -a` on machines without a display. + `npm run perf` runs the manual performance harness in a visible Chromium window (for example `PERF_LADDER=25000,200000` measures synthetic models made by `tools/SyntheticModel`); its settings are described at the top of diff --git a/src/IOViewer/Viewer/package.json b/src/IOViewer/Viewer/package.json index 9620179..9dee57f 100644 --- a/src/IOViewer/Viewer/package.json +++ b/src/IOViewer/Viewer/package.json @@ -5,7 +5,7 @@ "scripts": { "build": "esbuild src/main.js --bundle --minify --format=iife --target=es2020 --outfile=dist/viewer.js", "test": "node --test test/unit/*.test.js", - "e2e": "npm run build && playwright test", + "e2e": "npm run build && playwright test --project=chromium", "perf": "npm run build && playwright test --config playwright.perf.config.js" }, "dependencies": { diff --git a/src/IOViewer/Viewer/playwright.config.js b/src/IOViewer/Viewer/playwright.config.js index 9affecf..1b65dc3 100644 --- a/src/IOViewer/Viewer/playwright.config.js +++ b/src/IOViewer/Viewer/playwright.config.js @@ -8,8 +8,20 @@ export default defineConfig({ forbidOnly: !!process.env.CI, reporter: 'list', use: { - browserName: 'chromium', locale: 'ru-RU', viewport: { width: 1280, height: 800 }, }, + projects: [ + { name: 'chromium', use: { browserName: 'chromium' } }, + { + name: 'firefox', + testMatch: ['**/smoke.spec.js', '**/selection.spec.js', '**/sections.spec.js'], + use: { + browserName: 'firefox', + // Under Linux, Xvfb supplies the display Firefox uses to create a WebGL context in CI. + headless: process.platform !== 'linux', + launchOptions: { firefoxUserPrefs: { 'webgl.force-enabled': true } }, + }, + }, + ], });