@wdio/browserstack-service
Version:
WebdriverIO service for better Browserstack integration
148 lines • 4.71 kB
TypeScript
import { BStackLogger } from './cliLogger.js';
import type { ChildProcess } from 'node:child_process';
import type { StartBinSessionResponse } from '@browserstack/wdio-browserstack-service';
import type BaseModule from './modules/baseModule.js';
import type { Options } from '@wdio/types';
import WdioMochaTestFramework from './frameworks/wdioMochaTestFramework.js';
import WdioAutomationFramework from './frameworks/wdioAutomationFramework.js';
import type { BrowserstackConfig, BrowserstackOptions } from '../types.js';
/**
* BrowserstackCLI - Singleton class for managing CLI operations
*
* This class uses the singleton pattern to ensure only one instance exists
* throughout the application lifecycle.
*/
export declare class BrowserstackCLI {
#private;
static enabled: boolean;
initialized: boolean;
config: Record<string, unknown>;
wdioConfig: string;
cliArgs: object;
browserstackConfig: Options.Testrunner | {};
process: ChildProcess | null;
isMainConnected: boolean;
isChildConnected: boolean;
binSessionId: string | null;
modules: Record<string, BaseModule>;
testFramework: WdioMochaTestFramework | null;
cliParams: Record<string, string> | null;
automationFramework: WdioAutomationFramework | null;
SDK_CLI_BIN_PATH: string | null;
logger: typeof BStackLogger;
options: BrowserstackConfig & BrowserstackOptions | {};
constructor();
/**
* Get the singleton instance of BrowserstackCLI
* @returns {BrowserstackCLI} The singleton instance
*/
static getInstance(): BrowserstackCLI;
/**
* Bootstrap the CLI
* Initializes and starts the CLI based on environment settings
* @returns {Promise<void>}
*/
bootstrap(options: BrowserstackConfig & BrowserstackOptions, config?: Options.Testrunner, wdioConfig?: string): Promise<void>;
/**
* Start as a main process
* @returns {Promise<void>}
*/
startMain(): Promise<void>;
/**
* Load modules
* @param {Object} startBinResponse - StartBinSession response
*/
loadModules(startBinResponse: StartBinSessionResponse): void;
/**
* Configure modules
* @returns {Promise<void>}
*/
configureModules(): Promise<void>;
/**
* Start the CLI process and return a promise that resolves when it's ready
* @returns {Promise<void>}
* @throws {Error} If the process fails to start
*/
start(): Promise<void>;
/**
* Stop the CLI
* @returns {Promise<void>}
*/
stop(): Promise<void>;
/**
* Unconfigure modules
* @returns {Promise<void>}
* @private
*/
unConfigureModules(): Promise<void>;
/**
* Load CLI parameters from the output
* @param {Object} params - Parameters parsed from CLI output
* @private
*/
loadCliParams(params: Record<string, string>): void;
/**
* Start as a child process with the specified binSessionId
* @param {string} binSessionId - session ID to connect to the CLI process
* @returns {Promise<void>}
*/
startChild(binSessionId: string): Promise<void>;
/**
* Check if the CLI is running
* @returns {boolean} True if the CLI is running
*/
isRunning(): boolean;
/**
* Get the Browserstack configuration
* @returns {Object} The Browserstack configuration
*/
getBrowserstackConfig(): {} | Options.Testrunner;
/**
* Set the Browserstack configuration
* @param {Object}
* @returns {void}
*/
setBrowserstackConfig(browserstackConfig: Options.Testrunner): void;
/**
* Get the CLI binary path
* @returns {string} The CLI binary path
*/
getCliBinPath(): Promise<string>;
/**
* Check if the CLI is enabled
* @returns {boolean} True if the CLI is enabled
*/
isCliEnabled(): boolean;
/**
* Get the configuration
* @returns {Object} The configuration
*/
getConfig(): Record<string, unknown>;
/**
* Set the configuration
* @param {Object}
* @returns {void}
*/
setConfig(response: StartBinSessionResponse): void;
/**
* Setup the test framework
* @returns {void}
*/
setupTestFramework(): void;
/**
* Setup the automation framework
* @returns {void}
*/
setupAutomationFramework(): void;
/**
* Get the test framework
* @returns {Object} The test framework
*/
getTestFramework(): WdioMochaTestFramework | null;
/**
* Get the automation framework
* @returns {Object} The automation framework
*/
getAutomationFramework(): WdioAutomationFramework | null;
}
//# sourceMappingURL=index.d.ts.map