playwright-performance-reporter
Version:
Measure and publish performance metrics from browser dev-tools when running playwright
73 lines (72 loc) • 2.04 kB
TypeScript
import { type BrowserClient } from '../client.js';
import { type SupportedBrowsers, type HookOrder, type TargetMetric, type ChromiumMetricObserver } 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: ChromiumMetricObserver, 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 or observer
* @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;
}