jpglens
Version:
🔍 Universal AI-Powered UI Testing - See your interfaces through the lens of intelligence
102 lines • 3.33 kB
TypeScript
/**
* 🔍 jpglens - Playwright Integration
* Universal AI-Powered UI Testing
*
* @author Taha Bahrami (Kaito)
* @license MIT
*/
type Page = any;
import { AnalysisContext, AnalysisResult, UserJourney, JPGLensConfig } from '../core/types.js';
/**
* Playwright integration for jpglens AI analysis
* Extends Playwright tests with contextual AI insights
*/
export declare class PlaywrightJPGLens {
private page;
private aiAnalyzer;
private screenshotCapture;
private config;
constructor(page: Page, config?: JPGLensConfig);
static create(page: Page, config?: JPGLensConfig): Promise<PlaywrightJPGLens>;
/**
* Analyze current page state with user context
*/
analyzeUserJourney(context: AnalysisContext): Promise<AnalysisResult>;
/**
* Analyze current state after user actions
*/
analyzeCurrentState(context: Partial<AnalysisContext>): Promise<AnalysisResult>;
/**
* Analyze a complete user journey with multiple stages
*/
analyzeCompleteJourney(journey: UserJourney): Promise<AnalysisResult[]>;
/**
* Execute user actions for a journey stage
*/
private executeUserActions;
/**
* Enhance analysis context with page information
*/
private enhanceContextWithPageInfo;
/**
* Detect JavaScript frameworks on the page
*/
private detectFrameworks;
/**
* Detect design system or UI library
*/
private detectDesignSystem;
/**
* Wait for page to be ready for analysis
*/
waitForPageReady(): Promise<void>;
/**
* Set up optimal conditions for screenshot analysis
*/
prepareForAnalysis(): Promise<void>;
}
/**
* Convenience function to create jpglens analyzer for Playwright page
*/
export declare function createJPGLens(page: Page, config?: JPGLensConfig): PlaywrightJPGLens;
/**
* Global function to analyze user journey (for easier integration)
*/
export declare function analyzeUserJourney(page: Page, context: AnalysisContext): Promise<AnalysisResult>;
/**
* Global function to analyze current state (for easier integration)
*/
export declare function analyzeCurrentState(page: Page, context: Partial<AnalysisContext>): Promise<AnalysisResult>;
/**
* Global function to analyze complete journey (for easier integration)
*/
export declare function analyzeCompleteJourney(page: Page, journey: UserJourney): Promise<AnalysisResult[]>;
/**
* Main Playwright analyze function (for backward compatibility)
* This is the function that was missing from exports
*/
export declare function playwrightAnalyze(page: Page, options?: {
screenshot?: Buffer;
component?: string;
stage?: string;
userIntent?: string;
userContext?: any;
context?: Partial<AnalysisContext>;
}): Promise<AnalysisResult>;
/**
* Analyze current page state (alias for playwrightAnalyze)
*/
export declare function playwrightAnalyzeState(page: Page, options?: {
screenshot?: Buffer;
component?: string;
stage?: string;
userIntent?: string;
userContext?: any;
context?: Partial<AnalysisContext>;
}): Promise<AnalysisResult>;
/**
* Quick analyze function with minimal configuration
*/
export declare function quickAnalyze(page: Page, component?: string): Promise<AnalysisResult>;
export {};
//# sourceMappingURL=playwright.d.ts.map