/** * failure-handler.ts * * Coordinates all the activities that happen when a test step fails: * screenshot capture, DOM snapshot, step context update, and healing. * * When the Executor catches an error on a step, it hands control here. * The FailureHandler: * 1. Takes a screenshot of the current page state. * 2. Captures the full DOM snapshot as an HTML file on disk. * 3. Updates the saved StepContext to reflect the failure details. * 4. Delegates to HealingEngine to try finding an alternative locator. * 5. If healing succeeds, updates the StepContext to "healed". * 6. Returns the HealingResult to the caller (Executor) so it can decide * whether to retry with the repaired locator or move on. * * Role in the overall flow: * Executor → FailureHandler.handle() → HealingEngine → HealingResult */ import { Page } from 'playwright'; import { ElementContext, HealingResult, TestIntent } from '../types'; /** * Handles step failures: captures diagnostic artifacts, updates step state, * and attempts local self-healing. */ export declare class FailureHandler { private healingEngine; private screenshotManager; private pageObserver; private contextManager; private snapshotsDir; /** * @param artifactsDir - Root directory where screenshots, DOM snapshots, and * step context files are written. */ constructor(artifactsDir: string); /** * React to a step failure: capture artifacts, persist the failure state, and * attempt healing. * * @param page - The live Playwright page at the time of failure. * @param intent - The TestIntent being executed (used for context lookups). * @param stepIndex - Zero-based index of the failed step. * @param stepDescription - Human-readable description of what the step was trying to do. * @param locatorUsed - The locator expression that failed. * @param error - The error thrown by Playwright. * @param elementContext - Optional stored element metadata from the Page Object, * used by the healing engine to find alternative locators. * @returns A HealingResult indicating whether a repaired locator was found and * which strategy (if any) was successful. */ handle(page: Page, intent: TestIntent, stepIndex: number, stepDescription: string, locatorUsed: string, error: Error, elementContext?: ElementContext): Promise; } //# sourceMappingURL=failure-handler.d.ts.map