import type { ExecutionStep } from '@detiq/agents'; export interface StepResult { stepNumber: number; description: string; status: 'PASSED' | 'FAILED' | 'SKIPPED'; duration: number; error?: string; screenshotPath?: string; healed?: boolean; /** 'mechanical' = same selector text, different Playwright locator strategy. * 'ai' = AI Self-Healing Agent matched a semantically different element * (the app's selector text itself changed, e.g. "Sign In" -> "Log In"). */ healedVia?: 'mechanical' | 'ai'; healReasoning?: string; healConfidence?: number; elementBoundingRect?: { x: number; y: number; width: number; height: number; } | null; elementSelector?: string; } export interface ExecutionResult { stepResults: StepResult[]; status: 'PASSED' | 'FAILED' | 'ERROR' | 'FLAKY'; errorStep?: number; totalDuration: number; finalScreenshotPath?: string; retryCount?: number; consoleLogs?: Array<{ type: string; text: string; timestamp: number; }>; networkErrors?: Array<{ url: string; status: number; method: string; timestamp: number; }>; rootCauseSummary?: string; networkTimings?: Array<{ url: string; method: string; status: number; duration: number; }>; } export declare function executeTestPlan(plan: ExecutionStep[], options: { screenshotDir: string; testRunId: string; viewport?: { width: number; height: number; }; onStepComplete?: (result: StepResult) => void; /** Run the test up to this many times to detect flakiness (default 1). */ maxRuns?: number; browser?: 'chromium' | 'firefox' | 'webkit'; /** Data row for parameterized execution: substitutes {{varname}} in step fields. */ dataRow?: Record; /** Enables the AI Self-Healing Agent tier when a step's selector can't be resolved * even after trying alternate locator strategies. Omit to keep mechanical-only * healing (no LLM calls during execution). */ healCtx?: { tenantId: string; projectId: string; }; /** Decrypted Playwright storageState JSON — restores a logged-in session so * steps don't have to re-authenticate. Without this, any test case behind a * login wall fails at the first authenticated step. */ storageState?: string; }): Promise;