import type { SiteLearnings } from './orchestrator/types'; /** * Playwright MCP configuration - JavaScript config file content (playwright.config.js) */ export type PlaywrightConfig = string; /** * Test execution status */ export type TestExecutionStatus = 'passed' | 'failed'; /** * Request structure for the Playwright script executor */ export interface PlaywrightExecutionRequest { /** Main Playwright script content */ script: string; /** Optional pre-script to run before the main script */ prescript?: string; /** Optional post-script to run after the main script */ postscript?: string; /** Playwright configuration file content */ playwrightConfig: string; /** Optional GPT model to use for AI operations */ model?: string; } /** * Response structure for the Playwright script executor */ export interface PlaywrightExecutionResponse { /** Whether the execution was successful */ success: boolean; /** Execution results from each script phase */ results: { prescript?: ScriptResult; script: ScriptResult; postscript?: ScriptResult; }; /** Overall execution time in milliseconds */ executionTime: number; /** Any errors that occurred during execution */ error?: string; } /** * Individual script execution result */ export interface ScriptResult { /** Whether this specific script executed successfully */ success: boolean; /** Output from the script execution */ output: string; /** Any errors from this script */ error?: string; /** Execution time for this script in milliseconds */ executionTime: number; } /** * Scenario execution request */ export interface ScenarioRequest { scenario: string; testName?: string; playwrightConfig?: PlaywrightConfig; model?: string; } /** * Predefined step for scenario-steps flow (no LLM breakdown). */ export interface PredefinedStep { description: string; code?: string; } /** * Scenario execution job for worker queue */ export interface ScenarioRunJob { id: string; /** Natural-language scenario string (used when steps is not provided). */ scenario: string; /** Predefined steps; when set, skip LLM breakdown and use these. */ steps?: PredefinedStep[]; /** When set with steps, navigate here before executing the step loop. */ initialUrl?: string; testName?: string; playwrightConfig?: PlaywrightConfig; model?: string; scenarioFileName?: string; headless?: boolean; existingBrowser?: any; existingContext?: any; existingPage?: any; existingSiteLearnings?: SiteLearnings; } /** * Scenario execution response */ export interface ScenarioResponse { success: boolean; steps: ScenarioStep[]; generatedScript: string; executionLog: string; executionTime: number; testName?: string; preferredFileName?: string; error?: string; siteLearnings?: any; } /** * Individual sub-action within a step */ export interface SubAction { command: string; success: boolean; error?: string; retryCount: number; } /** * Individual scenario step */ export interface ScenarioStep { stepNumber: number; description: string; playwrightCommand?: string; playwrightCommands?: string[]; subActions?: SubAction[]; success?: boolean; error?: string; retryCount?: number; screenState?: { screen: string; state: string; }; attempts?: Array<{ attemptNumber: number; command?: string; success: boolean; error?: string; timestamp: number; }>; } /** * Legacy scenario job interface (for backward compatibility) */ export interface ScenarioJob { id: string; scenario: string; config?: PlaywrightConfig; resolve: (result: ScenarioResponse) => void; reject: (error: Error) => void; existingBrowser?: any; existingContext?: any; existingPage?: any; } /** * Execution mode for script execution */ export declare enum ExecutionMode { RUN_EXACTLY = "RUN_EXACTLY", RUN_WITH_AI_REPAIR = "RUN_WITH_AI_REPAIR" } /** * Script execution request with AI repair capabilities */ export interface ScriptExecutionRequest { script?: string; scriptFilePath?: string; mode: ExecutionMode; repairFlexibility?: number; playwrightConfig?: PlaywrightConfig; playwrightConfigFilePath?: string; model?: string; headless?: boolean; deflakeRunCount?: number; jobId?: string; attemptRunExactlyFirst?: boolean; steps?: ScriptStep[]; existingBrowser?: any; existingContext?: any; existingPage?: any; tempDir?: string; testFolderPath?: string[]; runPomDenormalized?: boolean; } /** * Script execution response with repair information */ export interface ScriptExecutionResponse { runStatus: 'success' | 'failed'; repairStatus?: 'success' | 'failed' | 'partial'; repairConfidence?: number; repairAdvice?: string; updatedScript?: string; executionTime: number; numDeflakeRuns?: number; error?: string; siteLearnings?: any; } /** * Individual script step for AI repair */ export interface ScriptStep { id?: string; description: string; code: string; success?: boolean; error?: string; isVariableDeclaration?: boolean; scenarioAnnotation?: string; } /** * Step operation types for AI repair */ export declare enum StepOperation { MODIFY = "MODIFY", INSERT = "INSERT", REMOVE = "REMOVE" } /** * Step repair action */ export interface StepRepairAction { operation: StepOperation; stepIndex?: number; newStep?: ScriptStep; insertAfterIndex?: number; } /** * Test pathway - represents a test's location within a file */ export interface TestPathway { suitePath: string[]; testName: string; } /** * Test file execution request - for running entire test files with hooks */ export interface TestFileExecutionRequest { script?: string; scriptFilePath?: string; testPathways?: TestPathway[]; mode?: ExecutionMode; repairFlexibility?: number; playwrightConfig?: PlaywrightConfig; playwrightConfigFilePath?: string; model?: string; headless?: boolean; deflakeRunCount?: number; jobId?: string; attemptRunExactlyFirst?: boolean; existingBrowser?: any; existingContext?: any; existingPage?: any; tempDir: string; testFolderPath?: string[]; runPomDenormalized?: boolean; afterEndTest?: (status: 'passed' | 'failed', error: string | undefined, page: any, siteLearnings?: any, debugStats?: any) => Promise; } /** * Test file execution response - results for each test in the file */ export interface TestFileExecutionResponse { success: boolean; testResults: Array<{ testPathway: TestPathway; jobId: string; status: TestExecutionStatus; error?: string; executionTime: number; }>; executionTime: number; error?: string; updatedScript?: string; } //# sourceMappingURL=types.d.ts.map