/** * Selector Healer * * Intelligently heals broken CSS selectors in UI/E2E tests. * Uses multiple strategies to find replacement selectors. */ import type { SelectorHealingResult, SelectorHealingStrategy, SelectorErrorType, SelfHealingConfig } from './types.js'; /** * Configuration for selector healing */ interface SelectorHealOptions { /** Page URL where selector failed */ pageUrl?: string; /** DOM snapshot at time of failure */ domSnapshot?: { title: string; url: string; html?: string; elements: Record; }; /** Error type that occurred */ errorType?: SelectorErrorType; /** Original selector that failed */ originalSelector: string; /** Expected element type (button, input, etc.) */ expectedType?: string; /** Text content the element should have */ expectedText?: string; /** Confidence threshold for healing */ confidenceThreshold?: number; } /** * Candidate replacement selector */ interface SelectorCandidate { selector: string; strategy: SelectorHealingStrategy; confidence: number; reason: string; } /** * Selector Healer class */ export declare class SelectorHealer { private config; constructor(config: SelfHealingConfig); /** * Attempt to heal a broken selector */ healSelector(options: SelectorHealOptions): Promise; /** * Try data-testid attribute strategies */ private tryDataTestIdStrategies; /** * Try ARIA label strategies */ private tryAriaLabelStrategies; /** * Try text content strategies */ private tryTextContentStrategies; /** * Try fuzzy matching strategies */ private tryFuzzyMatchStrategies; /** * Infer failure reason from error type */ private inferFailureReason; /** * Escape string for CSS selectors */ private escapeCssString; /** * Escape string for XPath */ private escapeXPathString; /** * Parse selector to understand its structure */ parseSelector(selector: string): { tag?: string; id?: string; classes: string[]; attributes: Record; pseudoClasses: string[]; combinators: string[]; }; /** * Generate multiple healing candidates for a selector */ generateHealingCandidates(selector: string, context?: Pick): Promise; /** * Remove duplicate candidates */ private deduplicateCandidates; } /** * Create a default self-healing config */ export declare function createDefaultSelfHealingConfig(): SelfHealingConfig; export {};