UNPKG

playwright-performance-reporter

Version:

Measure and publish performance metrics from browser dev-tools when running playwright

83 lines (82 loc) 2.32 kB
import { type BrowserClient } from '../client.js'; import { type SupportedBrowsers, type ChromiumSupportedMetrics, type MetricObserver, type HookOrder, type TargetMetric } from '../../types/index.js'; export declare class ChromiumDevelopmentTools implements BrowserClient { private readonly options; /** * Chrome dev tools protocol client */ private readonly clients; /** * Chrome dev tools target for metadata extraction */ private readonly targets; /** * Lock to indicate if connection request is going on */ private readonly connectLock; /** * Indicates if all options are correctly set for connection */ private areClientOptionsValid; /** * @inheritdoc */ constructor(options: Record<string, any>); /** * @inheritdoc */ connect(): Promise<void>; /** * @inheritdoc */ getMetric(metric: ChromiumSupportedMetrics, hookOrder: HookOrder): Promise<TargetMetric[]>; /** * @inheritdoc */ runCustomObserver(customMetric: MetricObserver, hookOrder: HookOrder): Promise<TargetMetric[]>; /** * Cleans up client connection. * If `targetId` is not provided, then all clients are destroyed. * * @param {string=} targetId id to indicate which client to destroy */ destroy(targetId?: string): Promise<void>; /** * @inheritdoc */ getBrowserName(): SupportedBrowsers; /** * Fetch metric for a target * * @param targetId target to fill * @param targetMetric mapping of all targets * @param metric type of metric * @param hookOrder hook order */ private runPredefinedMetricFetch; /** * Builds options object to use for CDP * * @param {string=} targetId id to specify target to run CDP on */ private buildOptions; /** * Check client to target and create new connection if not available * * @param target reference to run CDP commands on */ private connectToTarget; /** * Runs every plugin for a metric. * * @param targetId target to fill * @param metric */ private runPlugins; /** * Provide observer to collect metric * * @param metric observer to create */ private mapMetric; }