import type * as pw from 'playwright-core'; declare type PropType = TObj[TProp]; declare type PluginEnv = { framework: 'playwright'; }; /** Strongly typed plugin lifecycle events for internal use */ export declare abstract class PluginLifecycleMethods { onPluginRegistered(env?: PluginEnv): Promise; beforeLaunch(options: pw.LaunchOptions): Promise; afterLaunch(browserOrContext?: pw.Browser | pw.BrowserContext): Promise; beforeConnect(options: pw.ConnectOptions): Promise; afterConnect(browser: pw.Browser): Promise; onBrowser(browser: pw.Browser): Promise; onPageCreated(page: pw.Page): Promise; onPageClose(page: pw.Page): Promise; onDisconnected(browser?: pw.Browser): Promise; beforeContext(options?: pw.BrowserContextOptions, browser?: pw.Browser): Promise; onContextCreated(context?: pw.BrowserContext, options?: pw.BrowserContextOptions): Promise; } /** A valid plugin method name */ export declare type PluginMethodName = keyof PluginLifecycleMethods; /** A valid plugin method function */ export declare type PluginMethodFn = PropType; declare type PluginRequirements = Set<'launch' | 'headful' | 'dataFromPlugins' | 'runLast'>; declare type PluginDependencies = Set | Map | string[]; interface PluginData { name: string | { [key: string]: any; }; value: { [key: string]: any; }; } export interface CompatiblePluginLifecycleMethods { onPluginRegistered(...any: any[]): Promise | any; beforeLaunch(...any: any[]): Promise | any; afterLaunch(...any: any[]): Promise | any; beforeConnect(...any: any[]): Promise | any; afterConnect(...any: any[]): Promise | any; onBrowser(...any: any[]): Promise | any; onPageCreated(...any: any[]): Promise | any; onPageClose(...any: any[]): Promise | any; onDisconnected(...any: any[]): Promise | any; beforeContext(...any: any[]): Promise | any; onContextCreated(...any: any[]): Promise | any; } /** * PuppeteerExtraPlugin interface, strongly typed for internal use * @private */ export interface PuppeteerExtraPlugin extends Partial { _isPuppeteerExtraPlugin: boolean; name: string; /** Disable the puppeteer compatibility shim for this plugin */ noPuppeteerShim?: boolean; requirements?: PluginRequirements; dependencies?: PluginDependencies; data?: PluginData[]; getDataFromPlugins?(name?: string): void; _registerChildClassMembers?(prototype: any): void; _childClassMembers?: string[]; plugins?: CompatiblePlugin[]; } /** * Minimal compatible PuppeteerExtraPlugin interface * @private */ export interface CompatiblePuppeteerPlugin extends Partial { _isPuppeteerExtraPlugin: boolean; name?: string; } export interface CompatiblePlaywrightPlugin extends Partial { _isPlaywrightExtraPlugin: boolean; name?: string; } export interface CompatibleExtraPlugin extends Partial { _isExtraPlugin: boolean; name?: string; } /** * A compatible plugin */ export declare type CompatiblePlugin = CompatiblePuppeteerPlugin | CompatiblePlaywrightPlugin | CompatibleExtraPlugin; export declare type CompatiblePluginModule = (...args: any[]) => CompatiblePlugin; export declare type Plugin = PuppeteerExtraPlugin; export declare type PluginModule = (...args: any[]) => Plugin; export {};