52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
import "cypress-plugin-snapshots/commands";
|
|
|
|
declare global {
|
|
namespace Cypress {
|
|
interface MatchSnapshotOptions {
|
|
/** Custom name for the snapshot */
|
|
name?: string;
|
|
/** Save snapshot as JSON instead of plain text */
|
|
json?: boolean;
|
|
/** Timeout in milliseconds */
|
|
timeout?: number;
|
|
}
|
|
|
|
interface MatchImageSnapshotOptions {
|
|
/** Custom name for the image snapshot */
|
|
name?: string;
|
|
/** Mismatch threshold for considering images different */
|
|
threshold?: number;
|
|
/** Type of threshold comparison */
|
|
thresholdType?: "pixel" | "percent";
|
|
/** Direction of the difference detection */
|
|
diffDirection?: "horizontal" | "vertical";
|
|
/** Allow different image sizes */
|
|
allowSizeMismatch?: boolean;
|
|
/** Custom configuration for pixelmatch */
|
|
customDiffConfig?: Record<string, unknown>;
|
|
/** Path to custom snapshots directory */
|
|
customSnapshotsDir?: string;
|
|
/** Path to custom diffs directory */
|
|
customDiffDir?: string;
|
|
/** Capture mode */
|
|
capture?: "viewport" | "fullPage" | "runner";
|
|
}
|
|
|
|
interface Chainable {
|
|
/**
|
|
* Take a text-based snapshot and compare with a baseline
|
|
* @param name - Name of the snapshot (optional)
|
|
* @param options - Snapshot options
|
|
*/
|
|
toMatchSnapshot(name?: string, options?: MatchSnapshotOptions): Chainable;
|
|
|
|
/**
|
|
* Take an image snapshot and compare with a baseline
|
|
* @param name - Name of the snapshot (optional)
|
|
* @param options - Image snapshot options
|
|
*/
|
|
toMatchImageSnapshot(name?: string, options?: MatchImageSnapshotOptions): Chainable;
|
|
}
|
|
}
|
|
}
|