@wdio/browserstack-service 0.0.0-canary-20260722132416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-MIT +20 -0
- package/README.md +392 -0
- package/browserstack-service.d.ts +43 -0
- package/build/Percy/Percy-Handler.d.ts +32 -0
- package/build/Percy/Percy-Handler.d.ts.map +1 -0
- package/build/Percy/Percy-Handler.js +165 -0
- package/build/Percy/Percy-Handler.js.map +1 -0
- package/build/Percy/Percy.d.ts +19 -0
- package/build/Percy/Percy.d.ts.map +1 -0
- package/build/Percy/Percy.js +164 -0
- package/build/Percy/Percy.js.map +1 -0
- package/build/Percy/PercyBinary.d.ts +10 -0
- package/build/Percy/PercyBinary.d.ts.map +1 -0
- package/build/Percy/PercyBinary.js +161 -0
- package/build/Percy/PercyBinary.js.map +1 -0
- package/build/Percy/PercyCaptureMap.d.ts +9 -0
- package/build/Percy/PercyCaptureMap.d.ts.map +1 -0
- package/build/Percy/PercyCaptureMap.js +36 -0
- package/build/Percy/PercyCaptureMap.js.map +1 -0
- package/build/Percy/PercyHelper.d.ts +8 -0
- package/build/Percy/PercyHelper.d.ts.map +1 -0
- package/build/Percy/PercyHelper.js +68 -0
- package/build/Percy/PercyHelper.js.map +1 -0
- package/build/Percy/PercyLogger.d.ts +15 -0
- package/build/Percy/PercyLogger.d.ts.map +1 -0
- package/build/Percy/PercyLogger.js +68 -0
- package/build/Percy/PercyLogger.js.map +1 -0
- package/build/Percy/PercySDK.d.ts +4 -0
- package/build/Percy/PercySDK.d.ts.map +1 -0
- package/build/Percy/PercySDK.js +86 -0
- package/build/Percy/PercySDK.js.map +1 -0
- package/build/accessibility-handler.d.ts +52 -0
- package/build/accessibility-handler.d.ts.map +1 -0
- package/build/accessibility-handler.js +361 -0
- package/build/accessibility-handler.js.map +1 -0
- package/build/ai-handler.d.ts +23 -0
- package/build/ai-handler.d.ts.map +1 -0
- package/build/ai-handler.js +184 -0
- package/build/ai-handler.js.map +1 -0
- package/build/bstackLogger.d.ts +16 -0
- package/build/bstackLogger.d.ts.map +1 -0
- package/build/bstackLogger.js +71 -0
- package/build/bstackLogger.js.map +1 -0
- package/build/cleanup.d.ts +9 -0
- package/build/cleanup.d.ts.map +1 -0
- package/build/cleanup.js +101 -0
- package/build/cleanup.js.map +1 -0
- package/build/cli/apiUtils.d.ts +14 -0
- package/build/cli/apiUtils.d.ts.map +1 -0
- package/build/cli/apiUtils.js +25 -0
- package/build/cli/apiUtils.js.map +1 -0
- package/build/cli/cliLogger.d.ts +17 -0
- package/build/cli/cliLogger.d.ts.map +1 -0
- package/build/cli/cliLogger.js +82 -0
- package/build/cli/cliLogger.js.map +1 -0
- package/build/cli/cliUtils.d.ts +64 -0
- package/build/cli/cliUtils.d.ts.map +1 -0
- package/build/cli/cliUtils.js +461 -0
- package/build/cli/cliUtils.js.map +1 -0
- package/build/cli/eventDispatcher.d.ts +28 -0
- package/build/cli/eventDispatcher.d.ts.map +1 -0
- package/build/cli/eventDispatcher.js +49 -0
- package/build/cli/eventDispatcher.js.map +1 -0
- package/build/cli/frameworks/automationFramework.d.ts +89 -0
- package/build/cli/frameworks/automationFramework.d.ts.map +1 -0
- package/build/cli/frameworks/automationFramework.js +132 -0
- package/build/cli/frameworks/automationFramework.js.map +1 -0
- package/build/cli/frameworks/constants/automationFrameworkConstants.d.ts +18 -0
- package/build/cli/frameworks/constants/automationFrameworkConstants.d.ts.map +1 -0
- package/build/cli/frameworks/constants/automationFrameworkConstants.js +18 -0
- package/build/cli/frameworks/constants/automationFrameworkConstants.js.map +1 -0
- package/build/cli/frameworks/constants/testFrameworkConstants.d.ts +43 -0
- package/build/cli/frameworks/constants/testFrameworkConstants.d.ts.map +1 -0
- package/build/cli/frameworks/constants/testFrameworkConstants.js +43 -0
- package/build/cli/frameworks/constants/testFrameworkConstants.js.map +1 -0
- package/build/cli/frameworks/testFramework.d.ts +89 -0
- package/build/cli/frameworks/testFramework.d.ts.map +1 -0
- package/build/cli/frameworks/testFramework.js +126 -0
- package/build/cli/frameworks/testFramework.js.map +1 -0
- package/build/cli/frameworks/wdioAutomationFramework.d.ts +28 -0
- package/build/cli/frameworks/wdioAutomationFramework.d.ts.map +1 -0
- package/build/cli/frameworks/wdioAutomationFramework.js +67 -0
- package/build/cli/frameworks/wdioAutomationFramework.js.map +1 -0
- package/build/cli/frameworks/wdioMochaTestFramework.d.ts +82 -0
- package/build/cli/frameworks/wdioMochaTestFramework.d.ts.map +1 -0
- package/build/cli/frameworks/wdioMochaTestFramework.js +322 -0
- package/build/cli/frameworks/wdioMochaTestFramework.js.map +1 -0
- package/build/cli/grpcClient.d.ts +86 -0
- package/build/cli/grpcClient.d.ts.map +1 -0
- package/build/cli/grpcClient.js +532 -0
- package/build/cli/grpcClient.js.map +1 -0
- package/build/cli/index.d.ts +150 -0
- package/build/cli/index.d.ts.map +1 -0
- package/build/cli/index.js +464 -0
- package/build/cli/index.js.map +1 -0
- package/build/cli/instances/automationFrameworkInstance.d.ts +33 -0
- package/build/cli/instances/automationFrameworkInstance.d.ts.map +1 -0
- package/build/cli/instances/automationFrameworkInstance.js +45 -0
- package/build/cli/instances/automationFrameworkInstance.js.map +1 -0
- package/build/cli/instances/testFrameworkInstance.d.ts +62 -0
- package/build/cli/instances/testFrameworkInstance.d.ts.map +1 -0
- package/build/cli/instances/testFrameworkInstance.js +97 -0
- package/build/cli/instances/testFrameworkInstance.js.map +1 -0
- package/build/cli/instances/trackedContext.d.ts +32 -0
- package/build/cli/instances/trackedContext.d.ts.map +1 -0
- package/build/cli/instances/trackedContext.js +48 -0
- package/build/cli/instances/trackedContext.js.map +1 -0
- package/build/cli/instances/trackedInstance.d.ts +40 -0
- package/build/cli/instances/trackedInstance.d.ts.map +1 -0
- package/build/cli/instances/trackedInstance.js +64 -0
- package/build/cli/instances/trackedInstance.js.map +1 -0
- package/build/cli/modules/accessibilityModule.d.ts +46 -0
- package/build/cli/modules/accessibilityModule.d.ts.map +1 -0
- package/build/cli/modules/accessibilityModule.js +447 -0
- package/build/cli/modules/accessibilityModule.js.map +1 -0
- package/build/cli/modules/automateModule.d.ts +26 -0
- package/build/cli/modules/automateModule.d.ts.map +1 -0
- package/build/cli/modules/automateModule.js +223 -0
- package/build/cli/modules/automateModule.js.map +1 -0
- package/build/cli/modules/baseModule.d.ts +33 -0
- package/build/cli/modules/baseModule.d.ts.map +1 -0
- package/build/cli/modules/baseModule.js +52 -0
- package/build/cli/modules/baseModule.js.map +1 -0
- package/build/cli/modules/observabilityModule.d.ts +22 -0
- package/build/cli/modules/observabilityModule.d.ts.map +1 -0
- package/build/cli/modules/observabilityModule.js +46 -0
- package/build/cli/modules/observabilityModule.js.map +1 -0
- package/build/cli/modules/percyModule.d.ts +19 -0
- package/build/cli/modules/percyModule.d.ts.map +1 -0
- package/build/cli/modules/percyModule.js +78 -0
- package/build/cli/modules/percyModule.js.map +1 -0
- package/build/cli/modules/testHubModule.d.ts +30 -0
- package/build/cli/modules/testHubModule.d.ts.map +1 -0
- package/build/cli/modules/testHubModule.js +233 -0
- package/build/cli/modules/testHubModule.js.map +1 -0
- package/build/cli/modules/webdriverIOModule.d.ts +29 -0
- package/build/cli/modules/webdriverIOModule.d.ts.map +1 -0
- package/build/cli/modules/webdriverIOModule.js +129 -0
- package/build/cli/modules/webdriverIOModule.js.map +1 -0
- package/build/cli/states/automationFrameworkState.d.ts +65 -0
- package/build/cli/states/automationFrameworkState.d.ts.map +1 -0
- package/build/cli/states/automationFrameworkState.js +62 -0
- package/build/cli/states/automationFrameworkState.js.map +1 -0
- package/build/cli/states/hookState.d.ts +45 -0
- package/build/cli/states/hookState.d.ts.map +1 -0
- package/build/cli/states/hookState.js +44 -0
- package/build/cli/states/hookState.js.map +1 -0
- package/build/cli/states/testFrameworkState.d.ts +125 -0
- package/build/cli/states/testFrameworkState.d.ts.map +1 -0
- package/build/cli/states/testFrameworkState.js +116 -0
- package/build/cli/states/testFrameworkState.js.map +1 -0
- package/build/config.d.ts +29 -0
- package/build/config.d.ts.map +1 -0
- package/build/config.js +52 -0
- package/build/config.js.map +1 -0
- package/build/constants.d.ts +96 -0
- package/build/constants.d.ts.map +1 -0
- package/build/constants.js +156 -0
- package/build/constants.js.map +1 -0
- package/build/crash-reporter.d.ts +18 -0
- package/build/crash-reporter.d.ts.map +1 -0
- package/build/crash-reporter.js +134 -0
- package/build/crash-reporter.js.map +1 -0
- package/build/cucumber-types.d.ts +194 -0
- package/build/cucumber-types.d.ts.map +1 -0
- package/build/cucumber-types.js +2 -0
- package/build/cucumber-types.js.map +1 -0
- package/build/data-store.d.ts +4 -0
- package/build/data-store.d.ts.map +1 -0
- package/build/data-store.js +42 -0
- package/build/data-store.js.map +1 -0
- package/build/exitHandler.d.ts +4 -0
- package/build/exitHandler.d.ts.map +1 -0
- package/build/exitHandler.js +105 -0
- package/build/exitHandler.js.map +1 -0
- package/build/fileStream.d.ts +9 -0
- package/build/fileStream.d.ts.map +1 -0
- package/build/fileStream.js +13 -0
- package/build/fileStream.js.map +1 -0
- package/build/grpc/generated/sdk-messages-accessibility.d.ts +76 -0
- package/build/grpc/generated/sdk-messages-accessibility.d.ts.map +1 -0
- package/build/grpc/generated/sdk-messages-accessibility.js +908 -0
- package/build/grpc/generated/sdk-messages-accessibility.js.map +1 -0
- package/build/grpc/generated/sdk-messages-ai.d.ts +52 -0
- package/build/grpc/generated/sdk-messages-ai.d.ts.map +1 -0
- package/build/grpc/generated/sdk-messages-ai.js +643 -0
- package/build/grpc/generated/sdk-messages-ai.js.map +1 -0
- package/build/grpc/generated/sdk-messages-observability.d.ts +44 -0
- package/build/grpc/generated/sdk-messages-observability.d.ts.map +1 -0
- package/build/grpc/generated/sdk-messages-observability.js +505 -0
- package/build/grpc/generated/sdk-messages-observability.js.map +1 -0
- package/build/grpc/generated/sdk-messages-percy.d.ts +16 -0
- package/build/grpc/generated/sdk-messages-percy.d.ts.map +1 -0
- package/build/grpc/generated/sdk-messages-percy.js +111 -0
- package/build/grpc/generated/sdk-messages-percy.js.map +1 -0
- package/build/grpc/generated/sdk-messages-testhub.d.ts +16 -0
- package/build/grpc/generated/sdk-messages-testhub.d.ts.map +1 -0
- package/build/grpc/generated/sdk-messages-testhub.js +132 -0
- package/build/grpc/generated/sdk-messages-testhub.js.map +1 -0
- package/build/grpc/generated/sdk-messages.d.ts +288 -0
- package/build/grpc/generated/sdk-messages.d.ts.map +1 -0
- package/build/grpc/generated/sdk-messages.js +3958 -0
- package/build/grpc/generated/sdk-messages.js.map +1 -0
- package/build/grpc/generated/sdk.d.ts +282 -0
- package/build/grpc/generated/sdk.d.ts.map +1 -0
- package/build/grpc/generated/sdk.js +197 -0
- package/build/grpc/generated/sdk.js.map +1 -0
- package/build/grpc/index.d.ts +43 -0
- package/build/grpc/index.d.ts.map +1 -0
- package/build/grpc/index.js +154 -0
- package/build/grpc/index.js.map +1 -0
- package/build/index.d.ts +20 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +13 -0
- package/build/index.js.map +1 -0
- package/build/insights-handler.d.ts +76 -0
- package/build/insights-handler.d.ts.map +1 -0
- package/build/insights-handler.js +855 -0
- package/build/insights-handler.js.map +1 -0
- package/build/instrumentation/funnelInstrumentation.d.ts +8 -0
- package/build/instrumentation/funnelInstrumentation.d.ts.map +1 -0
- package/build/instrumentation/funnelInstrumentation.js +235 -0
- package/build/instrumentation/funnelInstrumentation.js.map +1 -0
- package/build/instrumentation/performance/constants.d.ts +151 -0
- package/build/instrumentation/performance/constants.d.ts.map +1 -0
- package/build/instrumentation/performance/constants.js +158 -0
- package/build/instrumentation/performance/constants.js.map +1 -0
- package/build/instrumentation/performance/performance-tester.d.ts +55 -0
- package/build/instrumentation/performance/performance-tester.d.ts.map +1 -0
- package/build/instrumentation/performance/performance-tester.js +403 -0
- package/build/instrumentation/performance/performance-tester.js.map +1 -0
- package/build/launcher.d.ts +49 -0
- package/build/launcher.d.ts.map +1 -0
- package/build/launcher.js +1077 -0
- package/build/launcher.js.map +1 -0
- package/build/log4jsAppender.d.ts +2 -0
- package/build/log4jsAppender.d.ts.map +1 -0
- package/build/log4jsAppender.js +20 -0
- package/build/log4jsAppender.js.map +1 -0
- package/build/logPatcher.d.ts +13 -0
- package/build/logPatcher.d.ts.map +1 -0
- package/build/logPatcher.js +39 -0
- package/build/logPatcher.js.map +1 -0
- package/build/logReportingAPI.d.ts +12 -0
- package/build/logReportingAPI.d.ts.map +1 -0
- package/build/logReportingAPI.js +57 -0
- package/build/logReportingAPI.js.map +1 -0
- package/build/reporter.d.ts +40 -0
- package/build/reporter.d.ts.map +1 -0
- package/build/reporter.js +254 -0
- package/build/reporter.js.map +1 -0
- package/build/request-handler.d.ts +19 -0
- package/build/request-handler.d.ts.map +1 -0
- package/build/request-handler.js +78 -0
- package/build/request-handler.js.map +1 -0
- package/build/scripts/accessibility-scripts.d.ts +26 -0
- package/build/scripts/accessibility-scripts.d.ts.map +1 -0
- package/build/scripts/accessibility-scripts.js +91 -0
- package/build/scripts/accessibility-scripts.js.map +1 -0
- package/build/service.d.ts +68 -0
- package/build/service.d.ts.map +1 -0
- package/build/service.js +740 -0
- package/build/service.js.map +1 -0
- package/build/testHub/utils.d.ts +10 -0
- package/build/testHub/utils.d.ts.map +1 -0
- package/build/testHub/utils.js +67 -0
- package/build/testHub/utils.js.map +1 -0
- package/build/testOps/featureStats.d.ts +45 -0
- package/build/testOps/featureStats.d.ts.map +1 -0
- package/build/testOps/featureStats.js +117 -0
- package/build/testOps/featureStats.js.map +1 -0
- package/build/testOps/featureUsage.d.ts +22 -0
- package/build/testOps/featureUsage.d.ts.map +1 -0
- package/build/testOps/featureUsage.js +48 -0
- package/build/testOps/featureUsage.js.map +1 -0
- package/build/testOps/listener.d.ts +40 -0
- package/build/testOps/listener.d.ts.map +1 -0
- package/build/testOps/listener.js +269 -0
- package/build/testOps/listener.js.map +1 -0
- package/build/testOps/requestUtils.d.ts +4 -0
- package/build/testOps/requestUtils.d.ts.map +1 -0
- package/build/testOps/requestUtils.js +41 -0
- package/build/testOps/requestUtils.js.map +1 -0
- package/build/testOps/testOpsConfig.d.ts +11 -0
- package/build/testOps/testOpsConfig.d.ts.map +1 -0
- package/build/testOps/testOpsConfig.js +20 -0
- package/build/testOps/testOpsConfig.js.map +1 -0
- package/build/testOps/usageStats.d.ts +404 -0
- package/build/testOps/usageStats.d.ts.map +1 -0
- package/build/testOps/usageStats.js +115 -0
- package/build/testOps/usageStats.js.map +1 -0
- package/build/testorchestration/apply-orchestration.d.ts +7 -0
- package/build/testorchestration/apply-orchestration.d.ts.map +1 -0
- package/build/testorchestration/apply-orchestration.js +43 -0
- package/build/testorchestration/apply-orchestration.js.map +1 -0
- package/build/testorchestration/helpers.d.ts +20 -0
- package/build/testorchestration/helpers.d.ts.map +1 -0
- package/build/testorchestration/helpers.js +413 -0
- package/build/testorchestration/helpers.js.map +1 -0
- package/build/testorchestration/request-utils.d.ts +23 -0
- package/build/testorchestration/request-utils.d.ts.map +1 -0
- package/build/testorchestration/request-utils.js +82 -0
- package/build/testorchestration/request-utils.js.map +1 -0
- package/build/testorchestration/test-ordering-server.d.ts +33 -0
- package/build/testorchestration/test-ordering-server.d.ts.map +1 -0
- package/build/testorchestration/test-ordering-server.js +169 -0
- package/build/testorchestration/test-ordering-server.js.map +1 -0
- package/build/testorchestration/testorcherstrationhandler.d.ts +50 -0
- package/build/testorchestration/testorcherstrationhandler.d.ts.map +1 -0
- package/build/testorchestration/testorcherstrationhandler.js +134 -0
- package/build/testorchestration/testorcherstrationhandler.js.map +1 -0
- package/build/testorchestration/testorcherstrationutils.d.ts +86 -0
- package/build/testorchestration/testorcherstrationutils.d.ts.map +1 -0
- package/build/testorchestration/testorcherstrationutils.js +380 -0
- package/build/testorchestration/testorcherstrationutils.js.map +1 -0
- package/build/types.d.ts +413 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/build/util.d.ts +241 -0
- package/build/util.d.ts.map +1 -0
- package/build/util.js +1665 -0
- package/build/util.js.map +1 -0
- package/package.json +96 -0
- package/src/proto/browserstack/sdk/v1/sdk-messages-accessibility.proto +71 -0
- package/src/proto/browserstack/sdk/v1/sdk-messages-ai.proto +48 -0
- package/src/proto/browserstack/sdk/v1/sdk-messages-observability.proto +39 -0
- package/src/proto/browserstack/sdk/v1/sdk-messages-percy.proto +10 -0
- package/src/proto/browserstack/sdk/v1/sdk-messages-testhub.proto +10 -0
- package/src/proto/browserstack/sdk/v1/sdk-messages.proto +276 -0
- package/src/proto/browserstack/sdk/v1/sdk.proto +41 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { BStackLogger } from './cliLogger.js';
|
|
2
|
+
import type { ChildProcess } from 'node:child_process';
|
|
3
|
+
import type { StartBinSessionResponse } from '../grpc/index.js';
|
|
4
|
+
import type BaseModule from './modules/baseModule.js';
|
|
5
|
+
import type { Options } from '@wdio/types';
|
|
6
|
+
import WdioMochaTestFramework from './frameworks/wdioMochaTestFramework.js';
|
|
7
|
+
import WdioAutomationFramework from './frameworks/wdioAutomationFramework.js';
|
|
8
|
+
import type { BrowserstackConfig, BrowserstackOptions } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* BrowserstackCLI - Singleton class for managing CLI operations
|
|
11
|
+
*
|
|
12
|
+
* This class uses the singleton pattern to ensure only one instance exists
|
|
13
|
+
* throughout the application lifecycle.
|
|
14
|
+
*/
|
|
15
|
+
export declare class BrowserstackCLI {
|
|
16
|
+
#private;
|
|
17
|
+
static enabled: boolean;
|
|
18
|
+
initialized: boolean;
|
|
19
|
+
config: Record<string, unknown>;
|
|
20
|
+
wdioConfig: string;
|
|
21
|
+
cliArgs: object;
|
|
22
|
+
browserstackConfig: Options.Testrunner | {};
|
|
23
|
+
process: ChildProcess | null;
|
|
24
|
+
isMainConnected: boolean;
|
|
25
|
+
isChildConnected: boolean;
|
|
26
|
+
binSessionId: string | null;
|
|
27
|
+
modules: Record<string, BaseModule>;
|
|
28
|
+
testFramework: WdioMochaTestFramework | null;
|
|
29
|
+
cliParams: Record<string, string> | null;
|
|
30
|
+
automationFramework: WdioAutomationFramework | null;
|
|
31
|
+
SDK_CLI_BIN_PATH: string | null;
|
|
32
|
+
logger: typeof BStackLogger;
|
|
33
|
+
options: BrowserstackConfig & BrowserstackOptions | {};
|
|
34
|
+
constructor();
|
|
35
|
+
/**
|
|
36
|
+
* Get the singleton instance of BrowserstackCLI
|
|
37
|
+
* @returns {BrowserstackCLI} The singleton instance
|
|
38
|
+
*/
|
|
39
|
+
static getInstance(): BrowserstackCLI;
|
|
40
|
+
/**
|
|
41
|
+
* Bootstrap the CLI
|
|
42
|
+
* Initializes and starts the CLI based on environment settings
|
|
43
|
+
* @returns {Promise<void>}
|
|
44
|
+
*/
|
|
45
|
+
bootstrap(options: BrowserstackConfig & BrowserstackOptions, config?: Options.Testrunner, wdioConfig?: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Start as a main process
|
|
48
|
+
* @returns {Promise<void>}
|
|
49
|
+
*/
|
|
50
|
+
startMain(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Load modules
|
|
53
|
+
* @param {Object} startBinResponse - StartBinSession response
|
|
54
|
+
*/
|
|
55
|
+
loadModules(startBinResponse: StartBinSessionResponse): void;
|
|
56
|
+
private logBuildStartErrors;
|
|
57
|
+
private parseBuildStartErrors;
|
|
58
|
+
/**
|
|
59
|
+
* Configure modules
|
|
60
|
+
* @returns {Promise<void>}
|
|
61
|
+
*/
|
|
62
|
+
configureModules(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Start the CLI process and return a promise that resolves when it's ready
|
|
65
|
+
* @returns {Promise<void>}
|
|
66
|
+
* @throws {Error} If the process fails to start
|
|
67
|
+
*/
|
|
68
|
+
start(): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Stop the CLI
|
|
71
|
+
* @returns {Promise<void>}
|
|
72
|
+
*/
|
|
73
|
+
stop(): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Unconfigure modules
|
|
76
|
+
* @returns {Promise<void>}
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
unConfigureModules(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Load CLI parameters from the output
|
|
82
|
+
* @param {Object} params - Parameters parsed from CLI output
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
loadCliParams(params: Record<string, string>): void;
|
|
86
|
+
/**
|
|
87
|
+
* Start as a child process with the specified binSessionId
|
|
88
|
+
* @param {string} binSessionId - session ID to connect to the CLI process
|
|
89
|
+
* @returns {Promise<void>}
|
|
90
|
+
*/
|
|
91
|
+
startChild(binSessionId: string): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Check if the CLI is running
|
|
94
|
+
* @returns {boolean} True if the CLI is running
|
|
95
|
+
*/
|
|
96
|
+
isRunning(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Get the Browserstack configuration
|
|
99
|
+
* @returns {Object} The Browserstack configuration
|
|
100
|
+
*/
|
|
101
|
+
getBrowserstackConfig(): {} | Options.Testrunner;
|
|
102
|
+
/**
|
|
103
|
+
* Set the Browserstack configuration
|
|
104
|
+
* @param {Object}
|
|
105
|
+
* @returns {void}
|
|
106
|
+
*/
|
|
107
|
+
setBrowserstackConfig(browserstackConfig: Options.Testrunner): void;
|
|
108
|
+
/**
|
|
109
|
+
* Get the CLI binary path
|
|
110
|
+
* @returns {string} The CLI binary path
|
|
111
|
+
*/
|
|
112
|
+
getCliBinPath(): Promise<string>;
|
|
113
|
+
/**
|
|
114
|
+
* Check if the CLI is enabled
|
|
115
|
+
* @returns {boolean} True if the CLI is enabled
|
|
116
|
+
*/
|
|
117
|
+
isCliEnabled(): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Get the configuration
|
|
120
|
+
* @returns {Object} The configuration
|
|
121
|
+
*/
|
|
122
|
+
getConfig(): Record<string, unknown>;
|
|
123
|
+
/**
|
|
124
|
+
* Set the configuration
|
|
125
|
+
* @param {Object}
|
|
126
|
+
* @returns {void}
|
|
127
|
+
*/
|
|
128
|
+
setConfig(response: StartBinSessionResponse): void;
|
|
129
|
+
/**
|
|
130
|
+
* Setup the test framework
|
|
131
|
+
* @returns {void}
|
|
132
|
+
*/
|
|
133
|
+
setupTestFramework(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Setup the automation framework
|
|
136
|
+
* @returns {void}
|
|
137
|
+
*/
|
|
138
|
+
setupAutomationFramework(): void;
|
|
139
|
+
/**
|
|
140
|
+
* Get the test framework
|
|
141
|
+
* @returns {Object} The test framework
|
|
142
|
+
*/
|
|
143
|
+
getTestFramework(): WdioMochaTestFramework | null;
|
|
144
|
+
/**
|
|
145
|
+
* Get the automation framework
|
|
146
|
+
* @returns {Object} The automation framework
|
|
147
|
+
*/
|
|
148
|
+
getAutomationFramework(): WdioAutomationFramework | null;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAK7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAA;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,sBAAsB,MAAM,wCAAwC,CAAA;AAC3E,OAAO,uBAAuB,MAAM,yCAAyC,CAAA;AAK7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAI1E;;;;;GAKG;AACH,qBAAa,eAAe;;IAExB,MAAM,CAAC,OAAO,UAAQ;IACtB,WAAW,EAAC,OAAO,CAAA;IACnB,MAAM,EAAC,MAAM,CAAC,MAAM,EAAE,OAA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ACH,qBAAqB,CAAC,kBAAkB,EAAC,OAAO,CAAC,UAAU;IAI3D;;;OAGG;IACG,aAAa;IAOnB;;;OAGG;IACH,YAAY;IAIZ;;;OAGG;IACH,SAAS;IAIT;;;;MAIE;IACF,SAAS,CAAC,QAAQ,EAAE,uBAAuB;IAS3C;;;OAGG;IACH,kBAAkB;IAOlB;;;OAGG;IACH,wBAAwB;IAOxB;;;OAGG;IACH,gBAAgB;IAIhB;;;OAGG;IACH,sBAAsB;CAGzB"}
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import util from 'node:util';
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { CLIUtils } from './cliUtils.js';
|
|
4
|
+
import PerformanceTester from '../instrumentation/performance/performance-tester.js';
|
|
5
|
+
import { EVENTS as PerformanceEvents } from '../instrumentation/performance/constants.js';
|
|
6
|
+
import { BStackLogger } from './cliLogger.js';
|
|
7
|
+
import { GrpcClient } from './grpcClient.js';
|
|
8
|
+
import AutomateModule from './modules/automateModule.js';
|
|
9
|
+
import TestHubModule from './modules/testHubModule.js';
|
|
10
|
+
import { BROWSERSTACK_ACCESSIBILITY, BROWSERSTACK_OBSERVABILITY, BROWSERSTACK_TESTHUB_JWT, BROWSERSTACK_TESTHUB_UUID, CLI_STOP_TIMEOUT, TESTOPS_BUILD_COMPLETED_ENV, TESTOPS_SCREENSHOT_ENV } from '../constants.js';
|
|
11
|
+
import TestOpsConfig from '../testOps/testOpsConfig.js';
|
|
12
|
+
import WdioMochaTestFramework from './frameworks/wdioMochaTestFramework.js';
|
|
13
|
+
import WdioAutomationFramework from './frameworks/wdioAutomationFramework.js';
|
|
14
|
+
import WebdriverIOModule from './modules/webdriverIOModule.js';
|
|
15
|
+
import AccessibilityModule from './modules/accessibilityModule.js';
|
|
16
|
+
import { isTurboScale, processAccessibilityResponse, shouldAddServiceVersion } from '../util.js';
|
|
17
|
+
import ObservabilityModule from './modules/observabilityModule.js';
|
|
18
|
+
import PercyModule from './modules/percyModule.js';
|
|
19
|
+
import APIUtils from './apiUtils.js';
|
|
20
|
+
/**
|
|
21
|
+
* BrowserstackCLI - Singleton class for managing CLI operations
|
|
22
|
+
*
|
|
23
|
+
* This class uses the singleton pattern to ensure only one instance exists
|
|
24
|
+
* throughout the application lifecycle.
|
|
25
|
+
*/
|
|
26
|
+
export class BrowserstackCLI {
|
|
27
|
+
static #instance = null;
|
|
28
|
+
static enabled = false;
|
|
29
|
+
initialized;
|
|
30
|
+
config;
|
|
31
|
+
wdioConfig;
|
|
32
|
+
cliArgs;
|
|
33
|
+
browserstackConfig;
|
|
34
|
+
process = null;
|
|
35
|
+
isMainConnected = false;
|
|
36
|
+
isChildConnected = false;
|
|
37
|
+
binSessionId = null;
|
|
38
|
+
modules = {};
|
|
39
|
+
testFramework = null;
|
|
40
|
+
cliParams = null;
|
|
41
|
+
automationFramework = null;
|
|
42
|
+
SDK_CLI_BIN_PATH = null;
|
|
43
|
+
logger = BStackLogger;
|
|
44
|
+
options;
|
|
45
|
+
constructor() {
|
|
46
|
+
this.initialized = false;
|
|
47
|
+
this.config = {};
|
|
48
|
+
this.cliArgs = {};
|
|
49
|
+
this.browserstackConfig = {};
|
|
50
|
+
this.wdioConfig = '';
|
|
51
|
+
this.options = {};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get the singleton instance of BrowserstackCLI
|
|
55
|
+
* @returns {BrowserstackCLI} The singleton instance
|
|
56
|
+
*/
|
|
57
|
+
static getInstance() {
|
|
58
|
+
if (!BrowserstackCLI.#instance) {
|
|
59
|
+
BrowserstackCLI.#instance = new BrowserstackCLI();
|
|
60
|
+
}
|
|
61
|
+
return BrowserstackCLI.#instance;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Bootstrap the CLI
|
|
65
|
+
* Initializes and starts the CLI based on environment settings
|
|
66
|
+
* @returns {Promise<void>}
|
|
67
|
+
*/
|
|
68
|
+
async bootstrap(options, config, wdioConfig = '') {
|
|
69
|
+
PerformanceTester.start(PerformanceEvents.SDK_CLI_ON_BOOTSTRAP);
|
|
70
|
+
BrowserstackCLI.enabled = true;
|
|
71
|
+
this.options = options;
|
|
72
|
+
if (config) {
|
|
73
|
+
BrowserstackCLI.getInstance().setBrowserstackConfig(config);
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const binSessionId = process.env.BROWSERSTACK_CLI_BIN_SESSION_ID || null;
|
|
77
|
+
if (binSessionId) {
|
|
78
|
+
await this.startChild(binSessionId);
|
|
79
|
+
PerformanceTester.end(PerformanceEvents.SDK_CLI_ON_BOOTSTRAP);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.wdioConfig = wdioConfig;
|
|
83
|
+
await this.startMain();
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
const errorMessage = error instanceof Error ? error.stack || error.message : String(error);
|
|
87
|
+
this.logger.error(`bootstrap: failed to bootstrap ${errorMessage}`);
|
|
88
|
+
await this.stop();
|
|
89
|
+
PerformanceTester.end(PerformanceEvents.SDK_CLI_ON_BOOTSTRAP, false, util.format(error));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Start as a main process
|
|
94
|
+
* @returns {Promise<void>}
|
|
95
|
+
*/
|
|
96
|
+
async startMain() {
|
|
97
|
+
this.logger.info('startMain: Starting main process');
|
|
98
|
+
await this.start();
|
|
99
|
+
this.logger.debug('startMain: main-process started');
|
|
100
|
+
const response = await GrpcClient.getInstance().startBinSession(this.wdioConfig);
|
|
101
|
+
BStackLogger.debug(`start: startBinSession response=${JSON.stringify(response)}`);
|
|
102
|
+
this.loadModules(response);
|
|
103
|
+
this.isMainConnected = true;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Load modules
|
|
107
|
+
* @param {Object} startBinResponse - StartBinSession response
|
|
108
|
+
*/
|
|
109
|
+
loadModules(startBinResponse) {
|
|
110
|
+
// Defer imports to avoid circular dependencies
|
|
111
|
+
this.binSessionId = startBinResponse.binSessionId;
|
|
112
|
+
this.logger.info(`loadModules: binSessionId=${this.binSessionId}`);
|
|
113
|
+
this.setConfig(startBinResponse);
|
|
114
|
+
APIUtils.updateURLSForGRR(this.config.apis);
|
|
115
|
+
this.setupTestFramework();
|
|
116
|
+
this.setupAutomationFramework();
|
|
117
|
+
this.modules[WebdriverIOModule.MODULE_NAME] = new WebdriverIOModule();
|
|
118
|
+
this.modules[AutomateModule.MODULE_NAME] = new AutomateModule(this.browserstackConfig);
|
|
119
|
+
if (startBinResponse.testhub) {
|
|
120
|
+
this.logBuildStartErrors(startBinResponse.testhub);
|
|
121
|
+
process.env[TESTOPS_BUILD_COMPLETED_ENV] = 'true';
|
|
122
|
+
if (startBinResponse.testhub.jwt) {
|
|
123
|
+
process.env[BROWSERSTACK_TESTHUB_JWT] = startBinResponse.testhub.jwt;
|
|
124
|
+
}
|
|
125
|
+
if (startBinResponse.testhub.buildHashedId) {
|
|
126
|
+
process.env[BROWSERSTACK_TESTHUB_UUID] = startBinResponse.testhub.buildHashedId;
|
|
127
|
+
TestOpsConfig.getInstance().buildHashedId = startBinResponse.testhub.buildHashedId;
|
|
128
|
+
}
|
|
129
|
+
if (startBinResponse.observability?.success) {
|
|
130
|
+
process.env[BROWSERSTACK_OBSERVABILITY] = 'true';
|
|
131
|
+
if (startBinResponse.observability.options?.allowScreenshots) {
|
|
132
|
+
process.env[TESTOPS_SCREENSHOT_ENV] = startBinResponse.observability.options.allowScreenshots.toString();
|
|
133
|
+
}
|
|
134
|
+
this.modules[ObservabilityModule.MODULE_NAME] = new ObservabilityModule(startBinResponse.observability);
|
|
135
|
+
}
|
|
136
|
+
this.modules[TestHubModule.MODULE_NAME] = new TestHubModule(startBinResponse.testhub);
|
|
137
|
+
if (startBinResponse.accessibility?.success) {
|
|
138
|
+
process.env[BROWSERSTACK_ACCESSIBILITY] = 'true';
|
|
139
|
+
const options = this.options;
|
|
140
|
+
const isNonBstackA11y = isTurboScale(options) || !shouldAddServiceVersion(this.browserstackConfig, options.testObservability);
|
|
141
|
+
processAccessibilityResponse(startBinResponse, this.options);
|
|
142
|
+
this.modules[AccessibilityModule.MODULE_NAME] = new AccessibilityModule(startBinResponse.accessibility, isNonBstackA11y);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (startBinResponse.percy?.success) {
|
|
146
|
+
this.modules[PercyModule.MODULE_NAME] = new PercyModule(startBinResponse.percy);
|
|
147
|
+
}
|
|
148
|
+
this.configureModules();
|
|
149
|
+
}
|
|
150
|
+
logBuildStartErrors(testhub) {
|
|
151
|
+
if (process.env.WDIO_WORKER_ID) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
const rawErrors = testhub?.errors;
|
|
156
|
+
const parsedErrors = this.parseBuildStartErrors(rawErrors);
|
|
157
|
+
for (const [errorKey, errorDetails] of Object.entries(parsedErrors)) {
|
|
158
|
+
const errorMessage = errorDetails?.message;
|
|
159
|
+
if (!errorMessage) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const formattedMessage = `[Build] ${errorKey}: ${errorMessage}`;
|
|
163
|
+
if (errorDetails.type === 'info') {
|
|
164
|
+
BStackLogger.info(formattedMessage);
|
|
165
|
+
}
|
|
166
|
+
else if (errorDetails.type === 'warn') {
|
|
167
|
+
BStackLogger.warn(formattedMessage);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
BStackLogger.error(formattedMessage);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
BStackLogger.debug(`Failed to log build-start errors: ${util.format(error)}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
parseBuildStartErrors(rawErrors) {
|
|
179
|
+
if (!rawErrors) {
|
|
180
|
+
return {};
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
if (typeof rawErrors === 'string') {
|
|
184
|
+
return JSON.parse(rawErrors);
|
|
185
|
+
}
|
|
186
|
+
if (Buffer.isBuffer(rawErrors)) {
|
|
187
|
+
return JSON.parse(rawErrors.toString('utf8'));
|
|
188
|
+
}
|
|
189
|
+
if (rawErrors instanceof Uint8Array) {
|
|
190
|
+
return JSON.parse(Buffer.from(rawErrors).toString('utf8'));
|
|
191
|
+
}
|
|
192
|
+
if (typeof rawErrors === 'object') {
|
|
193
|
+
return rawErrors;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
BStackLogger.debug(`Failed to parse build-start errors from CLI response: ${util.format(error)}`);
|
|
198
|
+
}
|
|
199
|
+
return {};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Configure modules
|
|
203
|
+
* @returns {Promise<void>}
|
|
204
|
+
*/
|
|
205
|
+
async configureModules() {
|
|
206
|
+
this.logger.debug('configureModules: Configuring modules');
|
|
207
|
+
for (const moduleName in this.modules) {
|
|
208
|
+
const module = this.modules[moduleName];
|
|
209
|
+
const platformIndex = process.env.WDIO_WORKER_ID ? parseInt(process.env.WDIO_WORKER_ID.split('-')[0]) : 0;
|
|
210
|
+
this.logger.debug(`configureModules: Configuring module=${moduleName} platformIndex=${platformIndex}`);
|
|
211
|
+
await module.configure(this.binSessionId, platformIndex, GrpcClient.getInstance().client, this.config);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Start the CLI process and return a promise that resolves when it's ready
|
|
216
|
+
* @returns {Promise<void>}
|
|
217
|
+
* @throws {Error} If the process fails to start
|
|
218
|
+
*/
|
|
219
|
+
async start() {
|
|
220
|
+
PerformanceTester.start(PerformanceEvents.SDK_CLI_START);
|
|
221
|
+
if (CLIUtils.isDevelopmentEnv()) {
|
|
222
|
+
this.loadCliParams(CLIUtils.getCLIParamsForDevEnv());
|
|
223
|
+
PerformanceTester.end(PerformanceEvents.SDK_CLI_START);
|
|
224
|
+
return Promise.resolve();
|
|
225
|
+
}
|
|
226
|
+
// Skip if process is already running
|
|
227
|
+
if (this.process && this.process.connected) {
|
|
228
|
+
PerformanceTester.end(PerformanceEvents.SDK_CLI_START);
|
|
229
|
+
return Promise.resolve();
|
|
230
|
+
}
|
|
231
|
+
const SDK_CLI_BIN_PATH = await this.getCliBinPath();
|
|
232
|
+
const cmd = [SDK_CLI_BIN_PATH, 'sdk'];
|
|
233
|
+
this.logger.debug(`spawning command='${cmd}'`);
|
|
234
|
+
// Create a child process
|
|
235
|
+
this.process = spawn(cmd[0], cmd.slice(1), {
|
|
236
|
+
env: process.env
|
|
237
|
+
});
|
|
238
|
+
// Return a promise that resolves when CLI is ready
|
|
239
|
+
return new Promise((resolve, reject) => {
|
|
240
|
+
const cliOut = {};
|
|
241
|
+
this.process.stdout.on('data', (data) => {
|
|
242
|
+
const lines = data.toString().trim().split('\n');
|
|
243
|
+
for (const line of lines) {
|
|
244
|
+
// Parse key=value pairs
|
|
245
|
+
if (/^(id|listen|port)=.*$/.test(line)) {
|
|
246
|
+
const [key, value] = line.split('=', 2);
|
|
247
|
+
if (value !== undefined) {
|
|
248
|
+
cliOut[key] = value;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// Check for ready message
|
|
252
|
+
if (line.toLowerCase().includes('ready')) {
|
|
253
|
+
this.loadCliParams(cliOut);
|
|
254
|
+
PerformanceTester.end(PerformanceEvents.SDK_CLI_START);
|
|
255
|
+
resolve();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
this.process.stderr.on('data', (data) => {
|
|
261
|
+
this.logger.error(`CLI stderr: ${data.toString().trim()}`);
|
|
262
|
+
});
|
|
263
|
+
this.process.on('error', (err) => {
|
|
264
|
+
cliOut.error = `Error in start: ${err.message}`;
|
|
265
|
+
PerformanceTester.end(PerformanceEvents.SDK_CLI_START, false, err);
|
|
266
|
+
reject(new Error(`Failed to start CLI process: ${err.message}`));
|
|
267
|
+
});
|
|
268
|
+
this.process.on('close', (code) => {
|
|
269
|
+
if (code !== 0) {
|
|
270
|
+
reject(new Error(`CLI process exited with code ${code}`));
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Stop the CLI
|
|
277
|
+
* @returns {Promise<void>}
|
|
278
|
+
*/
|
|
279
|
+
async stop() {
|
|
280
|
+
PerformanceTester.start(PerformanceEvents.SDK_CLI_ON_STOP);
|
|
281
|
+
this.logger.debug('stop: CLI stop triggered');
|
|
282
|
+
try {
|
|
283
|
+
if (this.isMainConnected) {
|
|
284
|
+
const response = await GrpcClient.getInstance().stopBinSession();
|
|
285
|
+
BStackLogger.debug(`stop: stopBinSession response=${JSON.stringify(response)}`);
|
|
286
|
+
}
|
|
287
|
+
await this.unConfigureModules();
|
|
288
|
+
if (this.process && this.process.pid) {
|
|
289
|
+
this.logger.debug('stop: shutting down CLI');
|
|
290
|
+
this.process.kill();
|
|
291
|
+
// Wait for process to fully exit
|
|
292
|
+
await new Promise((resolve) => {
|
|
293
|
+
let exited = false;
|
|
294
|
+
// Listen for exit event
|
|
295
|
+
this.process.on('exit', () => {
|
|
296
|
+
this.logger.debug('stop: CLI process exited');
|
|
297
|
+
exited = true;
|
|
298
|
+
PerformanceTester.end(PerformanceEvents.SDK_CLI_ON_STOP);
|
|
299
|
+
resolve();
|
|
300
|
+
});
|
|
301
|
+
// Set a timeout in case process doesn't exit cleanly
|
|
302
|
+
setTimeout(() => {
|
|
303
|
+
if (!exited) {
|
|
304
|
+
this.logger.warn('stop: process exit timeout, forcing kill');
|
|
305
|
+
this.process.kill('SIGKILL');
|
|
306
|
+
PerformanceTester.end(PerformanceEvents.SDK_CLI_ON_STOP);
|
|
307
|
+
resolve();
|
|
308
|
+
}
|
|
309
|
+
}, CLI_STOP_TIMEOUT);
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
PerformanceTester.end(PerformanceEvents.SDK_CLI_ON_STOP, false, util.format(error));
|
|
315
|
+
const errorMessage = error instanceof Error ? error.stack || error.message : String(error);
|
|
316
|
+
this.logger.error(`stop: error in stop session exception=${errorMessage}`);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Unconfigure modules
|
|
321
|
+
* @returns {Promise<void>}
|
|
322
|
+
* @private
|
|
323
|
+
*/
|
|
324
|
+
async unConfigureModules() {
|
|
325
|
+
this.logger.debug('Unconfiguring modules');
|
|
326
|
+
for (const moduleName in this.modules) {
|
|
327
|
+
const module = this.modules[moduleName];
|
|
328
|
+
const platformIndex = process.env.WDIO_WORKER_ID ? parseInt(process.env.WDIO_WORKER_ID.split('-')[0]) : 0;
|
|
329
|
+
await module.configure(null, platformIndex, GrpcClient.getInstance().client);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Load CLI parameters from the output
|
|
334
|
+
* @param {Object} params - Parameters parsed from CLI output
|
|
335
|
+
* @private
|
|
336
|
+
*/
|
|
337
|
+
loadCliParams(params) {
|
|
338
|
+
this.logger.debug(`CLI params loaded: ${JSON.stringify(params)}`);
|
|
339
|
+
this.cliParams = params;
|
|
340
|
+
GrpcClient.getInstance().init(params);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Start as a child process with the specified binSessionId
|
|
344
|
+
* @param {string} binSessionId - session ID to connect to the CLI process
|
|
345
|
+
* @returns {Promise<void>}
|
|
346
|
+
*/
|
|
347
|
+
async startChild(binSessionId) {
|
|
348
|
+
PerformanceTester.start(PerformanceEvents.SDK_CONNECT_BIN_SESSION);
|
|
349
|
+
try {
|
|
350
|
+
this.logger.info(`Starting as child process with session ID: ${binSessionId}`);
|
|
351
|
+
GrpcClient.getInstance().connect();
|
|
352
|
+
const response = await GrpcClient.getInstance().connectBinSession();
|
|
353
|
+
this.logger.info(`Connected to bin session: ${JSON.stringify(response)}`);
|
|
354
|
+
this.loadModules(response);
|
|
355
|
+
this.isChildConnected = true;
|
|
356
|
+
PerformanceTester.end(PerformanceEvents.SDK_CONNECT_BIN_SESSION);
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
PerformanceTester.end(PerformanceEvents.SDK_CONNECT_BIN_SESSION, false, util.format(error));
|
|
360
|
+
this.logger.error(`Failed to start as child process: ${util.format(error)}`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Check if the CLI is running
|
|
365
|
+
* @returns {boolean} True if the CLI is running
|
|
366
|
+
*/
|
|
367
|
+
isRunning() {
|
|
368
|
+
return (
|
|
369
|
+
// is Dev mode
|
|
370
|
+
CLIUtils.isDevelopmentEnv() ||
|
|
371
|
+
// Main process connection check
|
|
372
|
+
(this.isMainConnected && this.process !== null && this.process.exitCode === null && GrpcClient.getInstance().getClient() !== null && GrpcClient.getInstance().getChannel().getConnectivityState(false) !== 4) ||
|
|
373
|
+
// Child process connection check
|
|
374
|
+
(this.isChildConnected && GrpcClient.getInstance().getChannel() !== null && GrpcClient.getInstance().getChannel().getConnectivityState(false) !== 4));
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Get the Browserstack configuration
|
|
378
|
+
* @returns {Object} The Browserstack configuration
|
|
379
|
+
*/
|
|
380
|
+
getBrowserstackConfig() {
|
|
381
|
+
return this.browserstackConfig;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Set the Browserstack configuration
|
|
385
|
+
* @param {Object}
|
|
386
|
+
* @returns {void}
|
|
387
|
+
*/
|
|
388
|
+
setBrowserstackConfig(browserstackConfig) {
|
|
389
|
+
this.browserstackConfig = browserstackConfig;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Get the CLI binary path
|
|
393
|
+
* @returns {string} The CLI binary path
|
|
394
|
+
*/
|
|
395
|
+
async getCliBinPath() {
|
|
396
|
+
if (!this.SDK_CLI_BIN_PATH) {
|
|
397
|
+
this.SDK_CLI_BIN_PATH = await CLIUtils.setupCliPath(this.browserstackConfig);
|
|
398
|
+
}
|
|
399
|
+
return this.SDK_CLI_BIN_PATH || ''; // TODO: Type hack
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Check if the CLI is enabled
|
|
403
|
+
* @returns {boolean} True if the CLI is enabled
|
|
404
|
+
*/
|
|
405
|
+
isCliEnabled() {
|
|
406
|
+
return BrowserstackCLI.enabled;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Get the configuration
|
|
410
|
+
* @returns {Object} The configuration
|
|
411
|
+
*/
|
|
412
|
+
getConfig() {
|
|
413
|
+
return this.config;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Set the configuration
|
|
417
|
+
* @param {Object}
|
|
418
|
+
* @returns {void}
|
|
419
|
+
*/
|
|
420
|
+
setConfig(response) {
|
|
421
|
+
try {
|
|
422
|
+
this.config = JSON.parse(response.config);
|
|
423
|
+
this.logger.debug(`loadModules: config=${JSON.stringify(this.config)}`);
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
this.logger.error(`setConfig: error=${util.format(error)}`);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Setup the test framework
|
|
431
|
+
* @returns {void}
|
|
432
|
+
*/
|
|
433
|
+
setupTestFramework() {
|
|
434
|
+
const testFrameworkDetail = CLIUtils.getTestFrameworkDetail();
|
|
435
|
+
if (testFrameworkDetail.name.toLowerCase() === 'webdriverio-mocha') {
|
|
436
|
+
this.testFramework = new WdioMochaTestFramework([testFrameworkDetail.name], testFrameworkDetail.version, this.binSessionId);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Setup the automation framework
|
|
441
|
+
* @returns {void}
|
|
442
|
+
*/
|
|
443
|
+
setupAutomationFramework() {
|
|
444
|
+
const automationFrameworkDetail = CLIUtils.getAutomationFrameworkDetail();
|
|
445
|
+
if (automationFrameworkDetail.name.toLowerCase() === 'webdriverio') {
|
|
446
|
+
this.automationFramework = new WdioAutomationFramework(automationFrameworkDetail.name, automationFrameworkDetail.version);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Get the test framework
|
|
451
|
+
* @returns {Object} The test framework
|
|
452
|
+
*/
|
|
453
|
+
getTestFramework() {
|
|
454
|
+
return this.testFramework;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Get the automation framework
|
|
458
|
+
* @returns {Object} The automation framework
|
|
459
|
+
*/
|
|
460
|
+
getAutomationFramework() {
|
|
461
|
+
return this.automationFramework;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,iBAAiB,MAAM,sDAAsD,CAAA;AACpF,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,cAAc,MAAM,6BAA6B,CAAA;AACxD,OAAO,aAAa,MAAM,4BAA4B,CAAA;AAKtD,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAEpN,OAAO,aAAa,MAAM,6BAA6B,CAAA;AACvD,OAAO,sBAAsB,MAAM,wCAAwC,CAAA;AAC3E,OAAO,uBAAuB,MAAM,yCAAyC,CAAA;AA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AAG,QAAQ,CAAC,sBAAsB,EAAE,CAAA;QAC7D,IAAI,mBAAmB,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,mBAAmB,EAAE,CAAC;YACjE,IAAI,CAAC,aAAa,GAAG,IAAI,sBAAsB,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,YAAsB,CAAC,CAAA;QACzI,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,wBAAwB;QACpB,MAAM,yBAAyB,GAAG,QAAQ,CAAC,4BAA4B,EAAE,CAAA;QACzE,IAAI,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,aAAa,EAAE,CAAC;YACjE,IAAI,CAAC,mBAAmB,GAAG,IAAI,uBAAuB,CAAC,yBAAyB,CAAC,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAA;QAC7H,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,gBAAgB;QACZ,OAAO,IAAI,CAAC,aAAa,CAAA;IAC7B,CAAC;IAED;;;OAGG;IACH,sBAAsB;QAClB,OAAO,IAAI,CAAC,mBAAmB,CAAA;IACnC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type TrackedContext from './trackedContext.js';
|
|
2
|
+
import TrackedInstance from './trackedInstance.js';
|
|
3
|
+
/**
|
|
4
|
+
* Class representing an automation framework instance
|
|
5
|
+
* @extends TrackedInstance
|
|
6
|
+
*/
|
|
7
|
+
export default class AutomationFrameworkInstance extends TrackedInstance {
|
|
8
|
+
frameworkName: string;
|
|
9
|
+
frameworkVersion: string;
|
|
10
|
+
state: State;
|
|
11
|
+
constructor(context: TrackedContext, frameworkName: string, frameworkVersion: string, state: State);
|
|
12
|
+
/**
|
|
13
|
+
* Get the framework name
|
|
14
|
+
* @returns {string} The name of the automation framework
|
|
15
|
+
*/
|
|
16
|
+
getFrameworkName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get the framework version
|
|
19
|
+
* @returns {string} The version of the automation framework
|
|
20
|
+
*/
|
|
21
|
+
getFrameworkVersion(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the current state
|
|
24
|
+
* @returns {AutomationFrameworkState} The current state of the automation framework
|
|
25
|
+
*/
|
|
26
|
+
getState(): State;
|
|
27
|
+
/**
|
|
28
|
+
* Set the current state
|
|
29
|
+
* @param {AutomationFrameworkState} state - The new state to set
|
|
30
|
+
*/
|
|
31
|
+
setState(state: State): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=automationFrameworkInstance.d.ts.map
|