testplane
Version:
Tests framework based on mocha and wdio
66 lines (65 loc) • 3.28 kB
TypeScript
import { Browser, BrowserOpts } from "./browser";
import { Camera, CaptureViewportImageOpts } from "./camera";
import { ClientBridge } from "./client-bridge";
import { Config } from "../config";
import { Image } from "../image";
import type { CalibrationResult, Calibrator } from "./calibrator";
import type { SessionOptions } from "./types";
import { Page } from "puppeteer-core";
import { CDP } from "./cdp";
import { WSDriverRequestAgent } from "./wsdriver";
import type * as browserSideUtilsImplementation from "./client-scripts/browser-utils/implementation";
interface ScrollByParams {
x: number;
y: number;
selector?: string;
}
export declare const getActivePuppeteerPage: (session: WebdriverIO.Browser) => Promise<Page | undefined>;
export declare class ExistingBrowser extends Browser {
protected _camera: Camera;
protected _meta: Record<string, unknown>;
protected _calibration?: CalibrationResult;
protected _browserSideUtils?: ClientBridge<typeof browserSideUtilsImplementation>;
protected _cdp: CDP | null;
protected _wsDriver: WSDriverRequestAgent | null;
protected _tags: Set<string>;
constructor(config: Config, opts: BrowserOpts);
init({ sessionId, sessionCaps, sessionOpts }: SessionOptions, calibrator: Calibrator): Promise<this>;
markAsBroken({ stubBrowserCommands }?: {
stubBrowserCommands?: boolean | undefined;
}): void;
quit(): void;
open(url: string): Promise<WebdriverIO.Request | string | void>;
evalScript<T>(script: string): Promise<T>;
injectScript(script: string): Promise<unknown>;
get shouldUsePixelRatio(): boolean;
get isWebdriverProtocol(): boolean;
get needsCompatLib(): boolean;
captureViewportImage(opts?: CaptureViewportImageOpts): Promise<Image>;
scrollBy(params: ScrollByParams): Promise<void>;
protected _attachSession({ sessionId, sessionCaps, sessionOpts, }: SessionOptions): Promise<WebdriverIO.Browser>;
protected _initMeta(): Record<string, unknown>;
protected _takeScreenshot(): Promise<string>;
protected _addCommands(): void;
protected _overrideGetElementsList(session: WebdriverIO.Browser): void;
protected _addMetaAccessCommands(session: WebdriverIO.Browser): void;
protected _decorateUrlMethod(session: WebdriverIO.Browser): void;
protected _resolveUrl(uri: string): string;
protected _performBidiIsolation(sessionOpts: SessionOptions["sessionOpts"]): Promise<void>;
protected _performCdpIsolation(sessionOpts: SessionOptions["sessionOpts"]): Promise<void>;
protected _performIsolation({ sessionCaps, sessionOpts, }: Pick<SessionOptions, "sessionCaps" | "sessionOpts">): Promise<void>;
protected _prepareSession(): Promise<void>;
protected _setOrientation(orientation: string | null): Promise<void>;
protected _setWindowSize(size: {
width: number;
height: number;
} | `${number}x${number}` | null): Promise<void>;
protected _performCalibration(calibrator: Calibrator): Promise<void>;
protected _initBrowserSideUtils(): Promise<ClientBridge<typeof browserSideUtilsImplementation>>;
_stubCommands(): void;
get meta(): Record<string, unknown>;
get tags(): string[];
get cdp(): CDP | null;
get camera(): Camera;
}
export {};