refactor(e2e): extract infrastructure into tests/e2e/infra/ module

- Move fixtures.ts, llm-judge.ts, results-db.ts to tests/e2e/infra/
- Deduplicate wdio.conf.js: use createTestFixture() instead of inline copy
- Replace __dirname paths with projectRoot-anchored paths
- Create test-mode-constants.ts (typed env var names, flag registry)
- Create scripts/preflight-check.sh (validates tauri-driver, display, Claude CLI)
- Create scripts/check-test-flags.sh (CI lint for AGOR_TEST flag drift)
- Rewrite tests/e2e/README.md with full documentation
- Update spec imports for moved infra files
This commit is contained in:
Hibryda 2026-03-18 03:06:57 +01:00
parent 538a31f85c
commit e76bc341f2
10 changed files with 235 additions and 191 deletions

View file

@ -0,0 +1,23 @@
// Typed constants for test-mode environment variables.
// Single source of truth for env var names — prevents string literal duplication.
//
// These env vars are read by:
// Rust: agor-core/src/config.rs (AppConfig::from_env)
// src-tauri/src/commands/misc.rs (is_test_mode)
// src-tauri/src/lib.rs (setup: skip CLI install, forward to sidecar)
// src-tauri/src/watcher.rs (disable file watcher)
// src-tauri/src/fs_watcher.rs (disable fs watcher)
// src-tauri/src/telemetry.rs (disable OTLP)
// Svelte: src/App.svelte (disable wake scheduler)
/** Main test mode flag — set to '1' to enable test isolation */
export const AGOR_TEST = 'AGOR_TEST';
/** Override data directory (sessions.db, btmsg.db, search.db) */
export const AGOR_TEST_DATA_DIR = 'AGOR_TEST_DATA_DIR';
/** Override config directory (groups.json, plugins/) */
export const AGOR_TEST_CONFIG_DIR = 'AGOR_TEST_CONFIG_DIR';
/** All test-mode env vars for iteration */
export const TEST_ENV_VARS = [AGOR_TEST, AGOR_TEST_DATA_DIR, AGOR_TEST_CONFIG_DIR] as const;