mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-29 18:46:59 +00:00
Adds a full desktop Playwright E2E suite that launches the Electron app against a mock inference server, exercising the full boot chain: electron -> hermes serve -> mock provider -> renderer Includes: - Mock OpenAI-compatible inference server (mock-server.ts) - Shared fixtures with sandbox isolation (credentials, HERMES_HOME, userData, fixed window-state.json for reproducible screenshots) - Test specs: boot, boot-failure, onboarding, mock-backend-setup, chat, and packaged-app launch - Visual regression: expectVisualSnapshot() wraps toHaveScreenshot in try/catch so diffs are reported without failing the test suite - CI workflow: xvfb at 1280x1024, baseline cache from main (--update-snapshots on main, compare on PRs), step summary table with diff/actual/expected image links, dedicated visual-diffs artifact - dev:mock script for local fake-provider development - test:e2e:visual + test:e2e:update-snapshots scripts using cage - .gitignore: *-snapshots/ (baselines cached in CI, not committed)
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
import './e2e/fix-electron-tracing'
|
|
|
|
import { defineConfig, type ReporterDescription } from '@playwright/test'
|
|
|
|
/**
|
|
* Visual regression testing config.
|
|
*
|
|
* Screenshots are compared against baselines. On `main`, baselines are
|
|
* generated with `--update-snapshots` and cached. On PRs, the cached
|
|
* baselines are restored and screenshots are compared — but tests DON'T
|
|
* fail on visual diffs (see `expectVisualSnapshot` in visual-snapshot.ts).
|
|
* Instead, diffs are surfaced in the CI step summary and uploaded as
|
|
* artifacts for human review.
|
|
*
|
|
* To update baselines after an intentional UI change:
|
|
* npx playwright test --update-snapshots
|
|
*/
|
|
const reporters: ReporterDescription[] = [
|
|
['list'],
|
|
['html', { open: 'never', outputFolder: 'playwright-report' }],
|
|
]
|
|
|
|
if (process.env.CI) {
|
|
reporters.push(['json', { outputFile: 'playwright-report/results.json' }])
|
|
}
|
|
|
|
export default defineConfig({
|
|
/* Test files live under e2e/ so they never collide with the vitest suite
|
|
* under src/ or the node:test files under electron/. */
|
|
testDir: './e2e',
|
|
/* The desktop app can take a while to bootstrap on cold CI runners — 90 s
|
|
* per test gives us headroom without masking real hangs. */
|
|
timeout: 90_000,
|
|
retries: process.env.CI ? 1 : 0,
|
|
/* Each test gets its own worker so the Electron process is fully isolated. */
|
|
fullyParallel: false,
|
|
reporter: reporters,
|
|
use: {
|
|
screenshot: 'on',
|
|
trace: { mode: 'on', screenshots: true, snapshots: true, sources: true },
|
|
},
|
|
expect: {
|
|
toHaveScreenshot: {
|
|
// 1% of pixels may differ — absorbs sub-pixel font rendering variance
|
|
// between local and CI environments.
|
|
maxDiffPixelRatio: 0.01,
|
|
animations: 'disabled',
|
|
caret: 'hide',
|
|
// Per-channel threshold for "close enough" — anti-aliasing differences.
|
|
threshold: 0.2,
|
|
},
|
|
},
|
|
})
|