/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ import * as webdriver from 'selenium-webdriver'; /** Tachometer browser names. Often but not always equal to WebDriver's. */ export declare type BrowserName = 'chrome' | 'firefox' | 'safari' | 'edge' | 'ie'; /** Browsers we can drive. */ export declare const supportedBrowsers: Set; /** Browsers for which we can find the first contentful paint (FCP) time. */ export declare const fcpBrowsers: Set; export interface BrowserConfig { /** Name of the browser. */ name: BrowserName; /** Whether to run in headless mode. */ headless: boolean; /** A remote WebDriver server to launch the browser from. */ remoteUrl?: string; /** Launch the browser window with these dimensions. */ windowSize: WindowSize; /** Path to custom browser binary. */ binary?: string; /** Additional binary arguments. */ addArguments?: string[]; /** WebDriver default binary arguments to omit. */ removeArguments?: string[]; /** CPU Throttling rate. (1 is no throttle, 2 is 2x slowdown, etc). */ cpuThrottlingRate?: number; /** Advanced preferences usually set from the about:config page. */ preferences?: { [name: string]: string | number | boolean; }; /** Trace browser performance logs configuration */ trace?: TraceConfig; /** Path to profile directory to use instead of the default fresh one. */ profile?: string; } /** * Configuration to turn on performance tracing */ export interface TraceConfig { /** * The tracing categories the browser should log */ categories: string[]; /** * The directory to log performance traces to */ logDir: string; } export interface WindowSize { width: number; height: number; } /** * Create a deterministic unique string key for the given BrowserConfig. */ export declare function browserSignature(config: BrowserConfig): string; declare type BrowserConfigWithoutWindowSize = Pick>; /** * Parse and validate a browser string specification. Examples: * * chrome * chrome-headless * chrome@ */ export declare function parseBrowserConfigString(str: string): BrowserConfigWithoutWindowSize; /** * Throw if any property of the given BrowserConfig is invalid. */ export declare function validateBrowserConfig({ name, headless, remoteUrl, windowSize, }: BrowserConfig): void; /** * Configure a WebDriver suitable for benchmarking the given browser. */ export declare function makeDriver(config: BrowserConfig): Promise; /** * Open a new tab and switch to it. Assumes that the driver is on a page that * hasn't replaced `window.open` (e.g. the initial blank tab that we always * switch back to after running a benchmark). */ export declare function openAndSwitchToNewTab(driver: webdriver.WebDriver, config: BrowserConfig): Promise; export {};