Files
jakevin 67344d5e36 test(e2e): run AX smoke headless on all platforms; add daemon transport contract E2E (#2081)
The AX real-Chrome smoke's contract is "the extension bridge works in a
real Chrome", not "a window appears" — Linux already admitted that by
faking a display with xvfb. Hosted macOS runners fail headed Chrome at
the OS level (child processes lose the Mach port rendezvous with the
browser process because CI jobs run outside a regular Aqua session), and
PR #2079 papered over that by skipping the platform. Running the smoke
with --headless=new removes the display/GUI-session dependency entirely:
new headless is a full browser (MV3 service worker, chrome.debugger,
--load-extension), verified locally against the same Chrome for Testing
build CI uses. The smoke is release-blocking on every OS again; headed
mode stays available locally via OPENCLI_E2E_HEADED=1.

New daemon-transport contract E2E: the real dist/src/daemon.js process
with a scripted fake extension, pinning the cross-layer contracts end to
end — duplicate ids attach to the pending command without re-dispatch,
deadlines produce a structured 408 command_result_unknown, extension
death after dispatch yields command_result_unknown, a stale
preferredContextId falls back to the only connected profile while an
explicit contextId fails loud, and graceful shutdown flushes structured
daemon_shutting_down 503s with exit code 0. No browser required; runs in
the fixed-port project on every OS.
2026-07-04 01:37:38 +08:00

69 lines
2.0 KiB
TypeScript

import { defineConfig } from 'vitest/config';
const includeExtendedE2e = process.env.OPENCLI_E2E === '1';
const includeAxChromeE2e = process.env.OPENCLI_AX_E2E === '1';
export default defineConfig({
test: {
projects: [
{
test: {
name: 'unit',
include: ['src/**/*.test.ts'],
exclude: ['clis/**/*.test.{ts,js}'],
sequence: { groupOrder: 0 },
},
},
{
test: {
name: 'extension',
include: ['extension/src/**/*.test.ts'],
sequence: { groupOrder: 0 },
},
},
{
test: {
name: 'adapter',
include: ['clis/**/*.test.{ts,js}'],
sequence: { groupOrder: 1 },
},
},
{
test: {
name: 'e2e-fixed-port',
include: ['tests/e2e/browser-tabs.test.ts', 'tests/e2e/daemon-transport.test.ts'],
fileParallelism: false,
sequence: { groupOrder: 2 },
},
},
{
test: {
name: 'e2e',
include: [
'tests/e2e/browser-public.test.ts',
'tests/e2e/band-auth.test.ts',
'tests/e2e/public-commands.test.ts',
'tests/e2e/management.test.ts',
'tests/e2e/output-formats.test.ts',
'tests/e2e/plugin-management.test.ts',
'tests/e2e/article-download-pipeline.test.ts',
...(includeAxChromeE2e ? ['tests/e2e/browser-ax-chrome.test.ts'] : []),
// Extended browser tests (20+ sites) — opt-in only:
// OPENCLI_E2E=1 npx vitest run
...(includeExtendedE2e ? ['tests/e2e/browser-public-extended.test.ts', 'tests/e2e/browser-auth.test.ts', 'tests/e2e/douban.test.ts'] : []),
],
maxWorkers: 2,
sequence: { groupOrder: 3 },
},
},
{
test: {
name: 'smoke',
include: ['tests/smoke/**/*.test.ts'],
sequence: { groupOrder: 4 },
},
},
],
},
});