agent-orchestrator/tests/e2e/adapters/base-adapter.ts
Hibryda 77b9ce9f62 feat: unified E2E testing engine — 205 tests, dual-stack support
Infrastructure:
- adapters/: base, tauri (port 9750), electrobun (port 9761 + PTY daemon)
- helpers/: 120+ centralized selectors, reusable actions, custom assertions
- wdio.shared.conf.js + stack-specific configs

18 unified specs (205 tests):
splash(6) smoke(15) settings(19) terminal(14) agent(15) search(12)
files(15) comms(10) tasks(10) theme(12) groups(12) keyboard(8)
notifications(10) diagnostics(8) status-bar(12) context(9)
worktree(8) llm-judged(10)

Daemon: --stack tauri|electrobun|both flag
Scripts: test:e2e:tauri, test:e2e:electrobun, test:e2e:both
2026-03-22 05:27:36 +01:00

43 lines
1.4 KiB
TypeScript

/**
* Abstract stack adapter — defines the lifecycle contract for E2E test stacks.
*
* Each concrete adapter (Tauri, Electrobun) implements binary discovery,
* WebDriver setup/teardown, and optional PTY daemon management.
*/
import type { ChildProcess } from 'node:child_process';
import type { TestFixture } from '../infra/fixtures.ts';
export interface StackCapabilities {
/** WebDriver capability object for WDIO */
capabilities: Record<string, unknown>;
}
export abstract class StackAdapter {
/** Human-readable stack name (e.g. 'tauri', 'electrobun') */
abstract readonly name: string;
/** WebDriver port for this stack */
abstract readonly port: number;
/** Resolve absolute path to the built binary */
abstract getBinaryPath(): string;
/** Data directory for test isolation */
abstract getDataDir(fixture: TestFixture): string;
/** Build WDIO capabilities object for this stack */
abstract getCapabilities(fixture: TestFixture): StackCapabilities;
/** Spawn the WebDriver process (tauri-driver, WebKitWebDriver, etc.) */
abstract setupDriver(): Promise<ChildProcess>;
/** Kill the WebDriver process */
abstract teardownDriver(driver: ChildProcess): void;
/** Optional: start PTY daemon before tests (Electrobun only) */
async startPtyDaemon?(): Promise<ChildProcess>;
/** Optional: stop PTY daemon after tests */
stopPtyDaemon?(daemon: ChildProcess): void;
}