/** * Visual Regression Tester (OWL-003) * * Compares screenshots to detect visual changes in web pages. * Integrates with workflow recording for end-to-end visual regression testing. * * Features: * - Baseline management (create, update, delete) * - Pixel-level comparison using pixelmatch * - Diff image generation for visual debugging * - Workflow integration for automated visual testing * - Configurable thresholds and ignore regions */ import type { VisualBaseline, VisualDiffResult, VisualRegressionTestResult, CaptureBaselineOptions, VisualCompareOptions, VisualRegressionTesterConfig, VisualRegressionEvent, WorkflowVisualTestConfig, WorkflowVisualTestResult } from '../types/visual-regression.js'; import type { Workflow } from '../types/workflow.js'; import type { Page } from 'playwright'; export declare class VisualRegressionTester { private config; private baselines; private eventListeners; constructor(config?: Partial); /** * Capture a baseline screenshot from a Playwright page */ captureBaseline(page: Page, url: string, options: CaptureBaselineOptions): Promise; /** * Capture a baseline from base64 image data (without Playwright) */ captureBaselineFromBase64(url: string, screenshotBase64: string, options: CaptureBaselineOptions): Promise; /** * Compare a new screenshot against a baseline */ compareWithBaseline(baselineId: string, newScreenshotBase64: string, options?: VisualCompareOptions): Promise; /** * Compare a new screenshot from Playwright page against a baseline */ testPage(page: Page, baselineId: string, options?: VisualCompareOptions & { waitBeforeCapture?: number; }): Promise; /** * Compare two images and return diff result */ compareImages(baselineBase64: string, newBase64: string, options?: VisualCompareOptions): Promise; /** * Test a workflow for visual regressions */ testWorkflow(workflow: Workflow, captureNewScreenshots: (stepNumber: number, url: string) => Promise, config: WorkflowVisualTestConfig): Promise; /** * Update an existing baseline with a new screenshot */ updateBaseline(baselineId: string, newScreenshotBase64: string): Promise; /** * Get a baseline by ID */ getBaseline(baselineId: string): VisualBaseline | undefined; /** * Get baselines for a URL */ getBaselinesForUrl(url: string): VisualBaseline[]; /** * Get baselines for a domain */ getBaselinesForDomain(domain: string): VisualBaseline[]; /** * Get baselines for a workflow */ getBaselinesForWorkflow(workflowId: string): VisualBaseline[]; /** * List all baselines */ listBaselines(): VisualBaseline[]; /** * Delete a baseline */ deleteBaseline(baselineId: string): Promise; /** * Add event listener */ on(callback: (event: VisualRegressionEvent) => void): void; /** * Remove event listener */ off(callback: (event: VisualRegressionEvent) => void): void; /** * Export baselines to JSON */ exportBaselines(): string; /** * Import baselines from JSON */ importBaselines(json: string): number; /** * Clean up old diff images */ cleanupDiffs(): Promise; private ensureDirectories; private loadBaselines; private saveBaseline; private getBaselineFilePath; private generateBaselineId; private generateTestId; private getWorkflowStepBaselineId; private enforceBaselineLimit; private hideElements; private emitEvent; } //# sourceMappingURL=visual-regression-tester.d.ts.map