import type { TraceEvent } from '@tracerbench/trace-event'; import type { CDPSession } from 'puppeteer-core/lib/esm/puppeteer/api/CDPSession.js'; import type { Page } from 'puppeteer-core/lib/esm/puppeteer/api/Page.js'; import type { TracingOptions } from 'puppeteer-core/lib/esm/puppeteer/cdp/Tracing.js'; import type { RequestPayload } from './handler/network.js'; import type { DevtoolsConfig, EnablePerformanceAuditsOptions, GathererDriver, PWAAudits } from './types.js'; export default class CommandHandler { private _session; private _page; private _driver; private _options; private _browser; private _isTracing; private _networkHandler; private _traceEvents?; private _shouldRunPerformanceAudits; private _cacheEnabled?; private _cpuThrottling?; private _networkThrottling?; private _formFactor?; private _traceGatherer?; private _devtoolsGatherer?; private _pwaGatherer?; constructor(_session: CDPSession, _page: Page, _driver: GathererDriver, _options: DevtoolsConfig, _browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser); /** * Start tracing the browser. You can optionally pass in custom tracing categories and the * sampling frequency. */ startTracing({ categories, path, screenshots }?: TracingOptions): Promise; /** * Stop tracing the browser. */ endTracing(): Promise; /** * Returns the tracelogs that was captured within the tracing period. * You can use this command to store the trace logs on the file system to analyse the trace * via Chrome DevTools interface. */ getTraceLogs(): TraceEvent[] | undefined; /** * Returns page weight information of the last page load. */ getPageWeight(): { pageWeight: number; transferred: number; requestCount: number; details: { Document?: RequestPayload | undefined; Stylesheet?: RequestPayload | undefined; Image?: RequestPayload | undefined; Media?: RequestPayload | undefined; Font?: RequestPayload | undefined; Script?: RequestPayload | undefined; TextTrack?: RequestPayload | undefined; XHR?: RequestPayload | undefined; Fetch?: RequestPayload | undefined; Prefetch?: RequestPayload | undefined; EventSource?: RequestPayload | undefined; WebSocket?: RequestPayload | undefined; Manifest?: RequestPayload | undefined; SignedExchange?: RequestPayload | undefined; Ping?: RequestPayload | undefined; CSPViolationReport?: RequestPayload | undefined; Preflight?: RequestPayload | undefined; FedCM?: RequestPayload | undefined; Other?: RequestPayload | undefined; }; }; /** * set flag to run performance audits for page transitions */ enablePerformanceAudits({ networkThrottling, cpuThrottling, cacheEnabled, formFactor }?: EnablePerformanceAuditsOptions): void; /** * custom command to disable performance audits */ disablePerformanceAudits(): void; /** * helper method to set throttling profile */ setThrottlingProfile(networkThrottling?: "online" | "offline" | "GPRS" | "Regular 2G" | "Good 2G" | "Regular 3G" | "Good 3G" | "Regular 4G" | "DSL" | "Wifi", cpuThrottling?: number, cacheEnabled?: boolean): Promise; checkPWA(auditsToBeRun?: PWAAudits[]): Promise; private _propagateWSEvents; _initCommand(): Promise; _beforeCmd(commandName: string, params: unknown[]): Promise | undefined; _afterCmd(commandName: string): Promise | undefined; } //# sourceMappingURL=commands.d.ts.map