test(perf): track-only runtime-perf E2E for eeschema + pcbnew

Measures the current build's cold load, open+render, and pan/zoom FPS
(1x/4x/6x CPU-throttle sweep) for both editors, writing
tests/test-results/perf-*.json. Track-only: asserts only that the app booted
and the document opened — no perf thresholds, so it never gates CI.

Runs on a new Chromium `perf` Playwright project (CDP throttling; pcbnew needs
V8 anyway) via `npm run test:perf`, and is wired into wasm-build.yml as a
continue-on-error step so the numbers are captured/uploaded without flaking the
gate. Reuses the existing fixtures, ready-signal, fs-inject, and board-ready
helpers; FPS counter is cancel-able so a throttle sweep on one page doesn't
accumulate rAF loops.

.gitignore: ignore /benchmark-builds/ (disposable prebuilt-WASM + standalone
harness bundle used to reproduce the native-vs-JS-EH comparison locally).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2026-07-01 14:43:54 +02:00
commit 3e5791774b
7 changed files with 268 additions and 3 deletions

View file

@ -92,6 +92,11 @@ const PCBNEW_FAMILY_SPECS = [
'**/footprint-3d-preview.spec.ts',
];
// Runtime-perf specs run ONLY on the Chromium 'perf' project below: they need
// CDP CPU throttling (Chromium-only) and pcbnew needs V8. Excluded from the
// firefox/chromium projects so they don't double-run there.
const PERF_SPECS = ['**/*-perf.spec.ts'];
const appsDir = 'apps';
export default defineConfig({
@ -120,9 +125,9 @@ export default defineConfig({
{
// Firefox is the default for headless testing (works on ARM Mac)
name: 'firefox',
// On CI the pcbnew-family specs run on chromium-ci instead (see
// PCBNEW_FAMILY_SPECS above for why).
...(process.env.CI ? { testIgnore: PCBNEW_FAMILY_SPECS } : {}),
// Perf specs always run on the dedicated 'perf' project, never here. On CI
// the pcbnew-family specs also move to chromium-ci (see PCBNEW_FAMILY_SPECS).
testIgnore: [...PERF_SPECS, ...(process.env.CI ? PCBNEW_FAMILY_SPECS : [])],
use: {
...devices['Desktop Firefox'],
viewport: { width: 1280, height: 720 },
@ -157,6 +162,7 @@ export default defineConfig({
// Chromium issues #1416283, #338414704 (SwiftShader WebGL bug).
// Run via: npm run test:kicad:headed
name: 'chromium',
testIgnore: PERF_SPECS,
use: {
channel: 'chrome',
viewport: { width: 1280, height: 720 },
@ -178,6 +184,20 @@ export default defineConfig({
},
},
},
{
// Runtime-perf specs (*-perf.spec.ts): bundled Chromium for CDP CPU throttling.
// Bundled (not system Chrome) because system Chrome paces rAF oddly under CDP
// throttle (FPS rose with throttle). --enable-unsafe-swiftshader lets it use
// software WebGL headless on CI; harmless with a real GPU locally. Add --headed
// locally for real-GPU FPS numbers.
name: 'perf',
testMatch: PERF_SPECS,
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 720 },
launchOptions: { args: ['--enable-unsafe-swiftshader'] },
},
},
],
webServer: {