@wdio/browserstack-service 8.48.0 → 8.49.0
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/Percy/Percy-Handler.js +1 -0
- package/build/Percy/Percy-Handler.js.map +1 -0
- package/build/Percy/Percy.js +1 -0
- package/build/Percy/Percy.js.map +1 -0
- package/build/Percy/PercyBinary.js +1 -0
- package/build/Percy/PercyBinary.js.map +1 -0
- package/build/Percy/PercyCaptureMap.js +1 -0
- package/build/Percy/PercyCaptureMap.js.map +1 -0
- package/build/Percy/PercyHelper.d.ts.map +1 -1
- package/build/Percy/PercyHelper.js +1 -0
- package/build/Percy/PercyHelper.js.map +1 -0
- package/build/Percy/PercyLogger.js +1 -0
- package/build/Percy/PercyLogger.js.map +1 -0
- package/build/Percy/PercySDK.js +1 -0
- package/build/Percy/PercySDK.js.map +1 -0
- package/build/accessibility-handler.d.ts +1 -1
- package/build/accessibility-handler.d.ts.map +1 -1
- package/build/accessibility-handler.js +14 -11
- package/build/accessibility-handler.js.map +1 -0
- package/build/ai-handler.d.ts.map +1 -1
- package/build/ai-handler.js +12 -0
- package/build/ai-handler.js.map +1 -0
- package/build/bstackLogger.js +1 -0
- package/build/bstackLogger.js.map +1 -0
- package/build/cleanup.js +1 -0
- package/build/cleanup.js.map +1 -0
- package/build/cli/apiUtils.js +1 -0
- package/build/cli/apiUtils.js.map +1 -0
- package/build/cli/cliLogger.d.ts +1 -0
- package/build/cli/cliLogger.d.ts.map +1 -1
- package/build/cli/cliLogger.js +24 -12
- package/build/cli/cliLogger.js.map +1 -0
- package/build/cli/cliUtils.d.ts +18 -0
- package/build/cli/cliUtils.d.ts.map +1 -1
- package/build/cli/cliUtils.js +30 -0
- package/build/cli/cliUtils.js.map +1 -0
- package/build/cli/eventDispatcher.js +1 -0
- package/build/cli/eventDispatcher.js.map +1 -0
- package/build/cli/frameworks/automationFramework.js +1 -0
- package/build/cli/frameworks/automationFramework.js.map +1 -0
- package/build/cli/frameworks/constants/automationFrameworkConstants.js +1 -0
- package/build/cli/frameworks/constants/automationFrameworkConstants.js.map +1 -0
- package/build/cli/frameworks/constants/testFrameworkConstants.js +1 -0
- package/build/cli/frameworks/constants/testFrameworkConstants.js.map +1 -0
- package/build/cli/frameworks/testFramework.js +1 -0
- package/build/cli/frameworks/testFramework.js.map +1 -0
- package/build/cli/frameworks/wdioAutomationFramework.js +1 -0
- package/build/cli/frameworks/wdioAutomationFramework.js.map +1 -0
- package/build/cli/frameworks/wdioMochaTestFramework.d.ts.map +1 -1
- package/build/cli/frameworks/wdioMochaTestFramework.js +5 -2
- package/build/cli/frameworks/wdioMochaTestFramework.js.map +1 -0
- package/build/cli/grpcClient.d.ts +21 -5
- package/build/cli/grpcClient.d.ts.map +1 -1
- package/build/cli/grpcClient.js +135 -22
- package/build/cli/grpcClient.js.map +1 -0
- package/build/cli/index.d.ts +3 -1
- package/build/cli/index.d.ts.map +1 -1
- package/build/cli/index.js +53 -4
- package/build/cli/index.js.map +1 -0
- package/build/cli/instances/automationFrameworkInstance.js +1 -0
- package/build/cli/instances/automationFrameworkInstance.js.map +1 -0
- package/build/cli/instances/testFrameworkInstance.js +1 -0
- package/build/cli/instances/testFrameworkInstance.js.map +1 -0
- package/build/cli/instances/trackedContext.js +1 -0
- package/build/cli/instances/trackedContext.js.map +1 -0
- package/build/cli/instances/trackedInstance.js +1 -0
- package/build/cli/instances/trackedInstance.js.map +1 -0
- package/build/cli/modules/accessibilityModule.d.ts +4 -1
- package/build/cli/modules/accessibilityModule.d.ts.map +1 -1
- package/build/cli/modules/accessibilityModule.js +76 -10
- package/build/cli/modules/accessibilityModule.js.map +1 -0
- package/build/cli/modules/automateModule.js +1 -0
- package/build/cli/modules/automateModule.js.map +1 -0
- package/build/cli/modules/baseModule.js +1 -0
- package/build/cli/modules/baseModule.js.map +1 -0
- package/build/cli/modules/observabilityModule.js +1 -0
- package/build/cli/modules/observabilityModule.js.map +1 -0
- package/build/cli/modules/percyModule.js +1 -0
- package/build/cli/modules/percyModule.js.map +1 -0
- package/build/cli/modules/testHubModule.js +1 -0
- package/build/cli/modules/testHubModule.js.map +1 -0
- package/build/cli/modules/webdriverIOModule.js +1 -0
- package/build/cli/modules/webdriverIOModule.js.map +1 -0
- package/build/cli/states/automationFrameworkState.d.ts.map +1 -1
- package/build/cli/states/automationFrameworkState.js +1 -0
- package/build/cli/states/automationFrameworkState.js.map +1 -0
- package/build/cli/states/hookState.d.ts.map +1 -1
- package/build/cli/states/hookState.js +1 -0
- package/build/cli/states/hookState.js.map +1 -0
- package/build/cli/states/testFrameworkState.d.ts.map +1 -1
- package/build/cli/states/testFrameworkState.js +1 -0
- package/build/cli/states/testFrameworkState.js.map +1 -0
- package/build/config.js +1 -0
- package/build/config.js.map +1 -0
- package/build/constants.d.ts +28 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +38 -1
- package/build/constants.js.map +1 -0
- package/build/crash-reporter.js +1 -0
- package/build/crash-reporter.js.map +1 -0
- package/build/cucumber-types.js +1 -0
- package/build/cucumber-types.js.map +1 -0
- package/build/data-store.js +1 -0
- package/build/data-store.js.map +1 -0
- package/build/exitHandler.d.ts +1 -1
- package/build/exitHandler.d.ts.map +1 -1
- package/build/exitHandler.js +7 -5
- package/build/exitHandler.js.map +1 -0
- package/build/fileStream.js +1 -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.js +1 -0
- package/build/index.js.map +1 -0
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +38 -8
- package/build/insights-handler.js.map +1 -0
- package/build/instrumentation/funnelInstrumentation.d.ts +2 -2
- package/build/instrumentation/funnelInstrumentation.d.ts.map +1 -1
- package/build/instrumentation/funnelInstrumentation.js +31 -8
- package/build/instrumentation/funnelInstrumentation.js.map +1 -0
- 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 +74 -2
- package/build/instrumentation/performance/constants.js.map +1 -0
- 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 +136 -15
- package/build/instrumentation/performance/performance-tester.js.map +1 -0
- package/build/launcher.d.ts +1 -0
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +152 -6
- package/build/launcher.js.map +1 -0
- package/build/log4jsAppender.d.ts.map +1 -1
- package/build/log4jsAppender.js +1 -0
- package/build/log4jsAppender.js.map +1 -0
- package/build/logPatcher.d.ts.map +1 -1
- package/build/logPatcher.js +1 -0
- package/build/logPatcher.js.map +1 -0
- package/build/logReportingAPI.d.ts.map +1 -1
- package/build/logReportingAPI.js +1 -0
- package/build/logReportingAPI.js.map +1 -0
- package/build/reporter.js +1 -0
- package/build/reporter.js.map +1 -0
- package/build/request-handler.d.ts.map +1 -1
- package/build/request-handler.js +4 -0
- package/build/request-handler.js.map +1 -0
- package/build/scripts/accessibility-scripts.js +1 -0
- package/build/scripts/accessibility-scripts.js.map +1 -0
- package/build/service.d.ts.map +1 -1
- package/build/service.js +78 -5
- package/build/service.js.map +1 -0
- package/build/testHub/utils.d.ts.map +1 -1
- package/build/testHub/utils.js +1 -0
- package/build/testHub/utils.js.map +1 -0
- package/build/testOps/featureStats.js +1 -0
- package/build/testOps/featureStats.js.map +1 -0
- package/build/testOps/featureUsage.js +1 -0
- package/build/testOps/featureUsage.js.map +1 -0
- package/build/testOps/listener.js +1 -0
- package/build/testOps/listener.js.map +1 -0
- package/build/testOps/requestUtils.js +1 -0
- package/build/testOps/requestUtils.js.map +1 -0
- package/build/testOps/testOpsConfig.js +1 -0
- package/build/testOps/testOpsConfig.js.map +1 -0
- package/build/testOps/usageStats.js +1 -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 +21 -0
- package/build/types.d.ts.map +1 -1
- package/build/types.js +1 -0
- package/build/types.js.map +1 -0
- package/build/util.d.ts +30 -1
- package/build/util.d.ts.map +1 -1
- package/build/util.js +103 -4
- package/build/util.js.map +1 -0
- package/package.json +46 -16
- 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
- package/tsconfig.prod.tsbuildinfo +0 -1
|
@@ -8,13 +8,34 @@ import path from 'node:path';
|
|
|
8
8
|
import { arch, hostname, platform, type, version } from 'node:os';
|
|
9
9
|
import got from 'got';
|
|
10
10
|
import { BStackLogger } from '../../bstackLogger.js';
|
|
11
|
-
import { PERF_MEASUREMENT_ENV
|
|
11
|
+
import { PERF_MEASUREMENT_ENV } from '../../constants.js';
|
|
12
12
|
import APIUtils from '../../cli/apiUtils.js';
|
|
13
|
+
import { CLIUtils } from '../../cli/cliUtils.js';
|
|
14
|
+
import { EVENTS } from './constants.js';
|
|
15
|
+
// Telemetry must never throw into business logic. Node 18's perf_hooks rejects
|
|
16
|
+
// negative timestamps (e.g. performance.now() under faked timers, or any other
|
|
17
|
+
// edge) with ERR_PERFORMANCE_INVALID_TIMESTAMP; Node 20+ tolerates them. Wrapping
|
|
18
|
+
// mark/measure keeps an instrumentation failure from breaking a caller's hook
|
|
19
|
+
// (e.g. a service before()), and is a no-op on the happy path.
|
|
20
|
+
function safeMark(markName) {
|
|
21
|
+
try {
|
|
22
|
+
performance.mark(markName);
|
|
23
|
+
}
|
|
24
|
+
catch { /* instrumentation must not throw */ }
|
|
25
|
+
}
|
|
26
|
+
function safeMeasure(measureName, start, end) {
|
|
27
|
+
try {
|
|
28
|
+
performance.measure(measureName, start, end);
|
|
29
|
+
}
|
|
30
|
+
catch { /* instrumentation must not throw */ }
|
|
31
|
+
}
|
|
13
32
|
export default class PerformanceTester {
|
|
14
33
|
static _observer;
|
|
15
34
|
static _csvWriter;
|
|
16
35
|
static _events = [];
|
|
17
36
|
static _measuredEvents = [];
|
|
37
|
+
static _hasStoppedGeneration = false;
|
|
38
|
+
static _stopGenerateCallCount = 0;
|
|
18
39
|
static started = false;
|
|
19
40
|
static details = {};
|
|
20
41
|
static eventsMap = {};
|
|
@@ -34,6 +55,14 @@ export default class PerformanceTester {
|
|
|
34
55
|
.forEach(entry => {
|
|
35
56
|
let finalEntry = entry;
|
|
36
57
|
finalEntry = entry.toJSON();
|
|
58
|
+
try {
|
|
59
|
+
if (typeof finalEntry.startTime === 'number' && typeof performance.timeOrigin === 'number') {
|
|
60
|
+
finalEntry.startTime = performance.timeOrigin + finalEntry.startTime;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
BStackLogger.debug(`Error converting startTime to epoch: ${util.format(e)}`);
|
|
65
|
+
}
|
|
37
66
|
if (this.details[entry.name]) {
|
|
38
67
|
finalEntry = Object.assign(finalEntry, this.details[entry.name]);
|
|
39
68
|
}
|
|
@@ -78,7 +107,6 @@ export default class PerformanceTester {
|
|
|
78
107
|
if (!this.started) {
|
|
79
108
|
return;
|
|
80
109
|
}
|
|
81
|
-
await PerformanceTester.sleep(PERF_METRICS_WAIT_TIME); // Wait to ensure all pending measurements are processed by the observer
|
|
82
110
|
try {
|
|
83
111
|
const eventsJson = JSON.stringify(this._measuredEvents);
|
|
84
112
|
// remove enclosing array and add a trailing comma so that we
|
|
@@ -93,8 +121,8 @@ export default class PerformanceTester {
|
|
|
93
121
|
if (!process.env[PERF_MEASUREMENT_ENV]) {
|
|
94
122
|
return;
|
|
95
123
|
}
|
|
96
|
-
await PerformanceTester.sleep(PERF_METRICS_WAIT_TIME); // Wait to 2s just to finish any running callbacks for timerify
|
|
97
124
|
this.started = false;
|
|
125
|
+
// Generate CSV and HTML reports using directly collected events
|
|
98
126
|
this.generateCSV(this._events);
|
|
99
127
|
const content = this.generateReport(this._events);
|
|
100
128
|
const dir = path.join(process.cwd(), filename);
|
|
@@ -166,27 +194,78 @@ export default class PerformanceTester {
|
|
|
166
194
|
if (!this.started || !this.isEnabled()) {
|
|
167
195
|
return fn.apply(thisArg, args);
|
|
168
196
|
}
|
|
169
|
-
|
|
170
|
-
|
|
197
|
+
// Generate unique mark names for this specific call to avoid timing conflicts
|
|
198
|
+
const uniqueId = `${Date.now()}-${Math.random().toString(36).substring(7)}`;
|
|
199
|
+
const startMark = `${label}-start-${uniqueId}`;
|
|
200
|
+
const endMark = `${label}-end-${uniqueId}`;
|
|
201
|
+
// Create the start mark with unique ID
|
|
202
|
+
safeMark(startMark);
|
|
203
|
+
// Store details with measurement context
|
|
204
|
+
const detailsWithContext = {
|
|
205
|
+
...details,
|
|
206
|
+
measurementId: uniqueId
|
|
207
|
+
};
|
|
171
208
|
try {
|
|
172
209
|
const returnVal = fn.apply(thisArg, args);
|
|
173
210
|
if (returnVal instanceof Promise) {
|
|
174
211
|
return new Promise((resolve, reject) => {
|
|
175
212
|
returnVal
|
|
176
213
|
.then(v => {
|
|
177
|
-
|
|
214
|
+
// Use specific marks for this call
|
|
215
|
+
safeMark(endMark);
|
|
216
|
+
safeMeasure(label, startMark, endMark);
|
|
217
|
+
this.details[label] = Object.assign({
|
|
218
|
+
success: true,
|
|
219
|
+
failure: undefined
|
|
220
|
+
}, Object.assign(Object.assign({
|
|
221
|
+
clientWorkerId: PerformanceTester.getClientWorkerId(),
|
|
222
|
+
worker: PerformanceTester.getProcessId(),
|
|
223
|
+
platform: PerformanceTester.browser?.sessionId,
|
|
224
|
+
testName: PerformanceTester.scenarioThatRan?.pop()
|
|
225
|
+
}, detailsWithContext), this.details[label] || {}));
|
|
178
226
|
resolve(v);
|
|
179
227
|
}).catch(e => {
|
|
180
|
-
|
|
228
|
+
safeMark(endMark);
|
|
229
|
+
safeMeasure(label, startMark, endMark);
|
|
230
|
+
this.details[label] = Object.assign({
|
|
231
|
+
success: false,
|
|
232
|
+
failure: util.format(e)
|
|
233
|
+
}, Object.assign(Object.assign({
|
|
234
|
+
clientWorkerId: PerformanceTester.getClientWorkerId(),
|
|
235
|
+
worker: PerformanceTester.getProcessId(),
|
|
236
|
+
platform: PerformanceTester.browser?.sessionId,
|
|
237
|
+
testName: PerformanceTester.scenarioThatRan?.pop()
|
|
238
|
+
}, detailsWithContext), this.details[label] || {}));
|
|
181
239
|
reject(e);
|
|
182
240
|
});
|
|
183
241
|
});
|
|
184
242
|
}
|
|
185
|
-
|
|
243
|
+
// Synchronous execution
|
|
244
|
+
safeMark(endMark);
|
|
245
|
+
safeMeasure(label, startMark, endMark);
|
|
246
|
+
this.details[label] = Object.assign({
|
|
247
|
+
success: true,
|
|
248
|
+
failure: undefined
|
|
249
|
+
}, Object.assign(Object.assign({
|
|
250
|
+
clientWorkerId: PerformanceTester.getClientWorkerId(),
|
|
251
|
+
worker: PerformanceTester.getProcessId(),
|
|
252
|
+
platform: PerformanceTester.browser?.sessionId,
|
|
253
|
+
testName: PerformanceTester.scenarioThatRan?.pop()
|
|
254
|
+
}, detailsWithContext), this.details[label] || {}));
|
|
186
255
|
return returnVal;
|
|
187
256
|
}
|
|
188
257
|
catch (er) {
|
|
189
|
-
|
|
258
|
+
safeMark(endMark);
|
|
259
|
+
safeMeasure(label, startMark, endMark);
|
|
260
|
+
this.details[label] = Object.assign({
|
|
261
|
+
success: false,
|
|
262
|
+
failure: util.format(er)
|
|
263
|
+
}, Object.assign(Object.assign({
|
|
264
|
+
clientWorkerId: PerformanceTester.getClientWorkerId(),
|
|
265
|
+
worker: PerformanceTester.getProcessId(),
|
|
266
|
+
platform: PerformanceTester.browser?.sessionId,
|
|
267
|
+
testName: PerformanceTester.scenarioThatRan?.pop()
|
|
268
|
+
}, detailsWithContext), this.details[label] || {}));
|
|
190
269
|
throw er;
|
|
191
270
|
}
|
|
192
271
|
}
|
|
@@ -195,32 +274,66 @@ export default class PerformanceTester {
|
|
|
195
274
|
if (this.eventsMap[finalEvent]) {
|
|
196
275
|
return;
|
|
197
276
|
}
|
|
198
|
-
|
|
277
|
+
safeMark(finalEvent);
|
|
199
278
|
this.eventsMap[finalEvent] = 1;
|
|
200
279
|
}
|
|
201
280
|
static end(event, success = true, failure, details = {}) {
|
|
202
|
-
|
|
203
|
-
|
|
281
|
+
safeMark(event + '-end');
|
|
282
|
+
safeMeasure(event, event + '-start', event + '-end');
|
|
204
283
|
this.details[event] = Object.assign({ success, failure: util.format(failure) }, Object.assign(Object.assign({
|
|
284
|
+
clientWorkerId: PerformanceTester.getClientWorkerId(),
|
|
205
285
|
worker: PerformanceTester.getProcessId(),
|
|
206
286
|
platform: PerformanceTester.browser?.sessionId,
|
|
207
287
|
testName: PerformanceTester.scenarioThatRan?.pop()
|
|
208
288
|
}, details), this.details[event] || {}));
|
|
209
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Get client worker ID in format "threadId-processId".
|
|
292
|
+
* This method provides a consistent identifier across the SDK for tracking
|
|
293
|
+
* worker-specific events and performance metrics.
|
|
294
|
+
*
|
|
295
|
+
* @returns Worker ID string in format "threadId-processId"
|
|
296
|
+
*/
|
|
297
|
+
static getClientWorkerId() {
|
|
298
|
+
return CLIUtils.getClientWorkerId();
|
|
299
|
+
}
|
|
210
300
|
static getProcessId() {
|
|
211
301
|
return `${process.pid}-${worker.threadId}`;
|
|
212
302
|
}
|
|
213
303
|
static sleep = (ms = 100) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
214
304
|
static async uploadEventsData() {
|
|
305
|
+
// Track overall key metrics operation
|
|
306
|
+
this.start(EVENTS.SDK_SEND_KEY_METRICS);
|
|
215
307
|
try {
|
|
308
|
+
const workerId = `${process.pid}`;
|
|
309
|
+
BStackLogger.debug(`[Performance Upload] Starting upload for worker ${workerId}`);
|
|
310
|
+
// Track preparation phase (collection and deduplication)
|
|
311
|
+
this.start(EVENTS.SDK_KEY_METRICS_PREPARATION);
|
|
312
|
+
// Collect all measures from performance report files and in-memory events
|
|
216
313
|
let measures = [];
|
|
217
314
|
if (await fsPromise.access(this.jsonReportDirPath).then(() => true).catch(() => false)) {
|
|
218
315
|
const files = (await fsPromise.readdir(this.jsonReportDirPath)).map(file => path.resolve(this.jsonReportDirPath, file));
|
|
219
316
|
measures = (await Promise.all(files.map((file) => fsPromise.readFile(file, 'utf-8')))).map(el => `[${el.slice(0, -1)}]`).map(el => JSON.parse(el)).flat();
|
|
220
317
|
}
|
|
318
|
+
BStackLogger.debug(`[Performance Upload] Total events from files: ${measures.length}`);
|
|
221
319
|
if (this._measuredEvents.length > 0) {
|
|
320
|
+
BStackLogger.debug(`[Performance Upload] Adding ${this._measuredEvents.length} in-memory events`);
|
|
222
321
|
measures = measures.concat(this._measuredEvents);
|
|
223
322
|
}
|
|
323
|
+
const ensureEpochTimes = (arr) => {
|
|
324
|
+
const now = Date.now();
|
|
325
|
+
const cutoff = 1e12; // ~year 2001, ms epoch
|
|
326
|
+
const timeOrigin = (typeof performance !== 'undefined' && typeof performance.timeOrigin === 'number')
|
|
327
|
+
? performance.timeOrigin
|
|
328
|
+
: (now - process.uptime() * 1000);
|
|
329
|
+
return arr.map(entry => {
|
|
330
|
+
if (typeof entry.startTime === 'number' && entry.startTime < cutoff) {
|
|
331
|
+
entry.startTime = timeOrigin + entry.startTime;
|
|
332
|
+
}
|
|
333
|
+
return entry;
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
measures = ensureEpochTimes(measures);
|
|
224
337
|
const date = new Date();
|
|
225
338
|
// yyyy-MM-dd'T'HH:mm:ss.SSSSSS Z
|
|
226
339
|
const options = {
|
|
@@ -240,6 +353,7 @@ export default class PerformanceTester {
|
|
|
240
353
|
.map(({ type, value }) => type === 'timeZoneName' ? 'Z' : value)
|
|
241
354
|
.join('')
|
|
242
355
|
.replace(',', 'T');
|
|
356
|
+
this.end(EVENTS.SDK_KEY_METRICS_PREPARATION, true);
|
|
243
357
|
const payload = {
|
|
244
358
|
event_type: 'sdk_events',
|
|
245
359
|
data: {
|
|
@@ -262,10 +376,15 @@ export default class PerformanceTester {
|
|
|
262
376
|
'content-type': 'application/json'
|
|
263
377
|
}, json: payload
|
|
264
378
|
});
|
|
265
|
-
BStackLogger.debug(`Successfully uploaded
|
|
379
|
+
BStackLogger.debug(`[Performance Upload] Successfully uploaded to EDS: ${util.format(result.body)}`);
|
|
380
|
+
this.end(EVENTS.SDK_KEY_METRICS_UPLOAD, true);
|
|
381
|
+
this.end(EVENTS.SDK_SEND_KEY_METRICS, true);
|
|
266
382
|
}
|
|
267
383
|
catch (er) {
|
|
268
|
-
BStackLogger.debug(`Failed to upload
|
|
384
|
+
BStackLogger.debug(`[Performance Upload] Failed to upload events: ${util.format(er)}`);
|
|
385
|
+
this.end(EVENTS.SDK_KEY_METRICS_UPLOAD, false, er);
|
|
386
|
+
this.end(EVENTS.SDK_KEY_METRICS_PREPARATION, false, er);
|
|
387
|
+
this.end(EVENTS.SDK_SEND_KEY_METRICS, false, er);
|
|
269
388
|
}
|
|
270
389
|
try {
|
|
271
390
|
if (await fsPromise.access(this.jsonReportDirPath).then(() => true, () => false)) {
|
|
@@ -273,10 +392,12 @@ export default class PerformanceTester {
|
|
|
273
392
|
for (const file of files) {
|
|
274
393
|
await fsPromise.unlink(path.join(this.jsonReportDirPath, file));
|
|
275
394
|
}
|
|
395
|
+
BStackLogger.debug(`[Performance Upload] Cleaned up ${files.length} temporary report files`);
|
|
276
396
|
}
|
|
277
397
|
}
|
|
278
398
|
catch (er) {
|
|
279
|
-
BStackLogger.debug(`Failed to delete
|
|
399
|
+
BStackLogger.debug(`[Performance Upload] Failed to delete temporary files: ${util.format(er)}`);
|
|
280
400
|
}
|
|
281
401
|
}
|
|
282
402
|
}
|
|
403
|
+
//# sourceMappingURL=performance-tester.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance-tester.js","sourceRoot":"","sources":["../../../src/instrumentation/performance/performance-tester.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,SAAS,MAAM,kBAAkB,CAAA;AAExC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,MAAM,MAAM,qBAAqB,CAAA;AACxC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjE,OAAO,GAAG,MAAM,KAAK,CAAA;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE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C,OAAO,EAAE,EAAE,CAAC;YACV,YAAY,CAAC,KAAK,CAAC,iDAAiD,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;YACtF,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,sBAAsB,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;YAClD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,2BAA2B,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;YACvD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,oBAAoB,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;QACpD,CAAC;QAED,IAAI,CAAC;YACD,IAAI,MAAM,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/E,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;gBAE7D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;oBACvB,MAAM,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,CAAA;gBACnE,CAAC;gBAED,YAAY,CAAC,KAAK,CAAC,mCAAmC,KAAK,CAAC,MAAM,yBAAyB,CAAC,CAAA;YAChG,CAAC;QACL,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACV,YAAY,CAAC,KAAK,CAAC,0DAA0D,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;QACnG,CAAC;IACL,CAAC"}
|
package/build/launcher.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export default class BrowserstackLauncherService implements Services.ServiceInst
|
|
|
30
30
|
*/
|
|
31
31
|
_validateApp(appConfig: AppConfig | string): Promise<App>;
|
|
32
32
|
_uploadServiceLogs(): Promise<void>;
|
|
33
|
+
private _removeCliOnlyCapabilityOptions;
|
|
33
34
|
_updateObjectTypeCaps(capabilities?: Capabilities.RemoteCapabilities, capType?: string, value?: {
|
|
34
35
|
[key: string]: any;
|
|
35
36
|
}): void;
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAmDxH,KAAK,iBAAiB,GAAG,yBAAyB,CAAC,KAAK,GAAG;IACvD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAA;CAC9C,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,YAAW,QAAQ,CAAC,eAAe;IAY5E,OAAO,CAAC,QAAQ;IAEhB,OAAO,CAAC,OAAO;IAbnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,OAAO,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8BAA8B;IAgB9B,sBAAsB,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,kBAAkB;IAyCrE;;;OAGG;IACH,oBAAoB;IA6BpB,sBAAsB,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,SAAS,CAAC,EAAC,MAAM,EAAE,eAAe,CAAC,EAAC,MAAM;IASnF,mBAAmB;CAStB"}
|
package/build/launcher.js
CHANGED
|
@@ -16,7 +16,7 @@ import { SevereServiceError } from 'webdriverio';
|
|
|
16
16
|
import * as BrowserstackLocalLauncher from 'browserstack-local';
|
|
17
17
|
import { startPercy, stopPercy, getBestPlatformForPercySnapshot } from './Percy/PercyHelper.js';
|
|
18
18
|
import { BSTACK_SERVICE_VERSION, NOT_ALLOWED_KEYS_IN_CAPS, PERF_MEASUREMENT_ENV, RERUN_ENV, RERUN_TESTS_ENV, BROWSERSTACK_TESTHUB_UUID, VALID_APP_EXTENSION, BROWSERSTACK_PERCY, BROWSERSTACK_OBSERVABILITY, WDIO_NAMING_PREFIX } from './constants.js';
|
|
19
|
-
import { launchTestSession, shouldAddServiceVersion, stopBuildUpstream, getCiInfo, isBStackSession, isUndefined, isAccessibilityAutomationSession, isTrue, getBrowserStackUser, getBrowserStackKey, uploadLogs, ObjectsAreEqual, isValidCapsForHealing, getBooleanValueFromString, validateCapsWithNonBstackA11y, mergeChromeOptions, normalizeTestReportingConfig, normalizeTestReportingEnvVariables } from './util.js';
|
|
19
|
+
import { launchTestSession, shouldAddServiceVersion, stopBuildUpstream, getCiInfo, isBStackSession, isUndefined, isAccessibilityAutomationSession, isTrue, getBrowserStackUser, getBrowserStackKey, uploadLogs, ObjectsAreEqual, isValidCapsForHealing, getBooleanValueFromString, validateCapsWithNonBstackA11y, mergeChromeOptions, normalizeTestReportingConfig, normalizeTestReportingEnvVariables, isValidEnabledValue, isMultiRemoteCaps } from './util.js';
|
|
20
20
|
import { getProductMap } from './testHub/utils.js';
|
|
21
21
|
import CrashReporter from './crash-reporter.js';
|
|
22
22
|
import { BStackLogger } from './bstackLogger.js';
|
|
@@ -175,19 +175,76 @@ export default class BrowserstackLauncherService {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
async onPrepare(config, capabilities) {
|
|
178
|
+
PerformanceTester.start(PERFORMANCE_SDK_EVENTS.FRAMEWORK_EVENTS.INIT);
|
|
178
179
|
// // Send Funnel start request
|
|
179
180
|
await sendStart(this.browserStackConfig);
|
|
181
|
+
// Convert glob patterns in specs to resolved relative paths
|
|
182
|
+
if (config.specs && Array.isArray(config.specs) && isValidEnabledValue(this._options.testOrchestrationOptions?.runSmartSelection?.enabled)) {
|
|
183
|
+
try {
|
|
184
|
+
// Import glob for expanding file patterns
|
|
185
|
+
const glob = (await import('glob')).sync;
|
|
186
|
+
const path = await import('node:path');
|
|
187
|
+
// Use ConfigParser.getFilePaths equivalent logic to expand specs
|
|
188
|
+
const expandedSpecs = [];
|
|
189
|
+
for (const specPattern of config.specs) {
|
|
190
|
+
if (typeof specPattern === 'string') {
|
|
191
|
+
if (specPattern.startsWith('file://')) {
|
|
192
|
+
expandedSpecs.push(specPattern);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
// Expand glob pattern to relative paths
|
|
196
|
+
const pattern = specPattern.replace(/\\/g, '/');
|
|
197
|
+
// Use config.rootDir which is set to the config file's directory
|
|
198
|
+
const rootDir = config.rootDir || process.cwd();
|
|
199
|
+
// Get current working directory for final relative path calculation
|
|
200
|
+
const cwd = process.cwd();
|
|
201
|
+
const filenames = glob(pattern, {
|
|
202
|
+
cwd: rootDir,
|
|
203
|
+
matchBase: true
|
|
204
|
+
}) || [];
|
|
205
|
+
// Convert paths to be relative to the current working directory (where command is run)
|
|
206
|
+
filenames
|
|
207
|
+
.forEach((filename) => {
|
|
208
|
+
let absolutePath = filename;
|
|
209
|
+
// If filename is not absolute, resolve it relative to rootDir (config file's directory)
|
|
210
|
+
if (!path.isAbsolute(filename)) {
|
|
211
|
+
absolutePath = path.resolve(rootDir, filename);
|
|
212
|
+
}
|
|
213
|
+
// Make path relative to current working directory
|
|
214
|
+
let relativePath = path.relative(cwd, absolutePath);
|
|
215
|
+
// Normalize path separators for consistency (Windows compatibility)
|
|
216
|
+
relativePath = relativePath.replace(/\\/g, '/');
|
|
217
|
+
expandedSpecs.push(relativePath);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (expandedSpecs.length > 0) {
|
|
222
|
+
BStackLogger.info(`Expanded specs from glob patterns to ${expandedSpecs.length} files`);
|
|
223
|
+
config.specs = expandedSpecs;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
BStackLogger.error(`Failed to expand spec patterns: ${error}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
180
230
|
try {
|
|
181
|
-
if
|
|
231
|
+
// Detect if multi-remote and disable CLI for those sessions
|
|
232
|
+
const isMultiremote = isMultiRemoteCaps(capabilities);
|
|
233
|
+
process.env.BROWSERSTACK_IS_MULTIREMOTE = String(isMultiremote);
|
|
234
|
+
if (CLIUtils.checkCLISupportedFrameworks(config.framework) && !isMultiremote) {
|
|
235
|
+
PerformanceTester.start(PERFORMANCE_SDK_EVENTS.FRAMEWORK_EVENTS.START);
|
|
182
236
|
CLIUtils.setFrameworkDetail(WDIO_NAMING_PREFIX + config.framework, 'WebdriverIO'); // TODO: make this constant
|
|
183
237
|
const binconfig = CLIUtils.getBinConfig(config, capabilities, this._options, this._buildTag);
|
|
184
238
|
await BrowserstackCLI.getInstance().bootstrap(this._options, config, binconfig);
|
|
185
239
|
BStackLogger.debug(`Is CLI running ${BrowserstackCLI.getInstance().isRunning()}`);
|
|
240
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.FRAMEWORK_EVENTS.START);
|
|
186
241
|
}
|
|
187
242
|
}
|
|
188
243
|
catch (err) {
|
|
189
244
|
BStackLogger.error(`Error while starting CLI ${err}`);
|
|
245
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.FRAMEWORK_EVENTS.START, false, util.format(err));
|
|
190
246
|
}
|
|
247
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.FRAMEWORK_EVENTS.INIT);
|
|
191
248
|
// Setting up healing for those sessions where we don't add the service version capability as it indicates that the session is not being run on BrowserStack
|
|
192
249
|
if (!shouldAddServiceVersion(this._config, this._options.testObservability, capabilities)) {
|
|
193
250
|
try {
|
|
@@ -301,6 +358,7 @@ export default class BrowserstackLauncherService {
|
|
|
301
358
|
else if (isAccessibilityAutomationSession(this._accessibilityAutomation)) {
|
|
302
359
|
this._updateObjectTypeCaps(capabilities, 'accessibilityOptions', {});
|
|
303
360
|
}
|
|
361
|
+
this._removeCliOnlyCapabilityOptions(capabilities);
|
|
304
362
|
if (shouldSetupPercy) {
|
|
305
363
|
try {
|
|
306
364
|
const bestPlatformPercyCaps = getBestPlatformForPercySnapshot(capabilities);
|
|
@@ -319,6 +377,51 @@ export default class BrowserstackLauncherService {
|
|
|
319
377
|
// send testhub build uuid and product map instrumentation
|
|
320
378
|
this._updateCaps(capabilities, 'testhubBuildUuid');
|
|
321
379
|
this._updateCaps(capabilities, 'buildProductMap');
|
|
380
|
+
if (isValidEnabledValue(this._options.testOrchestrationOptions?.runSmartSelection?.enabled)) {
|
|
381
|
+
// Helper function to convert specs from cwd-relative to rootDir-relative
|
|
382
|
+
const convertToRootDirRelative = (specs) => {
|
|
383
|
+
const rootDir = config.rootDir || process.cwd();
|
|
384
|
+
const cwd = process.cwd();
|
|
385
|
+
return specs.map((spec) => {
|
|
386
|
+
if (typeof spec !== 'string') {
|
|
387
|
+
return spec;
|
|
388
|
+
}
|
|
389
|
+
// Convert from cwd-relative to absolute
|
|
390
|
+
const absolutePath = path.isAbsolute(spec) ? spec : path.resolve(cwd, spec);
|
|
391
|
+
// Then make it relative to rootDir (config file's directory)
|
|
392
|
+
const relativePath = path.relative(rootDir, absolutePath);
|
|
393
|
+
// Normalize path separators
|
|
394
|
+
return relativePath.replace(/\\/g, '/');
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
// Apply test orchestration if enabled
|
|
398
|
+
try {
|
|
399
|
+
// Import dynamically to avoid circular dependencies
|
|
400
|
+
const { applyOrchestrationIfEnabled } = await import('./testorchestration/apply-orchestration.js');
|
|
401
|
+
if (config.specs && config.specs.length > 0 && this._options.testObservability && isValidEnabledValue(this._options.testOrchestrationOptions?.runSmartSelection?.enabled)) {
|
|
402
|
+
BStackLogger.info('Applying test orchestration');
|
|
403
|
+
// Ensure we're passing string[] to applyOrchestrationIfEnabled
|
|
404
|
+
const specs = config.specs.filter(spec => typeof spec === 'string');
|
|
405
|
+
console.log(`Specs before orchestration: ${specs}`);
|
|
406
|
+
const orderedSpecs = await applyOrchestrationIfEnabled(specs, this._options);
|
|
407
|
+
console.log(`Specs after orchestration before conversion: ${orderedSpecs}`);
|
|
408
|
+
// Use ordered specs if available, otherwise use original specs
|
|
409
|
+
const specsToConvert = orderedSpecs && orderedSpecs.length > 0 ? orderedSpecs : specs;
|
|
410
|
+
config.specs = convertToRootDirRelative(specsToConvert);
|
|
411
|
+
console.log(`Specs after orchestration: ${config.specs}`);
|
|
412
|
+
BStackLogger.info('Test specs updated with orchestrated order');
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
catch (error) {
|
|
416
|
+
BStackLogger.error(`Error applying test orchestration: ${error}`);
|
|
417
|
+
// On error, we still need to convert specs from cwd-relative to rootDir-relative
|
|
418
|
+
if (config.specs && config.specs.length > 0) {
|
|
419
|
+
const specs = config.specs.filter(spec => typeof spec === 'string');
|
|
420
|
+
config.specs = convertToRootDirRelative(specs);
|
|
421
|
+
BStackLogger.debug(`Specs converted back to rootDir-relative after error: ${config.specs}`);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
322
425
|
// local binary will be handled by CLI
|
|
323
426
|
if (BrowserstackCLI.getInstance().isRunning()) {
|
|
324
427
|
return;
|
|
@@ -368,14 +471,19 @@ export default class BrowserstackLauncherService {
|
|
|
368
471
|
}
|
|
369
472
|
async onComplete() {
|
|
370
473
|
PerformanceTester.start(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_CLEANUP);
|
|
474
|
+
PerformanceTester.start(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_ON_STOP);
|
|
475
|
+
PerformanceTester.start(PERFORMANCE_SDK_EVENTS.FRAMEWORK_EVENTS.STOP);
|
|
371
476
|
try {
|
|
372
477
|
BStackLogger.debug('Inside OnComplete hook..');
|
|
373
478
|
BStackLogger.debug('Sending stop launch event');
|
|
479
|
+
const isCLIEnabled = BrowserstackCLI.getInstance().isRunning();
|
|
374
480
|
try {
|
|
375
|
-
await (
|
|
481
|
+
await (isCLIEnabled ? BrowserstackCLI.getInstance().stop() : stopBuildUpstream());
|
|
482
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.FRAMEWORK_EVENTS.STOP);
|
|
376
483
|
}
|
|
377
484
|
catch (err) {
|
|
378
|
-
BStackLogger.error(`Error while
|
|
485
|
+
BStackLogger.error(`Error while stopping CLI ${err}`);
|
|
486
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.FRAMEWORK_EVENTS.STOP, false, util.format(err));
|
|
379
487
|
}
|
|
380
488
|
if (process.env[BROWSERSTACK_OBSERVABILITY] && process.env[BROWSERSTACK_TESTHUB_UUID]) {
|
|
381
489
|
console.log(`\nVisit https://automation.browserstack.com/builds/${process.env[BROWSERSTACK_TESTHUB_UUID]} to view build report, insights, and many more debugging information all at one place!\n`);
|
|
@@ -392,17 +500,22 @@ export default class BrowserstackLauncherService {
|
|
|
392
500
|
BStackLogger.info(`Total duration is ${duration / 1000} s`);
|
|
393
501
|
}
|
|
394
502
|
BStackLogger.info(`BrowserStack service run ended for id: ${this.browserStackConfig?.sdkRunID} testhub id: ${TestOpsConfig.getInstance()?.buildHashedId}`);
|
|
395
|
-
await sendFinish(this.browserStackConfig);
|
|
503
|
+
await sendFinish(this.browserStackConfig, isCLIEnabled);
|
|
396
504
|
try {
|
|
505
|
+
PerformanceTester.start(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_SEND_LOGS);
|
|
397
506
|
await this._uploadServiceLogs();
|
|
507
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_SEND_LOGS);
|
|
398
508
|
}
|
|
399
509
|
catch (error) {
|
|
400
510
|
BStackLogger.debug(`Failed to upload BrowserStack WDIO Service logs ${error}`);
|
|
511
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_SEND_LOGS, false, util.format(error));
|
|
401
512
|
}
|
|
513
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_ON_STOP);
|
|
402
514
|
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_CLEANUP);
|
|
403
515
|
await PerformanceTester.stopAndGenerate('performance-launcher.html');
|
|
404
516
|
}
|
|
405
517
|
catch (error) {
|
|
518
|
+
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_ON_STOP, false, util.format(error));
|
|
406
519
|
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_CLEANUP, false, util.format(error));
|
|
407
520
|
await PerformanceTester.stopAndGenerate('performance-launcher.html');
|
|
408
521
|
BStackLogger.error(`Error in onComplete hook: ${error}`);
|
|
@@ -532,11 +645,43 @@ export default class BrowserstackLauncherService {
|
|
|
532
645
|
}
|
|
533
646
|
async _uploadServiceLogs() {
|
|
534
647
|
const clientBuildUuid = this._getClientBuildUuid();
|
|
535
|
-
await PerformanceTester.measureWrapper(PERFORMANCE_SDK_EVENTS.EVENTS.
|
|
648
|
+
await PerformanceTester.measureWrapper(PERFORMANCE_SDK_EVENTS.EVENTS.SDK_UPLOAD_LOGS, async () => {
|
|
536
649
|
const response = await uploadLogs(getBrowserStackUser(this._config), getBrowserStackKey(this._config), clientBuildUuid);
|
|
537
650
|
BStackLogger.logToFile(`Response - ${format(response)}`, 'debug');
|
|
538
651
|
})();
|
|
539
652
|
}
|
|
653
|
+
_removeCliOnlyCapabilityOptions(capabilities) {
|
|
654
|
+
if (!capabilities || typeof capabilities !== 'object') {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
const strip = (capability) => {
|
|
658
|
+
const capabilityRecord = capability;
|
|
659
|
+
const bstackOptions = capabilityRecord['bstack:options'];
|
|
660
|
+
if (bstackOptions && typeof bstackOptions === 'object') {
|
|
661
|
+
NOT_ALLOWED_KEYS_IN_CAPS.forEach(key => delete bstackOptions[key]);
|
|
662
|
+
}
|
|
663
|
+
NOT_ALLOWED_KEYS_IN_CAPS.forEach(key => delete capabilityRecord[`browserstack.${key}`]);
|
|
664
|
+
const alwaysMatch = capability.alwaysMatch;
|
|
665
|
+
if (alwaysMatch && typeof alwaysMatch === 'object') {
|
|
666
|
+
strip(alwaysMatch);
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
if (Array.isArray(capabilities)) {
|
|
670
|
+
capabilities
|
|
671
|
+
.flatMap((c) => {
|
|
672
|
+
if (Object.values(c).length > 0 && Object.values(c).every(c => typeof c === 'object' && c.capabilities)) {
|
|
673
|
+
return Object.values(c).map((o) => o.capabilities);
|
|
674
|
+
}
|
|
675
|
+
return c;
|
|
676
|
+
})
|
|
677
|
+
.forEach(strip);
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
Object.entries(capabilities).forEach(([, caps]) => {
|
|
681
|
+
strip(caps.capabilities);
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
}
|
|
540
685
|
_updateObjectTypeCaps(capabilities, capType, value) {
|
|
541
686
|
try {
|
|
542
687
|
if (Array.isArray(capabilities)) {
|
|
@@ -929,3 +1074,4 @@ __decorate([
|
|
|
929
1074
|
__decorate([
|
|
930
1075
|
PerformanceTester.Measure(PERFORMANCE_SDK_EVENTS.APP_AUTOMATE_EVENTS.APP_UPLOAD)
|
|
931
1076
|
], BrowserstackLauncherService.prototype, "_uploadApp", null);
|
|
1077
|
+
//# sourceMappingURL=launcher.js.map
|