UNPKG

3.07 kBTypeScriptView Raw
1/// <reference types="node" resolution-mode="require"/>
2/// <reference types="node" resolution-mode="require"/>
3import type { EventEmitter } from 'node:events';
4import type { Options, Capabilities } from '@wdio/types';
5import type { WebDriverResponse } from './request/index.js';
6import type { Client, JSONWPCommandError, SessionFlags } from './types.js';
7/**
8 * start browser session with WebDriver protocol
9 */
10export declare function startWebDriverSession(params: Options.WebDriver): Promise<{
11 sessionId: string;
12 capabilities: Capabilities.DesiredCapabilities;
13}>;
14/**
15 * check if WebDriver requests was successful
16 * @param {number} statusCode status code of request
17 * @param {Object} body body payload of response
18 * @return {Boolean} true if request was successful
19 */
20export declare function isSuccessfulResponse(statusCode?: number, body?: WebDriverResponse): boolean;
21/**
22 * creates the base prototype for the webdriver monad
23 */
24export declare function getPrototype({ isW3C, isChromium, isFirefox, isMobile, isSauce, isSeleniumStandalone }: Partial<SessionFlags>): Record<string, PropertyDescriptor>;
25/**
26 * helper method to determine the error from webdriver response
27 * @param {Object} body body object
28 * @return {Object} error
29 */
30export declare function getErrorFromResponseBody(body: any, requestOptions: any): Error;
31export declare class CustomRequestError extends Error {
32 constructor(body: WebDriverResponse, requestOptions: any);
33}
34/**
35 * return all supported flags and return them in a format so we can attach them
36 * to the instance protocol
37 * @param {Object} options driver instance or option object containing these flags
38 * @return {Object} prototype object
39 */
40export declare function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSauce, isSeleniumStandalone, isBidi, isChromium }: Partial<SessionFlags>): PropertyDescriptorMap;
41/**
42 * Decorate the client's options object with host updates based on the presence of
43 * directConnect capabilities in the new session response. Note that this
44 * mutates the object.
45 * @param {Client} params post-new-session client
46 */
47export declare function setupDirectConnect(client: Client): void;
48/**
49 * get human readable message from response error
50 * @param {Error} err response error
51 */
52export declare const getSessionError: (err: JSONWPCommandError, params?: Partial<Options.WebDriver>) => string;
53/**
54 * return timeout error with information about the executing command on which the test hangs
55 */
56export declare const getTimeoutError: (error: Error, requestOptions: Options.RequestLibOptions) => Error;
57/**
58 * Enhance the monad with WebDriver Bidi primitives if a connection can be established successfully
59 * @param socketUrl url to bidi interface
60 * @returns prototype with interface for bidi primitives
61 */
62export declare function initiateBidi(socketUrl: string, strictSSL?: boolean): PropertyDescriptorMap;
63export declare function parseBidiMessage(this: EventEmitter, data: Buffer): void;
64//# sourceMappingURL=utils.d.ts.map
\No newline at end of file