50 lines
1.5 KiB
TypeScript
Executable file
50 lines
1.5 KiB
TypeScript
Executable file
/**
|
|
* Visual Regression Testing Utilities
|
|
*
|
|
* Provides baseline management, comparison, and diff generation for
|
|
* visual regression testing with Playwright. Uses Playwright's built-in
|
|
* screenshot comparison capabilities with custom baseline management.
|
|
*
|
|
* This file serves as the main entry point. Individual modules are organized by feature:
|
|
*
|
|
* - types.ts: TypeScript interfaces and threshold presets
|
|
* - config.ts: Configuration and baseline management
|
|
* - comparison.ts: Core comparison functions
|
|
* - cleanup.ts: Baseline and diff cleanup utilities
|
|
* - viewport.ts: Responsive testing utilities
|
|
*
|
|
* Features:
|
|
* - Baseline screenshot management
|
|
* - Pixel-perfect and fuzzy comparison
|
|
* - Diff image generation
|
|
* - Configurable thresholds
|
|
* - Multi-browser baseline support
|
|
* - Test isolation and cleanup
|
|
*
|
|
* @module utils/visual-regression
|
|
*
|
|
* @example Basic usage
|
|
* ```ts
|
|
* import { expectMatchesBaseline } from '@/utils/visual-regression'
|
|
*
|
|
* test('homepage visual regression', async ({ page }) => {
|
|
* await page.goto('/')
|
|
* await expectMatchesBaseline(page, 'homepage')
|
|
* })
|
|
* ```
|
|
*
|
|
* @example With custom threshold
|
|
* ```ts
|
|
* await expectMatchesBaseline(page, 'animation-frame', {
|
|
* threshold: 0.1, // 10% pixel difference allowed
|
|
* maxDiffPixels: 100
|
|
* })
|
|
* ```
|
|
*/
|
|
|
|
// Re-export all public APIs
|
|
export * from './visual-regression/types'
|
|
export * from './visual-regression/config'
|
|
export * from './visual-regression/comparison'
|
|
export * from './visual-regression/cleanup'
|
|
export * from './visual-regression/viewport'
|