self-healing-playwright
Version:
Self-healing locators for Playwright tests using AI-powered healing strategies
65 lines (64 loc) • 1.58 kB
TypeScript
import { Page } from 'playwright';
export interface FailureContext {
error: Error;
domSnapshot: string;
testFile: string;
lineNumber: number;
originalLocator: string;
pageState: {
url: string;
title: string;
timestamp: string;
};
page: Page;
}
export interface HealingResult {
success: boolean;
newLocator: string;
originalLocator: string;
context: FailureContext;
confidence: number;
strategy: 'cache' | 'pattern' | 'ai';
}
export interface SelfHealingConfig {
groqApiKey: string;
healingStrategies: ('text' | 'role' | 'xpath' | 'css' | 'custom')[];
confidenceThreshold: number;
maxRetries: number;
debug: boolean;
reportPath: string;
cacheResults: boolean;
excludePatterns: string[];
includePatterns: string[];
}
export interface LocatorHistory {
id: string;
originalLocator: string;
healedLocator: string;
testFile: string;
lineNumber: number;
timestamp: string;
confidence: number;
success: boolean;
domSnapshot: string;
context: string;
healingStrategy: string;
}
export interface ElementPatterns {
id: string;
elementType: string;
attributes: string;
successfulLocators: string[];
failureCount: number;
successCount: number;
lastUpdated: string;
}
export interface StorageConfig {
databasePath: string;
cacheTTL: number;
maxCacheSize: number;
cleanupInterval: number;
backupEnabled: boolean;
backupPath: string;
backupFrequency: 'daily' | 'weekly' | 'monthly';
}