self-healing-playwright
Version:
Self-healing locators for Playwright tests using AI-powered healing strategies
45 lines (44 loc) • 1.07 kB
TypeScript
export type HealingStrategy = "text" | "role" | "xpath" | "css" | "custom";
export interface SelfHealingConfig {
groqApiKey: string;
healingStrategies?: HealingStrategy[];
confidenceThreshold?: number;
maxRetries?: number;
retryInterval?: number;
cacheEnabled?: boolean;
cacheTTL?: number;
maxCacheSize?: number;
debug?: boolean;
reportPath?: string;
cacheResults?: boolean;
excludePatterns?: string[];
includePatterns?: string[];
}
export interface FailureContext {
originalLocator: string;
testFile: string;
lineNumber: number;
domSnapshot: string;
page: any;
error?: Error;
}
export interface HealingResult {
success: boolean;
newLocator: string;
originalLocator: string;
context: FailureContext;
confidence: number;
strategy: string;
}
export interface CacheEntry {
locator: string;
context: FailureContext;
timestamp: number;
hits: number;
}
export interface CacheStats {
size: number;
hits: number;
misses: number;
hitRate: number;
}