/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import * as playwright from 'playwright'; import type { FullConfig } from './config.js'; import type { CDPRelay } from './cdp-relay.js'; export declare function contextFactory(browserConfig: FullConfig['browser'], { forceCdp, cdpRelay }?: { forceCdp?: boolean; cdpRelay?: CDPRelay; }): BrowserContextFactory; export interface BrowserContextFactory { createContext(): Promise<{ browserContext: playwright.BrowserContext; close: () => Promise; }>; } export declare class BaseContextFactory implements BrowserContextFactory { readonly browserConfig: FullConfig['browser']; protected _browserPromise: Promise | undefined; readonly name: string; constructor(name: string, browserConfig: FullConfig['browser']); protected _obtainBrowser(): Promise; protected _doObtainBrowser(): Promise; createContext(): Promise<{ browserContext: playwright.BrowserContext; close: () => Promise; }>; protected _doCreateContext(browser: playwright.Browser): Promise; private _closeBrowserContext; } export declare class ElectronContextFactory extends BaseContextFactory { constructor(browserConfig: FullConfig['browser']); protected _doObtainBrowser(): Promise; protected _doCreateContext(browser: playwright.Browser): Promise; }