hermes-agent/apps/desktop/e2e/core/playwright.config.ts
teknium1 989798cd5e fix(desktop): test runs stop leaking temp dirs into TMPDIR
Hermes points TMPDIR at ~/.hermes/cache/scratch, so every Desktop test
run's leftovers pile up there until the 24h idle pruner catches them:
one day on a dev host left 688 playwright-tracing-*, 152
playwright-artifacts-*, 75 hermes-e2e-mock-* sandboxes and ~600 small
vitest mkdtemp dirs.

- Playwright (main + core configs): e2e/run-tmp.ts gives the run one
  temp root that workers, Electron and the backend inherit via TMPDIR,
  and removes it when the runner exits. Covers the stack-trace dirs the
  Electron tracing patch orphans (2 per launch, even on green runs),
  sandboxes a failed/timed-out setup never cleans, and Playwright's own
  artifact dirs. A SIGKILLed run now leaves one pw-* dir for the pruner.
  The update suite keeps os.tmpdir(): its seeded install is reused
  across runs and bakes its path into AF_UNIX sockets.
- vitest (apps/desktop): globalSetup does the same for the run; one
  `--project electron` run left 54 dirs from tests that never remove
  what they mkdtemp.
2026-09-27 23:10:22 -07:00

33 lines
1.2 KiB
TypeScript

import '../run-tmp'
import '../fix-electron-tracing'
import { defineConfig } from '@playwright/test'
/**
* The core Desktop suite: a small, deterministic, REQUIRED lane.
*
* Deliberately different from ../../playwright.config.ts:
* - retries: 0 — a required job that retries hides exactly the flake it
* should expose (the old lane retried and still went red for weeks).
* - no visual baselines / always-on screenshots; artifacts only on failure.
* - one worker: every spec owns a real Electron + `hermes serve`; running
* them concurrently on a loaded runner is the timing margin we refuse.
* - 180 s per test (green runs take 6-36 s): a stalled stream fails the one
* test fast instead of the 30-min job timeout cancelling the whole lane
* before it reports.
*/
export default defineConfig({
testDir: '.',
testMatch: '*.spec.ts',
timeout: 180_000,
expect: { timeout: 60_000 },
retries: 0,
workers: 1,
fullyParallel: false,
reporter: [['list'], ['html', { open: 'never', outputFolder: '../../playwright-report/core' }]],
outputDir: '../../test-results/core',
use: {
screenshot: 'only-on-failure',
trace: 'retain-on-failure'
}
})