@wdio/browserstack-service 8.47.1 → 8.48.3
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/build/accessibility-handler.d.ts.map +1 -1
- package/build/accessibility-handler.js +13 -11
- package/build/ai-handler.d.ts.map +1 -1
- package/build/ai-handler.js +11 -0
- package/build/cli/cliLogger.d.ts +1 -0
- package/build/cli/cliLogger.d.ts.map +1 -1
- package/build/cli/cliLogger.js +23 -12
- package/build/cli/cliUtils.d.ts +18 -0
- package/build/cli/cliUtils.d.ts.map +1 -1
- package/build/cli/cliUtils.js +31 -1
- package/build/cli/frameworks/wdioMochaTestFramework.d.ts.map +1 -1
- package/build/cli/frameworks/wdioMochaTestFramework.js +4 -2
- package/build/cli/grpcClient.d.ts +19 -3
- package/build/cli/grpcClient.d.ts.map +1 -1
- package/build/cli/grpcClient.js +133 -21
- package/build/cli/index.d.ts +2 -0
- package/build/cli/index.d.ts.map +1 -1
- package/build/cli/index.js +52 -4
- package/build/cli/modules/accessibilityModule.d.ts +14 -1
- package/build/cli/modules/accessibilityModule.d.ts.map +1 -1
- package/build/cli/modules/accessibilityModule.js +113 -14
- package/build/constants.d.ts +28 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +37 -1
- package/build/exitHandler.d.ts +1 -1
- package/build/exitHandler.d.ts.map +1 -1
- package/build/exitHandler.js +6 -5
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +33 -7
- package/build/instrumentation/funnelInstrumentation.d.ts +2 -2
- package/build/instrumentation/funnelInstrumentation.d.ts.map +1 -1
- package/build/instrumentation/funnelInstrumentation.js +30 -8
- package/build/instrumentation/performance/constants.d.ts +64 -0
- package/build/instrumentation/performance/constants.d.ts.map +1 -1
- package/build/instrumentation/performance/constants.js +73 -2
- package/build/instrumentation/performance/performance-tester.d.ts +11 -0
- package/build/instrumentation/performance/performance-tester.d.ts.map +1 -1
- package/build/instrumentation/performance/performance-tester.js +115 -12
- package/build/launcher.d.ts +1 -0
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +151 -6
- package/build/service.d.ts.map +1 -1
- package/build/service.js +77 -5
- 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 +42 -0
- package/build/testorchestration/helpers.d.ts +20 -0
- package/build/testorchestration/helpers.d.ts.map +1 -0
- package/build/testorchestration/helpers.js +412 -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 +81 -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 +168 -0
- package/build/testorchestration/testorcherstrationhandler.d.ts +50 -0
- package/build/testorchestration/testorcherstrationhandler.d.ts.map +1 -0
- package/build/testorchestration/testorcherstrationhandler.js +133 -0
- package/build/testorchestration/testorcherstrationutils.d.ts +86 -0
- package/build/testorchestration/testorcherstrationutils.d.ts.map +1 -0
- package/build/testorchestration/testorcherstrationutils.js +379 -0
- package/build/types.d.ts +21 -0
- package/build/types.d.ts.map +1 -1
- package/build/util.d.ts +33 -4
- package/build/util.d.ts.map +1 -1
- package/build/util.js +112 -18
- package/package.json +3 -2
- package/tsconfig.prod.tsbuildinfo +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference path="../../@types/bstack-service-types.d.ts" />
|
|
2
2
|
import BaseModule from './baseModule.js';
|
|
3
|
+
import { BrowserstackCLI } from '../index.js';
|
|
3
4
|
import { BStackLogger } from '../cliLogger.js';
|
|
4
5
|
import TestFramework from '../frameworks/testFramework.js';
|
|
5
6
|
import AutomationFramework from '../frameworks/automationFramework.js';
|
|
@@ -7,7 +8,7 @@ import { TestFrameworkState } from '../states/testFrameworkState.js';
|
|
|
7
8
|
import { AutomationFrameworkState } from '../states/automationFrameworkState.js';
|
|
8
9
|
import { HookState } from '../states/hookState.js';
|
|
9
10
|
import accessibilityScripts from '../../scripts/accessibility-scripts.js';
|
|
10
|
-
import { _getParamsForAppAccessibility, formatString, getAppA11yResults, getAppA11yResultsSummary, shouldScanTestForAccessibility, validateCapsWithA11y, validateCapsWithAppA11y, validateCapsWithNonBstackA11y } from '../../util.js';
|
|
11
|
+
import { _getParamsForAppAccessibility, formatString, getAppA11yResults, getAppA11yResultsSummary, shouldScanTestForAccessibility, validateCapsWithA11y, validateCapsWithAppA11y, validateCapsWithNonBstackA11y, setBrowserstackAnnotation } from '../../util.js';
|
|
11
12
|
import { AutomationFrameworkConstants } from '../frameworks/constants/automationFrameworkConstants.js';
|
|
12
13
|
import util from 'node:util';
|
|
13
14
|
import PerformanceTester from '../../instrumentation/performance/performance-tester.js';
|
|
@@ -18,12 +19,16 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
18
19
|
name;
|
|
19
20
|
scriptInstance;
|
|
20
21
|
accessibility = false;
|
|
22
|
+
autoScanning = true;
|
|
21
23
|
isAppAccessibility;
|
|
22
24
|
isNonBstackA11y;
|
|
23
25
|
accessibilityConfig;
|
|
24
26
|
static MODULE_NAME = 'AccessibilityModule';
|
|
25
27
|
accessibilityMap;
|
|
26
28
|
LOG_DISABLED_SHOWN;
|
|
29
|
+
testMetadata = {};
|
|
30
|
+
centralAuthA11yConfig = {};
|
|
31
|
+
centralAuthConfigFetched = false;
|
|
27
32
|
constructor(accessibilityConfig, isNonBstackA11y) {
|
|
28
33
|
super();
|
|
29
34
|
this.name = 'AccessibilityModule';
|
|
@@ -31,7 +36,9 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
31
36
|
AutomationFramework.registerObserver(AutomationFrameworkState.CREATE, HookState.POST, this.onBeforeExecute.bind(this));
|
|
32
37
|
TestFramework.registerObserver(TestFrameworkState.TEST, HookState.PRE, this.onBeforeTest.bind(this));
|
|
33
38
|
TestFramework.registerObserver(TestFrameworkState.TEST, HookState.POST, this.onAfterTest.bind(this));
|
|
34
|
-
this.accessibility =
|
|
39
|
+
this.accessibility = Boolean(accessibilityConfig);
|
|
40
|
+
const accessibilityOptions = BrowserstackCLI.getInstance().options?.accessibilityOptions;
|
|
41
|
+
this.autoScanning = accessibilityOptions?.autoScanning ?? true;
|
|
35
42
|
this.scriptInstance = accessibilityScripts;
|
|
36
43
|
this.accessibilityMap = new Map();
|
|
37
44
|
this.LOG_DISABLED_SHOWN = new Map();
|
|
@@ -89,8 +96,23 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
89
96
|
};
|
|
90
97
|
//patching performScan
|
|
91
98
|
browser.performScan = async () => {
|
|
99
|
+
if (!this.accessibility && !this.isAppAccessibility) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
92
102
|
return await this.performScanCli(browser);
|
|
93
103
|
};
|
|
104
|
+
browser.startA11yScanning = async () => {
|
|
105
|
+
if (!this.accessibility && !this.isAppAccessibility) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.logger.warn('Accessibility scanning cannot be started from outside the test');
|
|
109
|
+
};
|
|
110
|
+
browser.stopA11yScanning = async () => {
|
|
111
|
+
if (!this.accessibility && !this.isAppAccessibility) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.logger.warn('Accessibility scanning cannot be stopped from outside the test');
|
|
115
|
+
};
|
|
94
116
|
if (!this.accessibility) {
|
|
95
117
|
this.logger.info('Accessibility automation is disabled for this session.');
|
|
96
118
|
return;
|
|
@@ -149,16 +171,52 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
149
171
|
const testInstance = TestFramework.getTrackedInstance();
|
|
150
172
|
const sessionId = AutomationFramework.getState(autoInstance, AutomationFrameworkConstants.KEY_FRAMEWORK_SESSION_ID);
|
|
151
173
|
const accessibilityOptions = this.config.accessibilityOptions;
|
|
152
|
-
const shouldScanTest = shouldScanTestForAccessibility(suiteTitle, test.title, accessibilityOptions) && this.accessibility;
|
|
174
|
+
const shouldScanTest = this.autoScanning && shouldScanTestForAccessibility(suiteTitle, test.title, accessibilityOptions) && this.accessibility;
|
|
175
|
+
this.accessibilityMap.set(sessionId, shouldScanTest);
|
|
153
176
|
// Create test metadata similar to accessibility-handler
|
|
154
|
-
const testIdentifier = testInstance.getContext().getId();
|
|
155
|
-
|
|
177
|
+
const testIdentifier = String(testInstance.getContext().getId());
|
|
178
|
+
this.testMetadata[testIdentifier] = {
|
|
156
179
|
scanTestForAccessibility: shouldScanTest,
|
|
157
180
|
accessibilityScanStarted: shouldScanTest
|
|
158
181
|
};
|
|
182
|
+
const browser = AutomationFramework.getDriver(autoInstance);
|
|
183
|
+
browser.startA11yScanning = async () => {
|
|
184
|
+
if (!this.accessibility && !this.isAppAccessibility) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.accessibilityMap.set(sessionId, true);
|
|
188
|
+
this.testMetadata[testIdentifier] = {
|
|
189
|
+
scanTestForAccessibility: true,
|
|
190
|
+
accessibilityScanStarted: true
|
|
191
|
+
};
|
|
192
|
+
TestFramework.setState(testInstance, `accessibility_metadata_${testIdentifier}`, this.testMetadata[testIdentifier]);
|
|
193
|
+
await this._setAnnotation('Accessibility scanning has started');
|
|
194
|
+
};
|
|
195
|
+
browser.stopA11yScanning = async () => {
|
|
196
|
+
if (!this.accessibility && !this.isAppAccessibility) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this.accessibilityMap.set(sessionId, false);
|
|
200
|
+
await this._setAnnotation('Accessibility scanning has stopped');
|
|
201
|
+
};
|
|
202
|
+
browser.performScan = async () => {
|
|
203
|
+
if (!this.accessibility && !this.isAppAccessibility) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const results = await this.performScanCli(browser);
|
|
207
|
+
if (results) {
|
|
208
|
+
const testIdentifier = String(testInstance.getContext().getId());
|
|
209
|
+
this.testMetadata[testIdentifier] = {
|
|
210
|
+
scanTestForAccessibility: true,
|
|
211
|
+
accessibilityScanStarted: true
|
|
212
|
+
};
|
|
213
|
+
TestFramework.setState(testInstance, `accessibility_metadata_${testIdentifier}`, this.testMetadata[testIdentifier]);
|
|
214
|
+
await this._setAnnotation('Accessibility scanning was triggered manually');
|
|
215
|
+
}
|
|
216
|
+
return results;
|
|
217
|
+
};
|
|
159
218
|
// Store test metadata in test instance
|
|
160
|
-
TestFramework.setState(testInstance, `accessibility_metadata_${testIdentifier}`, testMetadata);
|
|
161
|
-
this.accessibilityMap.set(sessionId, shouldScanTest);
|
|
219
|
+
TestFramework.setState(testInstance, `accessibility_metadata_${testIdentifier}`, this.testMetadata[testIdentifier]);
|
|
162
220
|
// Log if accessibility scan is enabled for this test
|
|
163
221
|
if (shouldScanTest) {
|
|
164
222
|
this.logger.info('Accessibility test case execution has started.');
|
|
@@ -183,7 +241,7 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
183
241
|
return;
|
|
184
242
|
}
|
|
185
243
|
// Get test metadata that was stored in onBeforeTest
|
|
186
|
-
const testIdentifier = testInstance.getContext().getId();
|
|
244
|
+
const testIdentifier = String(testInstance.getContext().getId());
|
|
187
245
|
const testMetadata = testInstance.getData(`accessibility_metadata_${testIdentifier}`);
|
|
188
246
|
if (!testMetadata) {
|
|
189
247
|
this.logger.debug('No accessibility metadata found for this test');
|
|
@@ -204,7 +262,7 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
204
262
|
'thBuildUuid': process.env.BROWSERSTACK_TESTHUB_UUID,
|
|
205
263
|
'thJwtToken': process.env.BROWSERSTACK_TESTHUB_JWT
|
|
206
264
|
};
|
|
207
|
-
const driverExecuteParams = await this.getDriverExecuteParams();
|
|
265
|
+
const driverExecuteParams = await this.getDriverExecuteParams('saveResults');
|
|
208
266
|
dataForExtension = { ...dataForExtension, ...driverExecuteParams };
|
|
209
267
|
// final scan and saving the results
|
|
210
268
|
await this.sendTestStopEvent(browser, dataForExtension);
|
|
@@ -257,12 +315,23 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
257
315
|
async performScanCli(browser, commandName) {
|
|
258
316
|
return await PerformanceTester.measureWrapper(PERFORMANCE_SDK_EVENTS.A11Y_EVENTS.PERFORM_SCAN, async () => {
|
|
259
317
|
try {
|
|
318
|
+
// Fetch central auth accessibility configuration
|
|
319
|
+
const centralAuthConfig = await this.fetchCentralAuthA11yConfig('scan');
|
|
260
320
|
if (!this.accessibility) {
|
|
261
321
|
this.logger.debug('Not an Accessibility Automation session.');
|
|
262
322
|
return;
|
|
263
323
|
}
|
|
264
324
|
if (this.isAppAccessibility) {
|
|
265
|
-
|
|
325
|
+
// Get app accessibility params and merge with central auth config
|
|
326
|
+
const appAccessibilityParams = _getParamsForAppAccessibility(commandName);
|
|
327
|
+
// Merge with central auth config
|
|
328
|
+
const mergedParams = { ...appAccessibilityParams, ...centralAuthConfig };
|
|
329
|
+
// Use centralAuthToken if available
|
|
330
|
+
if (centralAuthConfig.centralAuthToken) {
|
|
331
|
+
// Set the auth header with the token value
|
|
332
|
+
mergedParams.centralAuthHeader = centralAuthConfig.centralAuthToken;
|
|
333
|
+
}
|
|
334
|
+
const results = await browser.execute(formatString(this.scriptInstance.performScan, JSON.stringify(mergedParams)), {});
|
|
266
335
|
BStackLogger.debug(util.format(results));
|
|
267
336
|
return results;
|
|
268
337
|
}
|
|
@@ -277,12 +346,16 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
277
346
|
}
|
|
278
347
|
async sendTestStopEvent(browser, dataForExtension) {
|
|
279
348
|
try {
|
|
349
|
+
const autoInstance = AutomationFramework.getTrackedInstance();
|
|
350
|
+
const sessionId = AutomationFramework.getState(autoInstance, AutomationFrameworkConstants.KEY_FRAMEWORK_SESSION_ID);
|
|
280
351
|
if (!this.accessibility) {
|
|
281
352
|
this.logger.debug('Not an Accessibility Automation session.');
|
|
282
353
|
return;
|
|
283
354
|
}
|
|
284
|
-
this.
|
|
285
|
-
|
|
355
|
+
if (sessionId && this.accessibilityMap.get(sessionId)) {
|
|
356
|
+
this.logger.debug('Performing scan before saving results');
|
|
357
|
+
await this.performScanCli(browser);
|
|
358
|
+
}
|
|
286
359
|
if (this.isAppAccessibility) {
|
|
287
360
|
return;
|
|
288
361
|
}
|
|
@@ -332,10 +405,10 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
332
405
|
}
|
|
333
406
|
})();
|
|
334
407
|
}
|
|
335
|
-
async getDriverExecuteParams() {
|
|
408
|
+
async getDriverExecuteParams(scriptName) {
|
|
336
409
|
const payload = {
|
|
337
410
|
product: 'accessibility',
|
|
338
|
-
scriptName:
|
|
411
|
+
scriptName: scriptName
|
|
339
412
|
};
|
|
340
413
|
const response = await GrpcClient.getInstance().fetchDriverExecuteParamsEvent(payload);
|
|
341
414
|
if (response.success) {
|
|
@@ -344,4 +417,30 @@ export default class AccessibilityModule extends BaseModule {
|
|
|
344
417
|
this.logger.error(`Failed to fetch driver execute params: ${response.error || 'Unknown error'}`);
|
|
345
418
|
return {};
|
|
346
419
|
}
|
|
420
|
+
async _setAnnotation(message) {
|
|
421
|
+
const autoInstance = AutomationFramework.getTrackedInstance();
|
|
422
|
+
const browser = AutomationFramework.getDriver(autoInstance);
|
|
423
|
+
await setBrowserstackAnnotation(browser, message, this.accessibility);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Fetch central auth accessibility configuration for the given script name.
|
|
427
|
+
* Returns cached config if already fetched, otherwise loads and caches it.
|
|
428
|
+
*
|
|
429
|
+
* @param scriptName - Name of the script to fetch config for
|
|
430
|
+
* @returns Configuration object, empty object if error occurs
|
|
431
|
+
*/
|
|
432
|
+
async fetchCentralAuthA11yConfig(scriptName) {
|
|
433
|
+
try {
|
|
434
|
+
if (this.centralAuthConfigFetched) {
|
|
435
|
+
return this.centralAuthA11yConfig;
|
|
436
|
+
}
|
|
437
|
+
this.centralAuthA11yConfig = await this.getDriverExecuteParams(scriptName);
|
|
438
|
+
this.centralAuthConfigFetched = true;
|
|
439
|
+
return this.centralAuthA11yConfig;
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
this.logger.error(`fetchCentralAuthA11yConfig: Failed to fetch driver execute params for ${scriptName}: ${util.format(error)}`);
|
|
443
|
+
return {};
|
|
444
|
+
}
|
|
445
|
+
}
|
|
347
446
|
}
|
package/build/constants.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare const BSTACK_SERVICE_VERSION: any;
|
|
|
19
19
|
export declare const UPDATED_CLI_ENDPOINT = "sdk/v1/update_cli";
|
|
20
20
|
export declare const CLI_STOP_TIMEOUT = 3000;
|
|
21
21
|
export declare const NOT_ALLOWED_KEYS_IN_CAPS: string[];
|
|
22
|
+
export declare const BROWSERSTACK_TEST_PLAN_ID = "BROWSERSTACK_TEST_PLAN_ID";
|
|
22
23
|
export declare const LOGS_FILE = "logs/bstack-wdio-service.log";
|
|
23
24
|
export declare const CLI_DEBUG_LOGS_FILE = "log/sdk-cli-debug.log";
|
|
24
25
|
export declare const UPLOAD_LOGS_ADDRESS = "https://upload-observability.browserstack.com";
|
|
@@ -65,4 +66,31 @@ export declare const MAX_GIT_META_DATA_SIZE_IN_BYTES: number;
|
|
|
65
66
|
export declare const GIT_META_DATA_TRUNCATED = "...[TRUNCATED]";
|
|
66
67
|
export declare const WDIO_NAMING_PREFIX = "WebdriverIO-";
|
|
67
68
|
export declare const PERF_METRICS_WAIT_TIME = 2000;
|
|
69
|
+
/**
|
|
70
|
+
* Module Hook Events - Performance event names for module lifecycle tracking
|
|
71
|
+
* Used by module-hook-tracker.ts to instrument module initialization and cleanup
|
|
72
|
+
*/
|
|
73
|
+
export declare const MODULE_HOOK_EVENTS: {
|
|
74
|
+
readonly INSTRUMENTATION_ON_START: "MODULE_INSTRUMENTATION_ON_START";
|
|
75
|
+
readonly INSTRUMENTATION_ON_STOP: "MODULE_INSTRUMENTATION_ON_STOP";
|
|
76
|
+
readonly TESTHUB_ON_START: "MODULE_TESTHUB_ON_START";
|
|
77
|
+
readonly TESTHUB_ON_STOP: "MODULE_TESTHUB_ON_STOP";
|
|
78
|
+
readonly OBSERVABILITY_ON_START: "MODULE_OBSERVABILITY_ON_START";
|
|
79
|
+
readonly OBSERVABILITY_ON_STOP: "MODULE_OBSERVABILITY_ON_STOP";
|
|
80
|
+
readonly PERCY_ON_START: "MODULE_PERCY_ON_START";
|
|
81
|
+
readonly PERCY_ON_STOP: "MODULE_PERCY_ON_STOP";
|
|
82
|
+
readonly ACCESSIBILITY_ON_START: "MODULE_ACCESSIBILITY_ON_START";
|
|
83
|
+
readonly ACCESSIBILITY_ON_STOP: "MODULE_ACCESSIBILITY_ON_STOP";
|
|
84
|
+
readonly ACCESSIBILITY_ON_DRIVER_INIT: "MODULE_ACCESSIBILITY_ON_DRIVER_INIT";
|
|
85
|
+
readonly AI_ON_START: "MODULE_AI_ON_START";
|
|
86
|
+
readonly AI_ON_STOP: "MODULE_AI_ON_STOP";
|
|
87
|
+
readonly AI_BEFORE_SESSION: "MODULE_AI_BEFORE_SESSION";
|
|
88
|
+
readonly AI_ON_DRIVER_INIT: "MODULE_AI_ON_DRIVER_INIT";
|
|
89
|
+
readonly LOCAL_ON_START: "MODULE_LOCAL_ON_START";
|
|
90
|
+
readonly LOCAL_ON_STOP: "MODULE_LOCAL_ON_STOP";
|
|
91
|
+
readonly LOCAL_INIT_SESSION: "MODULE_LOCAL_INIT_SESSION";
|
|
92
|
+
readonly LOCAL_ON_DRIVER_INIT: "MODULE_LOCAL_ON_DRIVER_INIT";
|
|
93
|
+
readonly APPAUTOMATE_ON_START: "MODULE_APPAUTOMATE_ON_START";
|
|
94
|
+
readonly APPAUTOMATE_ON_DRIVER_INIT: "MODULE_APPAUTOMATE_ON_DRIVER_INIT";
|
|
95
|
+
};
|
|
68
96
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,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AAsB,iCAAiC,CAAA;AAGpE,eAAO,MAAM,yBAAyB,8BAA8B,CAAA;AAGpE,eAAO,MAAM,iBAAiB,sBAAsB,CAAA;AAGpD,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AAGxE,eAAO,MAAM,eAAe,6BAA6B,CAAA;AAGzD,eAAO,MAAM,SAAS,uBAAuB,CAAA;AAG7C,eAAO,MAAM,2BAA2B,+BAA+B,CAAA;AAGvE,eAAO,MAAM,kBAAkB,uBAAuB,CAAA;AAEtD,eAAO,MAAM,2BAA2B,gCAAgC,CAAA;AAGxE,eAAO,MAAM,0BAA0B,+BAA+B,CAAA;AAGtE,eAAO,MAAM,2BAA2B,gCAAgC,CAAA;AAGxE,eAAO,MAAM,iCAAiC,sCAAsC,CAAA;AAGpF,eAAO,MAAM,wBAAwB,6BAA6B,CAAA;AAGlE,eAAO,MAAM,yBAAyB,8BAA8B,CAAA;AAGpE,eAAO,MAAM,2BAA2B,gCAAgC,CAAA;AAGxE,eAAO,MAAM,0BAA0B,+BAA+B,CAAA;AAGtE,eAAO,MAAM,4BAA4B,iCAAiC,CAAA;AAC1E,eAAO,MAAM,6BAA6B,kCAAkC,CAAA;AAC5E,eAAO,MAAM,+BAA+B,oCAAoC,CAAA;AAGhF,eAAO,MAAM,+BAA+B,QAAY,CAAA;AAKxD,eAAO,MAAM,uBAAuB,mBAAmB,CAAA;AAEvD,eAAO,MAAM,kBAAkB,iBAAiB,CAAA;AAEhD,eAAO,MAAM,sBAAsB,OAAO,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;CAqCrB,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -39,7 +39,8 @@ export const DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = 100; // 100ms
|
|
|
39
39
|
export const BSTACK_SERVICE_VERSION = bstackServiceVersion;
|
|
40
40
|
export const UPDATED_CLI_ENDPOINT = 'sdk/v1/update_cli';
|
|
41
41
|
export const CLI_STOP_TIMEOUT = 3000;
|
|
42
|
-
export const NOT_ALLOWED_KEYS_IN_CAPS = ['includeTagsInTestingScope', 'excludeTagsInTestingScope'];
|
|
42
|
+
export const NOT_ALLOWED_KEYS_IN_CAPS = ['includeTagsInTestingScope', 'excludeTagsInTestingScope', 'testManagementOptions'];
|
|
43
|
+
export const BROWSERSTACK_TEST_PLAN_ID = 'BROWSERSTACK_TEST_PLAN_ID';
|
|
43
44
|
export const LOGS_FILE = 'logs/bstack-wdio-service.log';
|
|
44
45
|
export const CLI_DEBUG_LOGS_FILE = 'log/sdk-cli-debug.log';
|
|
45
46
|
export const UPLOAD_LOGS_ADDRESS = 'https://upload-observability.browserstack.com';
|
|
@@ -117,3 +118,38 @@ MAX_GIT_META_DATA_SIZE_IN_BYTES
|
|
|
117
118
|
export const GIT_META_DATA_TRUNCATED = '...[TRUNCATED]';
|
|
118
119
|
export const WDIO_NAMING_PREFIX = 'WebdriverIO-';
|
|
119
120
|
export const PERF_METRICS_WAIT_TIME = 2000;
|
|
121
|
+
/**
|
|
122
|
+
* Module Hook Events - Performance event names for module lifecycle tracking
|
|
123
|
+
* Used by module-hook-tracker.ts to instrument module initialization and cleanup
|
|
124
|
+
*/
|
|
125
|
+
export const MODULE_HOOK_EVENTS = {
|
|
126
|
+
// Instrumentation module
|
|
127
|
+
INSTRUMENTATION_ON_START: 'MODULE_INSTRUMENTATION_ON_START',
|
|
128
|
+
INSTRUMENTATION_ON_STOP: 'MODULE_INSTRUMENTATION_ON_STOP',
|
|
129
|
+
// TestHub module
|
|
130
|
+
TESTHUB_ON_START: 'MODULE_TESTHUB_ON_START',
|
|
131
|
+
TESTHUB_ON_STOP: 'MODULE_TESTHUB_ON_STOP',
|
|
132
|
+
// Observability module
|
|
133
|
+
OBSERVABILITY_ON_START: 'MODULE_OBSERVABILITY_ON_START',
|
|
134
|
+
OBSERVABILITY_ON_STOP: 'MODULE_OBSERVABILITY_ON_STOP',
|
|
135
|
+
// Percy module
|
|
136
|
+
PERCY_ON_START: 'MODULE_PERCY_ON_START',
|
|
137
|
+
PERCY_ON_STOP: 'MODULE_PERCY_ON_STOP',
|
|
138
|
+
// Accessibility module
|
|
139
|
+
ACCESSIBILITY_ON_START: 'MODULE_ACCESSIBILITY_ON_START',
|
|
140
|
+
ACCESSIBILITY_ON_STOP: 'MODULE_ACCESSIBILITY_ON_STOP',
|
|
141
|
+
ACCESSIBILITY_ON_DRIVER_INIT: 'MODULE_ACCESSIBILITY_ON_DRIVER_INIT',
|
|
142
|
+
// AI module
|
|
143
|
+
AI_ON_START: 'MODULE_AI_ON_START',
|
|
144
|
+
AI_ON_STOP: 'MODULE_AI_ON_STOP',
|
|
145
|
+
AI_BEFORE_SESSION: 'MODULE_AI_BEFORE_SESSION',
|
|
146
|
+
AI_ON_DRIVER_INIT: 'MODULE_AI_ON_DRIVER_INIT',
|
|
147
|
+
// Local testing module
|
|
148
|
+
LOCAL_ON_START: 'MODULE_LOCAL_ON_START',
|
|
149
|
+
LOCAL_ON_STOP: 'MODULE_LOCAL_ON_STOP',
|
|
150
|
+
LOCAL_INIT_SESSION: 'MODULE_LOCAL_INIT_SESSION',
|
|
151
|
+
LOCAL_ON_DRIVER_INIT: 'MODULE_LOCAL_ON_DRIVER_INIT',
|
|
152
|
+
// App Automate module
|
|
153
|
+
APPAUTOMATE_ON_START: 'MODULE_APPAUTOMATE_ON_START',
|
|
154
|
+
APPAUTOMATE_ON_DRIVER_INIT: 'MODULE_APPAUTOMATE_ON_DRIVER_INIT',
|
|
155
|
+
};
|
package/build/exitHandler.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import BrowserStackConfig from './config.js';
|
|
2
2
|
export declare function setupExitHandlers(): void;
|
|
3
|
-
export declare function shouldCallCleanup(config: BrowserStackConfig): string[];
|
|
3
|
+
export declare function shouldCallCleanup(config: BrowserStackConfig, isCLIEnabled?: boolean): string[];
|
|
4
4
|
//# sourceMappingURL=exitHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitHandler.d.ts","sourceRoot":"","sources":["../src/exitHandler.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,MAAM,aAAa,CAAA;AA4B5C,wBAAgB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"exitHandler.d.ts","sourceRoot":"","sources":["../src/exitHandler.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,MAAM,aAAa,CAAA;AA4B5C,wBAAgB,iBAAiB,SA2DhC;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,YAAY,UAAQ,GAAG,MAAM,EAAE,CAmB5F"}
|
package/build/exitHandler.js
CHANGED
|
@@ -39,8 +39,8 @@ export function setupExitHandlers() {
|
|
|
39
39
|
BStackLogger.debug('CLI process terminated successfully with SIGTERM (Windows)');
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
cliProcess.kill('
|
|
43
|
-
BStackLogger.debug('CLI process terminated successfully with
|
|
42
|
+
cliProcess.kill('SIGINT');
|
|
43
|
+
BStackLogger.debug('CLI process terminated successfully with SIGINT (Unix)');
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
catch (processError) {
|
|
@@ -64,8 +64,9 @@ export function setupExitHandlers() {
|
|
|
64
64
|
};
|
|
65
65
|
process.on('exit', () => {
|
|
66
66
|
BStackLogger.debug('Exit handler called');
|
|
67
|
+
const isCLIEnabled = BrowserstackCLI.getInstance().isRunning();
|
|
67
68
|
handleCLICleanup();
|
|
68
|
-
const args = shouldCallCleanup(BrowserStackConfig.getInstance());
|
|
69
|
+
const args = shouldCallCleanup(BrowserStackConfig.getInstance(), isCLIEnabled);
|
|
69
70
|
if (Array.isArray(args) && args.length) {
|
|
70
71
|
BStackLogger.debug(`Spawning cleanup.js with args: ${args.join(', ')}`);
|
|
71
72
|
const childProcess = spawn('node', [`${path.join(__dirname, 'cleanup.js')}`, ...args], {
|
|
@@ -84,13 +85,13 @@ export function setupExitHandlers() {
|
|
|
84
85
|
});
|
|
85
86
|
BStackLogger.debug('Exit handlers registered');
|
|
86
87
|
}
|
|
87
|
-
export function shouldCallCleanup(config) {
|
|
88
|
+
export function shouldCallCleanup(config, isCLIEnabled = false) {
|
|
88
89
|
const args = [];
|
|
89
90
|
if (!!process.env[BROWSERSTACK_TESTHUB_JWT] && !config.testObservability.buildStopped) {
|
|
90
91
|
args.push('--observability');
|
|
91
92
|
}
|
|
92
93
|
if (config.userName && config.accessKey && !config.funnelDataSent) {
|
|
93
|
-
const savedFilePath = saveFunnelData('SDKTestSuccessful', config);
|
|
94
|
+
const savedFilePath = saveFunnelData('SDKTestSuccessful', config, isCLIEnabled);
|
|
94
95
|
args.push('--funnelData', savedFilePath);
|
|
95
96
|
}
|
|
96
97
|
if (PerformanceTester.isEnabled()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGzE,OAAO,KAAK,EAAiB,OAAO,EAAE,QAAQ,EAAsB,YAAY,EAAE,kBAAkB,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAGjK,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAiBpD,OAAO,KAAK,EACR,QAAQ,EACR,QAAQ,EAER,cAAc,EACd,MAAM,EACN,OAAO,EACV,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,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AE,KAAK,EAAE,sBAAsB;IAM5C,UAAU,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM;IAoBzD,SAAS,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,YAAY;IA4B/F;;OAEG;IAEH,iBAAiB,WAAkB,MAAM,mBAkBxC;IAEK,cAAc,CAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,GAAG,sBAAsB;IA2EtI;;;OAGG;IACI,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO;IAgBlE,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,UAAU;IA4ElB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,yBAAyB;IAwGpB,iBAAiB;IAUxB,WAAW;IAsBjB,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,aAAa;CAMxB;AAGD,QAAA,MAAM,eAAe,EAAE,OAAO,gBAA0D,CAAA;AACxF,KAAK,eAAe,GAAG,gBAAgB,CAAA;AAEvC,eAAe,eAAe,CAAA"}
|
|
@@ -8,6 +8,8 @@ import { TESTOPS_SCREENSHOT_ENV } from './constants.js';
|
|
|
8
8
|
import { BrowserstackCLI } from './cli/index.js';
|
|
9
9
|
import { TestFrameworkState } from './cli/states/testFrameworkState.js';
|
|
10
10
|
import { HookState } from './cli/states/hookState.js';
|
|
11
|
+
import PerformanceTester from './instrumentation/performance/performance-tester.js';
|
|
12
|
+
import * as PERFORMANCE_SDK_EVENTS from './instrumentation/performance/constants.js';
|
|
11
13
|
class _InsightsHandler {
|
|
12
14
|
_browser;
|
|
13
15
|
_framework;
|
|
@@ -37,7 +39,7 @@ class _InsightsHandler {
|
|
|
37
39
|
this._userCaps = _userCaps;
|
|
38
40
|
this._options = _options;
|
|
39
41
|
this._platformMeta = {
|
|
40
|
-
browserName: caps
|
|
42
|
+
browserName: caps?.browserName,
|
|
41
43
|
browserVersion: caps?.browserVersion,
|
|
42
44
|
platformName: caps?.platformName,
|
|
43
45
|
caps: caps,
|
|
@@ -68,6 +70,7 @@ class _InsightsHandler {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
async before() {
|
|
73
|
+
PerformanceTester.start(PERFORMANCE_SDK_EVENTS.CONFIG_EVENTS.OBSERVABILITY);
|
|
71
74
|
if (isBrowserstackSession(this._browser)) {
|
|
72
75
|
await this._browser.execute(`browserstack_executor: ${JSON.stringify({
|
|
73
76
|
action: 'annotate',
|
|
@@ -81,6 +84,7 @@ class _InsightsHandler {
|
|
|
81
84
|
if (gitMeta) {
|
|
82
85
|
this._gitConfigPath = gitMeta.root;
|
|
83
86
|
}
|
|
87
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.CONFIG_EVENTS.OBSERVABILITY);
|
|
84
88
|
}
|
|
85
89
|
getCucumberHookType(test) {
|
|
86
90
|
let hookType = null;
|
|
@@ -484,12 +488,34 @@ class _InsightsHandler {
|
|
|
484
488
|
const body = 'body' in args ? args.body : undefined;
|
|
485
489
|
const result = 'result' in args ? args.result : undefined;
|
|
486
490
|
if (Boolean(process.env[TESTOPS_SCREENSHOT_ENV]) && isScreenshotCommand(args) && result?.value) {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
491
|
+
/**
|
|
492
|
+
* SDK-6277: in the CLI/binary (v8) flow, forward the screenshot to the binary over gRPC
|
|
493
|
+
* as a TEST_SCREENSHOT log. The binary uploads it via its own authorized testhub session.
|
|
494
|
+
* The direct-HTTP listener.onScreenshot() path 401s in CLI mode (the worker's binary-issued
|
|
495
|
+
* JWT is not valid for direct collector POSTs).
|
|
496
|
+
*/
|
|
497
|
+
await (BrowserstackCLI.getInstance().isRunning()
|
|
498
|
+
? BrowserstackCLI.getInstance().getTestFramework().trackEvent(TestFrameworkState.LOG, HookState.POST, {
|
|
499
|
+
logEntry: {
|
|
500
|
+
kind: 'TEST_SCREENSHOT',
|
|
501
|
+
message: result.value,
|
|
502
|
+
level: 'INFO',
|
|
503
|
+
timestamp: new Date().toISOString()
|
|
504
|
+
}
|
|
505
|
+
})
|
|
506
|
+
: this.listener.onScreenshot([{
|
|
507
|
+
test_run_uuid: testMeta.uuid,
|
|
508
|
+
timestamp: new Date().toISOString(),
|
|
509
|
+
message: result.value,
|
|
510
|
+
kind: 'TEST_SCREENSHOT'
|
|
511
|
+
}]));
|
|
512
|
+
}
|
|
513
|
+
if (BrowserstackCLI.getInstance().isRunning()) {
|
|
514
|
+
/**
|
|
515
|
+
* SDK-6277: in CLI mode the binary captures command/network logs itself; the service only
|
|
516
|
+
* forwards the screenshot above. The direct-HTTP per-command logCreated() path 401s here.
|
|
517
|
+
*/
|
|
518
|
+
return;
|
|
493
519
|
}
|
|
494
520
|
const requestData = this._commands[dataKey];
|
|
495
521
|
if (!requestData) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type BrowserStackConfig from '../config.js';
|
|
2
2
|
import type { BrowserstackHealing } from '@browserstack/ai-sdk-node';
|
|
3
3
|
export declare function sendStart(config: BrowserStackConfig): Promise<void>;
|
|
4
|
-
export declare function sendFinish(config: BrowserStackConfig): Promise<void>;
|
|
5
|
-
export declare function saveFunnelData(eventType: string, config: BrowserStackConfig): string;
|
|
4
|
+
export declare function sendFinish(config: BrowserStackConfig, isCLIEnabled?: boolean): Promise<void>;
|
|
5
|
+
export declare function saveFunnelData(eventType: string, config: BrowserStackConfig, isCLIEnabled?: boolean): string;
|
|
6
6
|
export declare function fireFunnelRequest(data: any): Promise<void>;
|
|
7
7
|
export declare function handleHealingInstrumentation(authResult: BrowserstackHealing.InitErrorResponse | BrowserstackHealing.InitSuccessResponse, config: BrowserStackConfig, isSelfHealEnabled: boolean | undefined): void;
|
|
8
8
|
//# sourceMappingURL=funnelInstrumentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funnelInstrumentation.d.ts","sourceRoot":"","sources":["../../src/instrumentation/funnelInstrumentation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,kBAAkB,MAAM,cAAc,CAAA;AAIlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"funnelInstrumentation.d.ts","sourceRoot":"","sources":["../../src/instrumentation/funnelInstrumentation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,kBAAkB,MAAM,cAAc,CAAA;AAIlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAuBpE,wBAAsB,SAAS,CAAC,MAAM,EAAE,kBAAkB,iBAazD;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,YAAY,UAAQ,iBAUhF;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,YAAY,UAAQ,GAAG,MAAM,CAO1G;AAeD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAShE;AAuJD,wBAAgB,4BAA4B,CACxC,UAAU,EAAE,mBAAmB,CAAC,iBAAiB,GAAG,mBAAmB,CAAC,mBAAmB,EAC3F,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,OAAO,GAAG,SAAS,QA6BzC"}
|
|
@@ -10,13 +10,15 @@ import { BSTACK_A11Y_POLLING_TIMEOUT, BSTACK_SERVICE_VERSION, WDIO_NAMING_PREFIX
|
|
|
10
10
|
import { getDataFromWorkers, removeWorkersDataDir } from '../data-store.js';
|
|
11
11
|
import { getProductMap } from '../testHub/utils.js';
|
|
12
12
|
import APIUtils from '../cli/apiUtils.js';
|
|
13
|
-
|
|
13
|
+
import PerformanceTester from './performance/performance-tester.js';
|
|
14
|
+
import { EVENTS } from './performance/constants.js';
|
|
15
|
+
async function fireFunnelTestEvent(eventType, config, isCLIEnabled = false) {
|
|
14
16
|
if (!config.userName || !config.accessKey) {
|
|
15
17
|
BStackLogger.debug('username/accesskey not passed');
|
|
16
18
|
return;
|
|
17
19
|
}
|
|
18
20
|
try {
|
|
19
|
-
const data = buildEventData(eventType, config);
|
|
21
|
+
const data = buildEventData(eventType, config, isCLIEnabled);
|
|
20
22
|
await fireFunnelRequest(data);
|
|
21
23
|
BStackLogger.debug('Funnel event success');
|
|
22
24
|
if (eventType === 'SDKTestSuccessful') {
|
|
@@ -30,13 +32,31 @@ async function fireFunnelTestEvent(eventType, config) {
|
|
|
30
32
|
export async function sendStart(config) {
|
|
31
33
|
// Remove Workers folder if exists
|
|
32
34
|
removeWorkersDataDir();
|
|
33
|
-
|
|
35
|
+
// Track funnel test attempted event
|
|
36
|
+
PerformanceTester.start(EVENTS.SDK_FUNNEL_TEST_ATTEMPTED);
|
|
37
|
+
try {
|
|
38
|
+
await fireFunnelTestEvent('SDKTestAttempted', config);
|
|
39
|
+
PerformanceTester.end(EVENTS.SDK_FUNNEL_TEST_ATTEMPTED, true);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
PerformanceTester.end(EVENTS.SDK_FUNNEL_TEST_ATTEMPTED, false, error);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
34
45
|
}
|
|
35
|
-
export async function sendFinish(config) {
|
|
36
|
-
|
|
46
|
+
export async function sendFinish(config, isCLIEnabled = false) {
|
|
47
|
+
// Track funnel test successful event
|
|
48
|
+
PerformanceTester.start(EVENTS.SDK_FUNNEL_TEST_SUCCESSFUL);
|
|
49
|
+
try {
|
|
50
|
+
await fireFunnelTestEvent('SDKTestSuccessful', config, isCLIEnabled);
|
|
51
|
+
PerformanceTester.end(EVENTS.SDK_FUNNEL_TEST_SUCCESSFUL, true);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
PerformanceTester.end(EVENTS.SDK_FUNNEL_TEST_SUCCESSFUL, false, error);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
37
57
|
}
|
|
38
|
-
export function saveFunnelData(eventType, config) {
|
|
39
|
-
const data = buildEventData(eventType, config);
|
|
58
|
+
export function saveFunnelData(eventType, config, isCLIEnabled = false) {
|
|
59
|
+
const data = buildEventData(eventType, config, isCLIEnabled);
|
|
40
60
|
BStackLogger.ensureLogsFolder();
|
|
41
61
|
const filePath = path.join(BStackLogger.logFolderPath, 'funnelData.json');
|
|
42
62
|
fs.writeFileSync(filePath, JSON.stringify(data));
|
|
@@ -83,7 +103,7 @@ function getProductList(config) {
|
|
|
83
103
|
}
|
|
84
104
|
return products;
|
|
85
105
|
}
|
|
86
|
-
function buildEventData(eventType, config) {
|
|
106
|
+
function buildEventData(eventType, config, isCLIEnabled = false) {
|
|
87
107
|
const eventProperties = {
|
|
88
108
|
// Framework Details
|
|
89
109
|
language_framework: getLanguageFramework(config.framework),
|
|
@@ -102,6 +122,8 @@ function buildEventData(eventType, config) {
|
|
|
102
122
|
product: getProductList(config),
|
|
103
123
|
// framework details
|
|
104
124
|
framework: config.framework,
|
|
125
|
+
// CLI details
|
|
126
|
+
isCLIEnabled: isCLIEnabled,
|
|
105
127
|
};
|
|
106
128
|
if (TestOpsConfig.getInstance().buildHashedId) {
|
|
107
129
|
eventProperties.testhub_uuid = TestOpsConfig.getInstance().buildHashedId;
|
|
@@ -25,6 +25,36 @@ export declare const EVENTS: {
|
|
|
25
25
|
SDK_CLI_ON_STOP: string;
|
|
26
26
|
SDK_START_BIN_SESSION: string;
|
|
27
27
|
SDK_CONNECT_BIN_SESSION: string;
|
|
28
|
+
SDK_DRIVER_INIT: string;
|
|
29
|
+
SDK_FIND_NEAREST_HUB: string;
|
|
30
|
+
SDK_AUTOMATION_FRAMEWORK_INIT: string;
|
|
31
|
+
SDK_AUTOMATION_FRAMEWORK_START: string;
|
|
32
|
+
SDK_AUTOMATION_FRAMEWORK_STOP: string;
|
|
33
|
+
SDK_ACCESSIBILITY_CONFIG: string;
|
|
34
|
+
SDK_OBSERVABILITY_CONFIG: string;
|
|
35
|
+
SDK_AI_SELF_HEAL_STEP: string;
|
|
36
|
+
SDK_AI_SELF_HEAL_GET_RESULT: string;
|
|
37
|
+
SDK_TEST_FRAMEWORK_EVENT: string;
|
|
38
|
+
SDK_TEST_SESSION_EVENT: string;
|
|
39
|
+
SDK_CLI_LOG_CREATED_EVENT: string;
|
|
40
|
+
SDK_CLI_ENQUEUE_TEST_EVENT: string;
|
|
41
|
+
SDK_ON_STOP: string;
|
|
42
|
+
SDK_SEND_LOGS: string;
|
|
43
|
+
SDK_FUNNEL_TEST_ATTEMPTED: string;
|
|
44
|
+
SDK_FUNNEL_TEST_SUCCESSFUL: string;
|
|
45
|
+
SDK_UPLOAD_LOGS: string;
|
|
46
|
+
SDK_SEND_KEY_METRICS: string;
|
|
47
|
+
SDK_KEY_METRICS_PREPARATION: string;
|
|
48
|
+
SDK_KEY_METRICS_UPLOAD: string;
|
|
49
|
+
SDK_CLI_DOWNLOAD_BINARY: string;
|
|
50
|
+
SDK_CLI_BINARY_VERIFICATION: string;
|
|
51
|
+
SDK_LISTENER_WORKER_END: string;
|
|
52
|
+
SDK_PERCY_TEARDOWN: string;
|
|
53
|
+
SDK_WORKER_SAVE_DATA: string;
|
|
54
|
+
SDK_PERFORMANCE_REPORT_GEN: string;
|
|
55
|
+
SDK_PERFORMANCE_JSON_WRITE: string;
|
|
56
|
+
SDK_PERFORMANCE_HTML_GEN: string;
|
|
57
|
+
SDK_DEVICE_ALLOCATION: string;
|
|
28
58
|
};
|
|
29
59
|
export declare const TESTHUB_EVENTS: {
|
|
30
60
|
START: string;
|
|
@@ -83,5 +113,39 @@ export declare const DRIVER_EVENT: {
|
|
|
83
113
|
GET: string;
|
|
84
114
|
PRE_EXECUTE: string;
|
|
85
115
|
POST_EXECUTE: string;
|
|
116
|
+
INIT: string;
|
|
117
|
+
PRE_INITIALIZE: string;
|
|
118
|
+
POST_INITIALIZE: string;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Framework lifecycle events for automation framework tracking
|
|
122
|
+
*/
|
|
123
|
+
export declare const FRAMEWORK_EVENTS: {
|
|
124
|
+
INIT: string;
|
|
125
|
+
START: string;
|
|
126
|
+
STOP: string;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Module configuration events
|
|
130
|
+
*/
|
|
131
|
+
export declare const CONFIG_EVENTS: {
|
|
132
|
+
ACCESSIBILITY: string;
|
|
133
|
+
OBSERVABILITY: string;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* AI self-healing events
|
|
137
|
+
*/
|
|
138
|
+
export declare const AI_EVENTS: {
|
|
139
|
+
SELF_HEAL_STEP: string;
|
|
140
|
+
SELF_HEAL_GET_RESULT: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Event dispatcher events for test framework and session tracking
|
|
144
|
+
*/
|
|
145
|
+
export declare const DISPATCHER_EVENTS: {
|
|
146
|
+
TEST_FRAMEWORK: string;
|
|
147
|
+
TEST_SESSION: string;
|
|
148
|
+
LOG_CREATED: string;
|
|
149
|
+
ENQUEUE_TEST: string;
|
|
86
150
|
};
|
|
87
151
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/instrumentation/performance/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/instrumentation/performance/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgElB,CAAA;AAED,eAAO,MAAM,cAAc;;;CAG1B,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;CAY3B,CAAA;AAED,eAAO,MAAM,WAAW;;;;;CAKvB,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;CAQxB,CAAA;AAED,eAAO,MAAM,WAAW;;;;CAIvB,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;CAG7B,CAAA;AAED,eAAO,MAAM,mBAAmB;;CAE/B,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;CAQxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;CAGzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS;;;CAGrB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;CAK7B,CAAA"}
|