/** * QA360 Visual Regression Testing * * Compares screenshots against baselines to detect visual changes. * Uses pixel diffing with configurable thresholds. */ export interface VisualRegressionConfig { /** Directory to store baseline images */ baselineDir?: string; /** Directory to store actual images */ actualDir?: string; /** Directory to store diff images */ diffDir?: string; /** Maximum allowed pixel difference (0-1) */ maxDiffThreshold?: number; /** Maximum allowed different pixels (0-1) */ maxDifferentPixels?: number; /** Whether to update baselines */ updateBaselines?: boolean; /** Whether to ignore anti-aliasing differences */ ignoreAntiAliasing?: boolean; /** Color to highlight differences */ diffColor?: { r: number; g: number; b: number; }; } export interface VisualRegressionResult { name: string; status: 'pass' | 'fail' | 'updated'; diffPixels: number; diffPercentage: number; diffImagePath?: string; baselinePath: string; actualPath: string; error?: string; } export interface ScreenshotData { width: number; height: number; data: Buffer; } /** * Visual Regression Tester * * Captures screenshots and compares them against baseline images. */ export declare class VisualRegressionTester { private baselineDir; private actualDir; private diffDir; private maxDiffThreshold; private maxDifferentPixels; private updateBaselines; private ignoreAntiAliasing; private diffColor; constructor(config?: VisualRegressionConfig); private ensureDirectories; /** * Compare a screenshot against baseline */ compare(name: string, screenshot: Buffer, width: number, height: number): Promise; /** * Compare two image buffers */ private compareBuffers; /** * Generate a diff image highlighting differences */ private generateDiffImage; /** * Get baseline file path for a test */ private getBaselinePath; /** * Get actual file path for a test */ private getActualPath; /** * Get diff file path for a test */ private getDiffPath; /** * Get hash of a screenshot for deduplication */ getScreenshotHash(screenshot: Buffer): string; /** * Clean up old actual screenshots */ cleanup(maxAge?: number): void; } /** * Create a visual regression tester */ export declare function createVisualRegressionTester(config?: VisualRegressionConfig): VisualRegressionTester; /** * Run visual regression tests */ export declare function runVisualRegressionTests(tests: Array<{ name: string; screenshot: Buffer; width: number; height: number; }>, config?: VisualRegressionConfig): Promise<{ results: VisualRegressionResult[]; summary: { total: number; passed: number; failed: number; updated: number; }; }>;