testplane
Version:
Tests framework based on mocha and wdio
62 lines (61 loc) • 2.41 kB
TypeScript
import * as history from "./history";
import { Config } from "../config";
import { AsyncEmitter } from "../events";
import { BrowserConfig } from "../config/browser-config";
import type { Callstack } from "./history/callstack";
import type { WdProcess, WebdriverPool } from "../browser-pool/webdriver-pool";
export type BrowserOpts = {
id: string;
version?: string;
state?: Record<string, unknown>;
emitter: AsyncEmitter;
wdPool?: WebdriverPool;
};
export type BrowserState = {
testXReqId?: string;
traceparent?: string;
isBroken?: boolean;
isLastTestFailed?: boolean;
};
export type CustomCommand = {
name: string;
elementScope: boolean;
};
export declare class Browser {
protected _emitter: AsyncEmitter;
protected _config: BrowserConfig;
protected _debug: boolean;
protected _session: WebdriverIO.Browser | null;
protected _callstackHistory: Callstack | null;
protected _state: BrowserState;
protected _customCommands: Set<CustomCommand>;
protected _wdPool?: WebdriverPool;
protected _wdProcess: WdProcess | null;
/** This Promise is awaited after test is finished. Can be used for cleanup.
Right now is used to wait for time travel snapshots to finish collecting */
protected _snapshotsPromiseRef: history.PromiseRef;
id: string;
version?: string;
static create<T extends Browser>(this: new (config: Config, opts: BrowserOpts) => T, config: Config, opts: BrowserOpts): T;
constructor(config: Config, opts: BrowserOpts);
setHttpTimeout(timeout: number | null): void;
restoreHttpTimeout(): void;
applyState(state: Record<string, unknown>): void;
protected _addCommands(): void;
protected _addSteps(): void;
protected _extendStacktrace(): void;
protected _addHistory(): void;
protected _addExtendOptionsMethod(session: WebdriverIO.Browser): void;
protected _getSessionOptsFromConfig(optNames?: string[]): Record<string, unknown>;
protected _startCollectingCustomCommands(): void;
get fullId(): string;
get publicAPI(): WebdriverIO.Browser;
get sessionId(): string;
get config(): BrowserConfig;
get state(): BrowserState;
get capabilities(): WebdriverIO.Capabilities;
get callstackHistory(): Callstack;
get snapshotsPromiseRef(): history.PromiseRef;
get customCommands(): CustomCommand[];
get emitter(): AsyncEmitter;
}