/** * QA360 Phase 3 Runner * Orchestrates hooks, adapters, and proof generation * Supports both Pack v1 and Pack v2 configurations */ import { PackConfigV1 } from '../types/pack-v1.js'; import { PackConfigV2 } from '../types/pack-v2.js'; import { FlakinessResult } from '../flakiness/index.js'; export type PackConfig = PackConfigV1 | PackConfigV2; export interface Phase3RunnerOptions { workingDir: string; pack: PackConfig; packDir?: string; outputDir?: string; /** Enable flakiness detection (runs tests N times consecutively) */ flakyDetect?: boolean; /** Number of consecutive runs for flakiness detection (default: 3) */ flakyRuns?: number; /** Run browser in headed mode (visible UI) */ headed?: boolean; } export interface GateResult { gate: string; success: boolean; duration: number; adapter: string; results: any; junit?: string; error?: string; } export interface Phase3RunResult { success: boolean; pack: PackConfig; duration: number; gates: GateResult[]; hooks: { beforeAll: any[]; beforeEach: any[]; afterEach: any[]; afterAll: any[]; }; summary: { total: number; passed: number; failed: number; trustScore: number; }; /** Flakiness analysis results (if enabled) */ flakiness?: FlakinessResult[]; proofPath?: string; /** Vault run ID for this execution */ runId?: string; error?: string; } export declare class Phase3Runner { private workingDir; private pack; private packDir; private outputDir; private redactor; private hooksRunner; private keyPair?; private vault?; private authManager; private authCredentialsCache; private flakyDetect; private flakyRuns; private flakinessDetector; private headed; private fixtureLoader?; private fixtureResolver?; private pageObjectLoader?; constructor(options: Phase3RunnerOptions); /** * Initialize Page Object Model from the pack configuration */ private initializePageObjects; /** * Load Page Objects before execution */ private loadPageObjects; /** * Initialize data fixtures from the pack configuration */ private initializeFixtures; /** * Load fixtures before execution */ private loadFixtures; /** * Resolve fixture references in a configuration object */ private resolveFixturesInConfig; /** * Type guard to check if pack is v2 */ private isPackV2; /** * Register authentication profiles from pack config */ private registerAuthProfiles; /** * Get auth profile name for a specific gate */ private getAuthProfileForGate; /** * Authenticate and get credentials for a gate */ private getCredentialsForGate; /** * Convert v2 hooks to v1 format */ private convertV2HooksToV1; /** * Convert v2 execution config to v1 format */ private convertV2ExecutionToV1; /** * Get gates array from pack (handles v1 and v2) */ private getGatesArray; /** * Execute complete Phase 3 workflow */ run(): Promise; /** * Execute a single quality gate */ private executeGate; /** * Execute a dynamic v2 gate */ private executeDynamicGate; /** * Execute Playwright API gate with v2 config * Uses PlaywrightNativeApiAdapter for zero-overhead HTTP testing */ private executePlaywrightApiGate; /** * Execute Playwright UI gate with v2 config */ private executePlaywrightUiGate; /** * Execute K6 Performance gate with v2 config */ private executeK6PerfGate; /** * Execute Semgrep SAST gate with v2 config */ private executeSemgrepSastGate; /** * Execute Vitest unit tests gate (v2.2.0) */ private executeVitestGate; /** * Execute Jest unit tests gate (v2.2.0) */ private executeJestGate; /** * Execute Pytest unit tests gate (v2.2.0) */ private executePytestGate; /** * Build JUnit format from Vitest results */ private buildJunitFromVitest; /** * Build JUnit format from Jest results */ private buildJunitFromJest; /** * Build JUnit format from Pytest results */ private buildJunitFromPytest; /** * Run API smoke gate * Uses PlaywrightNativeApiAdapter for zero-overhead HTTP testing */ private runApiSmokeGate; /** * Run UI gate (includes basic accessibility) */ private runUiGate; /** * Run A11y gate (focused accessibility testing) */ private runA11yGate; /** * Run performance gate */ private runPerfGate; /** * Run SAST gate */ private runSastGate; /** * Run DAST gate (mock implementation) */ private runDastGate; /** * Calculate execution summary */ private calculateSummary; /** * Generate cryptographically signed proof document */ private generateProof; /** * Save run results to Evidence Vault * @returns The vault run ID */ private saveToVault; /** * Detect flakiness by running tests multiple times consecutively * @param gateResults Original gate results from first run * @returns Flakiness analysis results */ private detectFlakiness; /** * Extract test results from a gate result * Returns a map of testId to TestResult for flakiness tracking */ private extractTestResults; /** * Generate hash of pack configuration */ private hashPack; /** * Get API target (v1 or v2 format) */ private getTargetApi; /** * Get Web target (v1 or v2 format) */ private getTargetWeb; /** * Get budgets (v1 or v2 format) */ private getBudgets; /** * Get execution timeout (v1 or v2 format) */ private getExecutionTimeout; /** * Get execution retries (v1 or v2 format) */ private getExecutionRetries; /** * Ensure output directory exists */ private ensureOutputDir; }