@puberty-labs/clits
Version:
CLiTS (Chrome Logging and Inspection Tool Suite) is a powerful Node.js library for automated Chrome browser testing, logging, and inspection. It provides a comprehensive suite of tools for monitoring network requests, console logs, DOM mutations, and more
141 lines (140 loc) • 3.59 kB
TypeScript
export interface VisionOptions {
screenshot?: boolean;
selector?: string;
selectors?: string;
output?: string;
outputDir?: string;
meta?: string;
fullpage?: boolean;
base64?: boolean;
stdout?: boolean;
includeText?: boolean;
includeStyles?: boolean;
includeBbox?: boolean;
includeVisibility?: boolean;
chromeHost?: string;
chromePort?: number;
timeout?: number;
diff?: boolean;
baseline?: string;
compareWith?: string;
diffThreshold?: string;
diffOutput?: string;
diffReport?: string;
saveBaseline?: boolean;
batchDiff?: boolean;
video?: boolean;
videoOutput?: string;
videoDuration?: string;
videoFps?: string;
highlight?: boolean;
highlightColor?: string;
highlightThickness?: string;
highlightAllClickable?: boolean;
annotateText?: boolean;
}
export interface ElementInfo {
selector: string;
exists: boolean;
visible: boolean;
boundingBox?: {
x: number;
y: number;
width: number;
height: number;
top: number;
left: number;
right: number;
bottom: number;
};
textContent?: string;
computedStyles?: Record<string, string>;
screenshotPath?: string;
screenshotBase64?: string;
error?: string;
}
export interface VisionResult {
timestamp: string;
source: string;
fullPageScreenshot?: {
path?: string;
base64?: string;
};
elements: ElementInfo[];
diffAnalysis?: {
hasDifferences: boolean;
pixelDifference: number;
percentageDifference: number;
diffImagePath?: string;
baselineUsed?: string;
comparisonImage?: string;
threshold: number;
regions?: Array<{
x: number;
y: number;
width: number;
height: number;
significance: number;
}>;
};
videoCapture?: {
path?: string;
duration: number;
fps: number;
frames: number;
size: {
width: number;
height: number;
};
format: string;
};
highlighting?: {
elementsHighlighted: number;
highlightColor: string;
thickness: number;
annotatedElements?: Array<{
selector: string;
text: string;
coordinates: {
x: number;
y: number;
};
}>;
};
metadata: {
version: string;
platform: string;
chromeHost: string;
chromePort: number;
totalElements: number;
successfulCaptures: number;
options: VisionOptions;
};
}
export declare class VisionHandler {
private static readonly DEFAULT_PORT;
private static readonly DEFAULT_HOST;
private static readonly DEFAULT_TIMEOUT;
private port;
private host;
private chromeAutomation;
constructor(port?: number, host?: string);
execute(options: VisionOptions): Promise<void>;
private captureVisualState;
private parseSelectors;
private takeFullPageScreenshot;
private captureElements;
private captureElement;
private getElementData;
private takeElementScreenshot;
private generateOutputPath;
private ensureDirectoryExists;
private getCurrentPageUrl;
private outputResults;
private startVideoRecording;
private stopVideoRecording;
private addHighlighting;
private getClickableElements;
private performVisualDiff;
private saveAsBaseline;
}