2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-07-05 06:32:55 +00:00

fix(forntend): generate UI coverage again (#12066)

* Attempt to fix UI coverage

* Update CI workflows:

- use test sharding
- Only upload coverage on master

* Restore line

* Simplify test

* Simplify test matrix

* Fix env vars

* Adjust matrix

* Adjust output names

* Fix paths

* Simplify qc_checks

* Revert missing line

* Simplify coverage calls

* Run firefox test against port 8000

* Fix VITE_COVERAGE env var

* Capture browser name in report output

* Increase timeout again

* Enhanced feedback from playwright startup

* Split UI checks into separate file

* Fix workflow deps

* Shard chromium build

* Adjust reporter type

* Reduce uncessesary build steps

* Tweak paths filter

* Reduce retries

* Also generate HTML reports

* Tweak reporter output

* Fix custom splash URLs

* Fix envs for customization tests

* Shard the firefox runner too

* Ignore customization tests for firefox too

* Don't upload if tests fail

* Fix triggers

* Remove merged test coverage

* Pin download action

* Error if no artifact files found

* Update ignore dirs

* Adjust baseFixtures

* Fix for teardown in baseFixtures.ts

* Fix path for coverage files

* include hidden files
This commit is contained in:
Oliver
2026-06-06 07:55:49 +10:00
committed by GitHub
parent 2e4bf3739f
commit 88524ac6d5
15 changed files with 415 additions and 176 deletions
+16 -17
View File
@@ -3,9 +3,6 @@ import { defineConfig, devices } from '@playwright/test';
// Detect if running in CI
const IS_CI = !!process.env.CI;
const MAX_WORKERS: number = 3;
const MAX_RETRIES: number = 3;
/* We optionally spin-up services based on the testing mode:
*
* Local Development:
@@ -26,21 +23,28 @@ const MAX_RETRIES: number = 3;
* - WORKERS = 1 (to avoid conflicts with HMR)
*/
const BASE_URL: string = IS_CI
? 'http://localhost:8000'
: 'http://localhost:5173';
const BASE_URL: string =
process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:5173';
// If running in "production" mode, we can use multiple workers to speed up the tests
const MAX_WORKERS: number = BASE_URL.endsWith('8000') ? 3 : 1;
const MAX_RETRIES: number = IS_CI ? 1 : 2;
console.log('Running Playwright Tests:');
console.log('- Base URL:', BASE_URL);
console.log('- Max Workers:', MAX_WORKERS);
console.log('- Max Retries:', MAX_RETRIES);
export default defineConfig({
testDir: './tests',
fullyParallel: false,
timeout: 90000,
forbidOnly: !!IS_CI,
retries: IS_CI ? MAX_RETRIES : 0,
workers: IS_CI ? MAX_WORKERS : 1,
reporter: IS_CI ? [['html', { open: 'never' }], ['github']] : 'list',
retries: MAX_RETRIES,
workers: MAX_WORKERS,
reporter: IS_CI
? [['html', { open: 'never' }], ['blob'], ['github']]
: 'list',
/* Configure projects for major browsers */
projects: [
@@ -57,13 +61,6 @@ export default defineConfig({
...devices['Desktop Firefox']
},
testIgnore: /customization/ // Ignore all tests in the "customization" folder for this project
},
{
name: 'customization',
use: {
...devices['Desktop Firefox']
},
testIgnore: /pui_.*\.spec\.ts/ // Ignore all "pui_*.spec.ts" tests for this project
}
],
@@ -89,7 +86,9 @@ export default defineConfig({
INVENTREE_CORS_ORIGIN_ALLOW_ALL: 'True',
INVENTREE_COOKIE_SAMESITE: 'False',
INVENTREE_LOGIN_ATTEMPTS: '100',
INVENTREE_PLUGINS_MANDATORY: 'samplelocate'
INVENTREE_PLUGINS_MANDATORY: 'samplelocate',
INVENTREE_CUSTOM_SPLASH: 'img/playwright_custom_splash.png',
INVENTREE_CUSTOM_LOGO: 'img/playwright_custom_logo.png'
},
url: 'http://localhost:8000/api/',
reuseExistingServer: IS_CI,