@wdio/browserstack-service 8.8.7 → 8.9.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/constants.d.ts +1 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +4 -0
- package/build/crash-reporter.d.ts +14 -0
- package/build/crash-reporter.d.ts.map +1 -0
- package/build/crash-reporter.js +110 -0
- package/build/insights-handler.d.ts +4 -1
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +47 -4
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +16 -12
- package/build/reporter.d.ts +4 -1
- package/build/reporter.d.ts.map +1 -1
- package/build/reporter.js +5 -2
- package/build/service.d.ts.map +1 -1
- package/build/service.js +18 -11
- package/build/types.d.ts +14 -0
- package/build/types.d.ts.map +1 -1
- package/build/util.d.ts +23 -6
- package/build/util.d.ts.map +1 -1
- package/build/util.js +81 -11
- package/package.json +3 -3
package/build/constants.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ export declare const DATA_BATCH_INTERVAL = 2000;
|
|
|
11
11
|
export declare const BATCH_EVENT_TYPES: string[];
|
|
12
12
|
export declare const DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS = 5000;
|
|
13
13
|
export declare const DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = 100;
|
|
14
|
+
export declare const BSTACK_SERVICE_VERSION: any;
|
|
14
15
|
//# 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,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAKpD,eAAO,MAAM,mBAAmB,qHAStB,CAAA;AAEV,eAAO,MAAM,mBAAmB,UAI/B,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,kBAAkB,CAIvD,CAAA;AAED,eAAO,MAAM,aAAa,qDAAqD,CAAA;AAC/E,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AACjD,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AACjD,eAAO,MAAM,wBAAwB,uBAAuB,CAAA;AAC5D,eAAO,MAAM,eAAe,OAAO,CAAA;AACnC,eAAO,MAAM,mBAAmB,OAAO,CAAA;AACvC,eAAO,MAAM,iBAAiB,UAAgH,CAAA;AAC9I,eAAO,MAAM,wCAAwC,OAAO,CAAA;AAC5D,eAAO,MAAM,yCAAyC,MAAM,CAAA;AAC5D,eAAO,MAAM,sBAAsB,KAAuB,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
const { version: bstackServiceVersion } = require('../package.json');
|
|
1
4
|
export const BROWSER_DESCRIPTION = [
|
|
2
5
|
'device',
|
|
3
6
|
'os',
|
|
@@ -27,3 +30,4 @@ export const DATA_BATCH_INTERVAL = 2000;
|
|
|
27
30
|
export const BATCH_EVENT_TYPES = ['LogCreated', 'TestRunStarted', 'TestRunFinished', 'HookRunFinished', 'HookRunStarted', 'ScreenshotCreated'];
|
|
28
31
|
export const DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS = 5000; // 5s
|
|
29
32
|
export const DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = 100; // 100ms
|
|
33
|
+
export const BSTACK_SERVICE_VERSION = bstackServiceVersion;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Capabilities, Options } from '@wdio/types';
|
|
2
|
+
import type { BrowserstackConfig, UserConfigforReporting } from './types.js';
|
|
3
|
+
export default class CrashReporter {
|
|
4
|
+
static userConfigForReporting: UserConfigforReporting;
|
|
5
|
+
private static credentialsForCrashReportUpload;
|
|
6
|
+
static setCredentialsForCrashReportUpload(options: BrowserstackConfig & Options.Testrunner, config: Options.Testrunner): void;
|
|
7
|
+
static setConfigDetails(userConfig: Options.Testrunner, capabilities: Capabilities.RemoteCapability, options: BrowserstackConfig & Options.Testrunner): void;
|
|
8
|
+
static uploadCrashReport(exception: any, stackTrace: string): Promise<void>;
|
|
9
|
+
static deletePIIKeysFromObject(obj: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}): void;
|
|
12
|
+
static filterPII(userConfig: Options.Testrunner): any;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=crash-reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crash-reporter.d.ts","sourceRoot":"","sources":["../src/crash-reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIxD,OAAO,KAAK,EAAE,kBAAkB,EAAmC,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAK7G,MAAM,CAAC,OAAO,OAAO,aAAa;IAE9B,OAAc,sBAAsB,EAAE,sBAAsB,CAAK;IAEjE,OAAO,CAAC,MAAM,CAAC,+BAA+B,CAAsC;IAEpF,MAAM,CAAC,kCAAkC,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU;IAQtH,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU;WAgBxI,iBAAiB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM;IA6CjE,MAAM,CAAC,uBAAuB,CAAC,GAAG,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAOxD,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU;CAyBlD"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import logger from '@wdio/logger';
|
|
2
|
+
import got from 'got';
|
|
3
|
+
import { BSTACK_SERVICE_VERSION, DATA_ENDPOINT } from './constants.js';
|
|
4
|
+
import { DEFAULT_REQUEST_CONFIG, getObservabilityKey, getObservabilityUser } from './util.js';
|
|
5
|
+
const log = logger('@wdio/browserstack-service');
|
|
6
|
+
class CrashReporter {
|
|
7
|
+
/* User test config for build run minus PII */
|
|
8
|
+
static userConfigForReporting = {};
|
|
9
|
+
/* User credentials used for reporting crashes in browserstack service */
|
|
10
|
+
static credentialsForCrashReportUpload = {};
|
|
11
|
+
static setCredentialsForCrashReportUpload(options, config) {
|
|
12
|
+
this.credentialsForCrashReportUpload = {
|
|
13
|
+
username: getObservabilityUser(options, config),
|
|
14
|
+
password: getObservabilityKey(options, config)
|
|
15
|
+
};
|
|
16
|
+
process.env.CREDENTIALS_FOR_CRASH_REPORTING = JSON.stringify(this.credentialsForCrashReportUpload);
|
|
17
|
+
}
|
|
18
|
+
static setConfigDetails(userConfig, capabilities, options) {
|
|
19
|
+
const configWithoutPII = this.filterPII(userConfig);
|
|
20
|
+
this.userConfigForReporting = {
|
|
21
|
+
framework: userConfig.framework,
|
|
22
|
+
services: configWithoutPII.services,
|
|
23
|
+
capabilities: capabilities,
|
|
24
|
+
env: {
|
|
25
|
+
'BROWSERSTACK_BUILD': process.env.BROWSERSTACK_BUILD,
|
|
26
|
+
'BROWSERSTACK_BUILD_NAME': process.env.BROWSERSTACK_BUILD_NAME,
|
|
27
|
+
'BUILD_TAG': process.env.BUILD_TAG
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
process.env.USER_CONFIG_FOR_REPORTING = JSON.stringify(this.userConfigForReporting);
|
|
31
|
+
this.setCredentialsForCrashReportUpload(options, userConfig);
|
|
32
|
+
}
|
|
33
|
+
static async uploadCrashReport(exception, stackTrace) {
|
|
34
|
+
try {
|
|
35
|
+
if (!this.credentialsForCrashReportUpload.username || !this.credentialsForCrashReportUpload.password) {
|
|
36
|
+
this.credentialsForCrashReportUpload = process.env.CREDENTIALS_FOR_CRASH_REPORTING !== undefined ? JSON.parse(process.env.CREDENTIALS_FOR_CRASH_REPORTING) : this.credentialsForCrashReportUpload;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return log.error(`[Crash_Report_Upload] Failed to parse user credentials while reporting crash due to ${error}`);
|
|
41
|
+
}
|
|
42
|
+
if (!this.credentialsForCrashReportUpload.username || !this.credentialsForCrashReportUpload.password) {
|
|
43
|
+
return log.error('[Crash_Report_Upload] Failed to parse user credentials while reporting crash');
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
if (Object.keys(this.userConfigForReporting).length === 0) {
|
|
47
|
+
this.userConfigForReporting = process.env.USER_CONFIG_FOR_REPORTING !== undefined ? JSON.parse(process.env.USER_CONFIG_FOR_REPORTING) : {};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
log.error(`[Crash_Report_Upload] Failed to parse user config while reporting crash due to ${error}`);
|
|
52
|
+
this.userConfigForReporting = {};
|
|
53
|
+
}
|
|
54
|
+
const data = {
|
|
55
|
+
hashed_id: process.env.BS_TESTOPS_BUILD_HASHED_ID,
|
|
56
|
+
observability_version: {
|
|
57
|
+
frameworkName: 'WebdriverIO-' + (this.userConfigForReporting.framework || 'null'),
|
|
58
|
+
sdkVersion: BSTACK_SERVICE_VERSION
|
|
59
|
+
},
|
|
60
|
+
exception: {
|
|
61
|
+
error: exception.toString(),
|
|
62
|
+
stackTrace: stackTrace
|
|
63
|
+
},
|
|
64
|
+
config: this.userConfigForReporting
|
|
65
|
+
};
|
|
66
|
+
const url = `${DATA_ENDPOINT}/api/v1/analytics`;
|
|
67
|
+
got.post(url, {
|
|
68
|
+
...DEFAULT_REQUEST_CONFIG,
|
|
69
|
+
...this.credentialsForCrashReportUpload,
|
|
70
|
+
json: data
|
|
71
|
+
}).text().then(response => {
|
|
72
|
+
log.debug(`[Crash_Report_Upload] Success response: ${JSON.stringify(response)}`);
|
|
73
|
+
}).catch((error) => {
|
|
74
|
+
log.error(`[Crash_Report_Upload] Failed due to ${error}`);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
static deletePIIKeysFromObject(obj) {
|
|
78
|
+
if (!obj) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
['user', 'username', 'key', 'accessKey'].forEach(key => delete obj[key]);
|
|
82
|
+
}
|
|
83
|
+
static filterPII(userConfig) {
|
|
84
|
+
const configWithoutPII = JSON.parse(JSON.stringify(userConfig));
|
|
85
|
+
this.deletePIIKeysFromObject(configWithoutPII);
|
|
86
|
+
const finalServices = [];
|
|
87
|
+
const initialServices = configWithoutPII.services;
|
|
88
|
+
delete configWithoutPII.services;
|
|
89
|
+
try {
|
|
90
|
+
for (const serviceArray of initialServices) {
|
|
91
|
+
if (Array.isArray(serviceArray) && serviceArray.length >= 2 && serviceArray[0] === 'browserstack') {
|
|
92
|
+
for (let idx = 1; idx < serviceArray.length; idx++) {
|
|
93
|
+
this.deletePIIKeysFromObject(serviceArray[idx]);
|
|
94
|
+
serviceArray[idx] && this.deletePIIKeysFromObject(serviceArray[idx].testObservabilityOptions);
|
|
95
|
+
}
|
|
96
|
+
finalServices.push(serviceArray);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
/* Wrong configuration like strings instead of json objects could break this method, needs no action */
|
|
103
|
+
log.error(`Error in parsing user config PII with error ${err ? (err.stack || err) : err}`);
|
|
104
|
+
return configWithoutPII;
|
|
105
|
+
}
|
|
106
|
+
configWithoutPII.services = finalServices;
|
|
107
|
+
return configWithoutPII;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export default CrashReporter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Frameworks } from '@wdio/types';
|
|
2
2
|
import type { BeforeCommandArgs, AfterCommandArgs } from '@wdio/reporter';
|
|
3
3
|
import type { Pickle, ITestCaseHookParameter } from './cucumber-types.js';
|
|
4
|
-
|
|
4
|
+
declare class _InsightsHandler {
|
|
5
5
|
private _browser;
|
|
6
6
|
private _framework?;
|
|
7
7
|
private _tests;
|
|
@@ -38,4 +38,7 @@ export default class InsightsHandler {
|
|
|
38
38
|
private getIntegrationsObject;
|
|
39
39
|
private getIdentifier;
|
|
40
40
|
}
|
|
41
|
+
declare const InsightsHandler: typeof _InsightsHandler;
|
|
42
|
+
type InsightsHandler = _InsightsHandler;
|
|
43
|
+
export default InsightsHandler;
|
|
41
44
|
//# sourceMappingURL=insights-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGzE,OAAO,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGzE,OAAO,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAqBzE,cAAM,gBAAgB;IASL,OAAO,CAAC,QAAQ;IAAiF,OAAO,CAAC,UAAU,CAAC;IARj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O,CAAC,cAAc;IActB,OAAO,CAAC,YAAY;YAiBN,gBAAgB;YA6EhB,2BAA2B;IAmFzC,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,aAAa;CAMxB;AAGD,QAAA,MAAM,eAAe,EAAE,OAAO,gBAA0D,CAAA;AACxF,KAAK,eAAe,GAAG,gBAAgB,CAAA;AAEvC,eAAe,eAAe,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
-
import { frameworkSupportsHook, getCloudProvider, getGitMetaData, getHookType, getScenarioExamples, getUniqueIdentifier, getUniqueIdentifierForCucumber, isBrowserstackSession, isScreenshotCommand, removeAnsiColors, sleep, uploadEventData } from './util.js';
|
|
3
|
+
import { frameworkSupportsHook, getCloudProvider, getGitMetaData, getHookType, getScenarioExamples, getUniqueIdentifier, getUniqueIdentifierForCucumber, isBrowserstackSession, isScreenshotCommand, o11yClassErrorHandler, removeAnsiColors, sleep, uploadEventData } from './util.js';
|
|
4
4
|
import RequestQueueHandler from './request-handler.js';
|
|
5
5
|
import { DATA_SCREENSHOT_ENDPOINT, DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS, DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS } from './constants.js';
|
|
6
|
-
|
|
6
|
+
class _InsightsHandler {
|
|
7
7
|
_browser;
|
|
8
8
|
_framework;
|
|
9
9
|
_tests = {};
|
|
@@ -73,6 +73,41 @@ export default class InsightsHandler {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
await this.sendTestRunEvent(test, 'HookRunFinished', result);
|
|
76
|
+
if (this._framework !== 'mocha') {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const hookType = getHookType(test.title);
|
|
80
|
+
/*
|
|
81
|
+
If any of the `beforeAll`, `beforeEach`, `afterEach` then the tests after the hook won't run in mocha (https://github.com/mochajs/mocha/issues/4392)
|
|
82
|
+
So if any of this hook fails, then we are sending the next tests in the suite as skipped.
|
|
83
|
+
This won't be needed for `afterAll`, as even if `afterAll` fails all the tests that we need are already run by then, so we don't need to send the stats for them separately
|
|
84
|
+
*/
|
|
85
|
+
if (!result.passed && (hookType === 'BEFORE_EACH' || hookType === 'BEFORE_ALL' || hookType === 'AFTER_EACH')) {
|
|
86
|
+
const sendTestSkip = async (skippedTest) => {
|
|
87
|
+
// We only need to send the tests that whose state is not determined yet. The state of tests which is determined will already be sent.
|
|
88
|
+
if (skippedTest.state === undefined) {
|
|
89
|
+
const fullTitle = `${skippedTest.parent.title} - ${skippedTest.title}`;
|
|
90
|
+
this._tests[fullTitle] = {
|
|
91
|
+
uuid: uuidv4(),
|
|
92
|
+
startedAt: (new Date()).toISOString(),
|
|
93
|
+
finishedAt: (new Date()).toISOString()
|
|
94
|
+
};
|
|
95
|
+
await this.sendTestRunEvent(skippedTest, 'TestRunSkipped');
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
/*
|
|
99
|
+
Recursively send the tests as skipped for all suites below the hook. This is to handle nested describe blocks
|
|
100
|
+
*/
|
|
101
|
+
const sendSuiteSkipped = async (suite) => {
|
|
102
|
+
for (const skippedTest of suite.tests) {
|
|
103
|
+
await sendTestSkip(skippedTest);
|
|
104
|
+
}
|
|
105
|
+
for (const skippedSuite of suite.suites) {
|
|
106
|
+
await sendSuiteSkipped(skippedSuite);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
await sendSuiteSkipped(test.ctx.test.parent);
|
|
110
|
+
}
|
|
76
111
|
}
|
|
77
112
|
async beforeTest(test) {
|
|
78
113
|
const fullTitle = getUniqueIdentifier(test, this._framework);
|
|
@@ -237,7 +272,8 @@ export default class InsightsHandler {
|
|
|
237
272
|
getHierarchy(test) {
|
|
238
273
|
const value = [];
|
|
239
274
|
if (test.ctx && test.ctx.test) {
|
|
240
|
-
|
|
275
|
+
// If we already have the parent object, utilize it else get from context
|
|
276
|
+
let parent = typeof test.parent === 'object' ? test.parent : test.ctx.test.parent;
|
|
241
277
|
while (parent && parent.title !== '') {
|
|
242
278
|
value.push(parent.title);
|
|
243
279
|
parent = parent.parent;
|
|
@@ -292,13 +328,17 @@ export default class InsightsHandler {
|
|
|
292
328
|
testData.hooks = this._hooks[fullTitle];
|
|
293
329
|
}
|
|
294
330
|
}
|
|
295
|
-
if (eventType === 'TestRunStarted') {
|
|
331
|
+
if (eventType === 'TestRunStarted' || eventType === 'TestRunSkipped') {
|
|
296
332
|
testData.integrations = {};
|
|
297
333
|
if (this._browser && this._platformMeta) {
|
|
298
334
|
const provider = getCloudProvider(this._browser);
|
|
299
335
|
testData.integrations[provider] = this.getIntegrationsObject();
|
|
300
336
|
}
|
|
301
337
|
}
|
|
338
|
+
if (eventType === 'TestRunSkipped') {
|
|
339
|
+
testData.result = 'skipped';
|
|
340
|
+
eventType = 'TestRunFinished';
|
|
341
|
+
}
|
|
302
342
|
const uploadData = {
|
|
303
343
|
event_type: eventType,
|
|
304
344
|
};
|
|
@@ -406,3 +446,6 @@ export default class InsightsHandler {
|
|
|
406
446
|
return getUniqueIdentifier(test, this._framework);
|
|
407
447
|
}
|
|
408
448
|
}
|
|
449
|
+
// https://github.com/microsoft/TypeScript/issues/6543
|
|
450
|
+
const InsightsHandler = o11yClassErrorHandler(_InsightsHandler);
|
|
451
|
+
export default InsightsHandler;
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAG/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAA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AC,EAAC,MAAM,EAAE,eAAe,CAAC,EAAC,MAAM;CAQtF"}
|
package/build/launcher.js
CHANGED
|
@@ -2,17 +2,15 @@ import got from 'got';
|
|
|
2
2
|
import FormData from 'form-data';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { createRequire } from 'node:module';
|
|
6
5
|
import { promisify } from 'node:util';
|
|
7
6
|
import { performance, PerformanceObserver } from 'node:perf_hooks';
|
|
8
7
|
import { SevereServiceError } from 'webdriverio';
|
|
9
8
|
import os from 'node:os';
|
|
10
9
|
import * as BrowserstackLocalLauncher from 'browserstack-local';
|
|
11
10
|
import logger from '@wdio/logger';
|
|
12
|
-
import { VALID_APP_EXTENSION } from './constants.js';
|
|
13
|
-
import { launchTestSession, shouldAddServiceVersion, stopBuildUpstream, getCiInfo, isBStackSession } from './util.js';
|
|
14
|
-
|
|
15
|
-
const { version: bstackServiceVersion } = require('../package.json');
|
|
11
|
+
import { BSTACK_SERVICE_VERSION, VALID_APP_EXTENSION } from './constants.js';
|
|
12
|
+
import { launchTestSession, shouldAddServiceVersion, stopBuildUpstream, getCiInfo, isBStackSession, } from './util.js';
|
|
13
|
+
import CrashReporter from './crash-reporter.js';
|
|
16
14
|
const log = logger('@wdio/browserstack-service');
|
|
17
15
|
export default class BrowserstackLauncherService {
|
|
18
16
|
_options;
|
|
@@ -34,10 +32,10 @@ export default class BrowserstackLauncherService {
|
|
|
34
32
|
if (isBStackSession(this._config)) {
|
|
35
33
|
const extensionCaps = Object.keys(capability).filter((cap) => cap.includes(':'));
|
|
36
34
|
if (extensionCaps.length) {
|
|
37
|
-
capability['bstack:options'] = { wdioService:
|
|
35
|
+
capability['bstack:options'] = { wdioService: BSTACK_SERVICE_VERSION };
|
|
38
36
|
}
|
|
39
37
|
else if (shouldAddServiceVersion(this._config, this._options.testObservability)) {
|
|
40
|
-
capability['browserstack.wdioService'] =
|
|
38
|
+
capability['browserstack.wdioService'] = BSTACK_SERVICE_VERSION;
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
// Need this details for sending data to Observability
|
|
@@ -45,7 +43,7 @@ export default class BrowserstackLauncherService {
|
|
|
45
43
|
this._buildName = capability.build?.toString();
|
|
46
44
|
}
|
|
47
45
|
else {
|
|
48
|
-
capability['bstack:options'].wdioService =
|
|
46
|
+
capability['bstack:options'].wdioService = BSTACK_SERVICE_VERSION;
|
|
49
47
|
this._buildName = capability['bstack:options'].buildName;
|
|
50
48
|
this._projectName = capability['bstack:options'].projectName;
|
|
51
49
|
this._buildTag = capability['bstack:options'].buildTag;
|
|
@@ -59,17 +57,17 @@ export default class BrowserstackLauncherService {
|
|
|
59
57
|
if (isBStackSession(this._config)) {
|
|
60
58
|
const extensionCaps = Object.keys(caps.capabilities).filter((cap) => cap.includes(':'));
|
|
61
59
|
if (extensionCaps.length) {
|
|
62
|
-
caps.capabilities['bstack:options'] = { wdioService:
|
|
60
|
+
caps.capabilities['bstack:options'] = { wdioService: BSTACK_SERVICE_VERSION };
|
|
63
61
|
}
|
|
64
62
|
else if (shouldAddServiceVersion(this._config, this._options.testObservability)) {
|
|
65
|
-
caps.capabilities['browserstack.wdioService'] =
|
|
63
|
+
caps.capabilities['browserstack.wdioService'] = BSTACK_SERVICE_VERSION;
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
this._buildIdentifier = caps.capabilities['browserstack.buildIdentifier'];
|
|
69
67
|
}
|
|
70
68
|
else {
|
|
71
69
|
const bstackOptions = caps.capabilities['bstack:options'];
|
|
72
|
-
bstackOptions.wdioService =
|
|
70
|
+
bstackOptions.wdioService = BSTACK_SERVICE_VERSION;
|
|
73
71
|
this._buildName = bstackOptions.buildName;
|
|
74
72
|
this._projectName = bstackOptions.projectName;
|
|
75
73
|
this._buildTag = bstackOptions.buildTag;
|
|
@@ -85,6 +83,12 @@ export default class BrowserstackLauncherService {
|
|
|
85
83
|
process.env.BROWSERSTACK_RERUN && process.env.BROWSERSTACK_RERUN_TESTS) {
|
|
86
84
|
this._config.specs = process.env.BROWSERSTACK_RERUN_TESTS.split(',');
|
|
87
85
|
}
|
|
86
|
+
try {
|
|
87
|
+
CrashReporter.setConfigDetails(this._config, capabilities, this._options);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
log.error(`[Crash_Report_Upload] Config processing failed due to ${error}`);
|
|
91
|
+
}
|
|
88
92
|
}
|
|
89
93
|
async onPrepare(config, capabilities) {
|
|
90
94
|
/**
|
|
@@ -137,7 +141,7 @@ export default class BrowserstackLauncherService {
|
|
|
137
141
|
projectName: this._projectName,
|
|
138
142
|
buildName: this._buildName,
|
|
139
143
|
buildTag: this._buildTag,
|
|
140
|
-
bstackServiceVersion:
|
|
144
|
+
bstackServiceVersion: BSTACK_SERVICE_VERSION,
|
|
141
145
|
buildIdentifier: this._buildIdentifier
|
|
142
146
|
});
|
|
143
147
|
}
|
package/build/reporter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SuiteStats, TestStats, RunnerStats } from '@wdio/reporter';
|
|
2
2
|
import WDIOReporter from '@wdio/reporter';
|
|
3
|
-
|
|
3
|
+
declare class _TestReporter extends WDIOReporter {
|
|
4
4
|
private _capabilities;
|
|
5
5
|
private _config?;
|
|
6
6
|
private _observability;
|
|
@@ -11,4 +11,7 @@ export default class TestReporter extends WDIOReporter {
|
|
|
11
11
|
onSuiteStart(suiteStats: SuiteStats): void;
|
|
12
12
|
onTestSkip(testStats: TestStats): Promise<void>;
|
|
13
13
|
}
|
|
14
|
+
declare const TestReporter: typeof _TestReporter;
|
|
15
|
+
type TestReporter = _TestReporter;
|
|
16
|
+
export default TestReporter;
|
|
14
17
|
//# sourceMappingURL=reporter.d.ts.map
|
package/build/reporter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,YAAY,MAAM,gBAAgB,CAAA;AASzC,
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,YAAY,MAAM,gBAAgB,CAAA;AASzC,cAAM,aAAc,SAAQ,YAAY;IACpC,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,OAAO,CAAC,CAAyC;IACzD,OAAO,CAAC,cAAc,CAAO;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,oBAAoB,CAAoC;IAEhE,aAAa,CAAE,WAAW,EAAE,WAAW;IASvC,YAAY,CAAE,UAAU,EAAE,UAAU;IAI9B,UAAU,CAAE,SAAS,EAAE,SAAS;CAgDzC;AAED,QAAA,MAAM,YAAY,EAAE,OAAO,aAAoD,CAAA;AAC/E,KAAK,YAAY,GAAG,aAAa,CAAA;AACjC,eAAe,YAAY,CAAA"}
|
package/build/reporter.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import WDIOReporter from '@wdio/reporter';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
-
import { getCloudProvider, uploadEventData, getHierarchy } from './util.js';
|
|
4
|
+
import { getCloudProvider, uploadEventData, getHierarchy, o11yClassErrorHandler } from './util.js';
|
|
5
5
|
import RequestQueueHandler from './request-handler.js';
|
|
6
|
-
|
|
6
|
+
class _TestReporter extends WDIOReporter {
|
|
7
7
|
_capabilities = {};
|
|
8
8
|
_config;
|
|
9
9
|
_observability = true;
|
|
@@ -65,3 +65,6 @@ export default class TestReporter extends WDIOReporter {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
// https://github.com/microsoft/TypeScript/issues/6543
|
|
69
|
+
const TestReporter = o11yClassErrorHandler(_TestReporter);
|
|
70
|
+
export default TestReporter;
|
package/build/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAS9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAA;AACxF,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAQlF,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,QAAQ,CAAC,eAAe;IAiBpE,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IAjBnB,OAAO,CAAC,eAAe,CAAmD;IAC1E,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,iBAAiB,CAAe;IACxC,OAAO,CAAC,gBAAgB,CAA4D;IACpF,OAAO,CAAC,QAAQ,CAAC,CAAqB;IACtC,OAAO,CAAC,WAAW,CAAC,CAAQ;IAC5B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,cAAc,CAAA;IACtB,OAAO,CAAC,YAAY,CAAC,CAA0C;IAC/D,OAAO,CAAC,gBAAgB,CAAC,CAAiB;gBA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AIzF,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAiCzD,cAAc,IAAI,OAAO;IAOzB,UAAU,CAAE,WAAW,EAAE,GAAG;IAU5B,kBAAkB,CAAE,MAAM,EAAE,iBAAiB;IAqB7C,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG;IAarC,gBAAgB;YAuBR,eAAe;IA0B7B,OAAO,CAAC,cAAc;YAIR,eAAe;CAqBhC"}
|
package/build/service.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import logger from '@wdio/logger';
|
|
2
2
|
import got from 'got';
|
|
3
|
-
import { getBrowserDescription, getBrowserCapabilities, isBrowserstackCapability, getParentSuiteName, isBrowserstackSession } from './util.js';
|
|
3
|
+
import { getBrowserDescription, getBrowserCapabilities, isBrowserstackCapability, getParentSuiteName, isBrowserstackSession, } from './util.js';
|
|
4
4
|
import InsightsHandler from './insights-handler.js';
|
|
5
5
|
import TestReporter from './reporter.js';
|
|
6
6
|
import { DEFAULT_OPTIONS } from './constants.js';
|
|
7
|
+
import CrashReporter from './crash-reporter.js';
|
|
7
8
|
const log = logger('@wdio/browserstack-service');
|
|
8
9
|
export default class BrowserstackService {
|
|
9
10
|
_caps;
|
|
@@ -68,16 +69,22 @@ export default class BrowserstackService {
|
|
|
68
69
|
}
|
|
69
70
|
this._scenariosThatRan = [];
|
|
70
71
|
if (this._observability && this._browser) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
try {
|
|
73
|
+
this._insightsHandler = new InsightsHandler(this._browser, this._isAppAutomate(), this._config.framework);
|
|
74
|
+
await this._insightsHandler.before();
|
|
75
|
+
/**
|
|
76
|
+
* register command event
|
|
77
|
+
*/
|
|
78
|
+
this._browser.on('command', (command) => this._insightsHandler?.browserCommand('client:beforeCommand', Object.assign(command, { sessionId: this._browser?.sessionId }), this._currentTest));
|
|
79
|
+
/**
|
|
80
|
+
* register result event
|
|
81
|
+
*/
|
|
82
|
+
this._browser.on('result', (result) => this._insightsHandler?.browserCommand('client:afterCommand', Object.assign(result, { sessionId: this._browser?.sessionId }), this._currentTest));
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
log.error(`Error in service class before function: ${err}`);
|
|
86
|
+
CrashReporter.uploadCrashReport(`Error in service class before function: ${err}`, err && err.stack);
|
|
87
|
+
}
|
|
81
88
|
}
|
|
82
89
|
return await this._printSessionURL();
|
|
83
90
|
}
|
package/build/types.d.ts
CHANGED
|
@@ -189,6 +189,20 @@ export interface LaunchResponse {
|
|
|
189
189
|
build_hashed_id: string;
|
|
190
190
|
allow_screenshots?: boolean;
|
|
191
191
|
}
|
|
192
|
+
export interface UserConfigforReporting {
|
|
193
|
+
framework?: string;
|
|
194
|
+
services?: any[];
|
|
195
|
+
capabilities?: Capabilities.RemoteCapability;
|
|
196
|
+
env?: {
|
|
197
|
+
'BROWSERSTACK_BUILD': string | undefined;
|
|
198
|
+
'BROWSERSTACK_BUILD_NAME': string | undefined;
|
|
199
|
+
'BUILD_TAG': string | undefined;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export interface CredentialsForCrashReportUpload {
|
|
203
|
+
username?: string;
|
|
204
|
+
password?: string;
|
|
205
|
+
}
|
|
192
206
|
interface IntegrationObject {
|
|
193
207
|
capabilities?: Capabilities.Capabilities;
|
|
194
208
|
session_id?: string;
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9D,MAAM,WAAW,e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O,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,OAAO;IACb,SAAS,EAAE,MAAM,EAAE,CAAA;CACtB"}
|
package/build/util.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import http from 'node:http';
|
|
4
|
+
import https from 'node:https';
|
|
1
5
|
import type { Capabilities, Frameworks, Options } from '@wdio/types';
|
|
2
6
|
import type { BeforeCommandArgs, AfterCommandArgs } from '@wdio/reporter';
|
|
3
|
-
import type {
|
|
7
|
+
import type { UploadType, BrowserstackConfig } from './types.js';
|
|
4
8
|
import type { ITestCaseHookParameter } from './cucumber-types.js';
|
|
9
|
+
export declare const DEFAULT_REQUEST_CONFIG: {
|
|
10
|
+
agent: {
|
|
11
|
+
http: http.Agent;
|
|
12
|
+
https: https.Agent;
|
|
13
|
+
};
|
|
14
|
+
headers: {
|
|
15
|
+
'Content-Type': string;
|
|
16
|
+
'X-BSTACK-OBS': string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
5
19
|
/**
|
|
6
20
|
* get browser description for Browserstack service
|
|
7
21
|
* @param cap browser capablities
|
|
@@ -20,11 +34,13 @@ export declare function getBrowserCapabilities(browser: WebdriverIO.Browser | We
|
|
|
20
34
|
*/
|
|
21
35
|
export declare function isBrowserstackCapability(cap?: Capabilities.Capabilities): boolean;
|
|
22
36
|
export declare function getParentSuiteName(fullTitle: string, testSuiteTitle: string): string;
|
|
23
|
-
export declare function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
export declare function o11yErrorHandler(fn: Function): (...args: any) => any;
|
|
38
|
+
type ClassType = {
|
|
39
|
+
new (...args: any[]): any;
|
|
40
|
+
};
|
|
41
|
+
export declare function o11yClassErrorHandler<T extends ClassType>(errorClass: T): T;
|
|
42
|
+
export declare const launchTestSession: (...args: any) => any;
|
|
43
|
+
export declare const stopBuildUpstream: (...args: any) => any;
|
|
28
44
|
export declare function getCiInfo(): {
|
|
29
45
|
name: string;
|
|
30
46
|
build_url: string | undefined;
|
|
@@ -86,4 +102,5 @@ export declare function getObservabilityBuild(options: BrowserstackConfig & Opti
|
|
|
86
102
|
export declare function getObservabilityBuildTags(options: BrowserstackConfig & Options.Testrunner, bstackBuildTag?: string): string[];
|
|
87
103
|
export declare function frameworkSupportsHook(hook: string, framework?: string): boolean;
|
|
88
104
|
export declare const sleep: (ms?: number) => Promise<unknown>;
|
|
105
|
+
export {};
|
|
89
106
|
//# sourceMappingURL=util.d.ts.map
|
package/build/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;AAEA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,KAAK,MAAM,YAAY,CAAA;AAI9B,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAQzE,OAAO,KAAK,EAAc,UAAU,EAAkB,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC5F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAQjE,eAAO,MAAM,sBAAsB;;;;;;;;;CASlC,CAAA;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,CAAC,mBAAmB,UAa1E;AAED;;;;;GAKG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,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAW7H;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,WAUrE;AAED,eAAO,MAAM,KAAK,mCAAkE,CAAA"}
|
package/build/util.js
CHANGED
|
@@ -3,15 +3,17 @@ import { promisify } from 'node:util';
|
|
|
3
3
|
import http from 'node:http';
|
|
4
4
|
import https from 'node:https';
|
|
5
5
|
import path from 'node:path';
|
|
6
|
+
import util from 'node:util';
|
|
6
7
|
import logger from '@wdio/logger';
|
|
7
8
|
import got, { HTTPError } from 'got';
|
|
8
9
|
import gitRepoInfo from 'git-repo-info';
|
|
9
10
|
import gitconfig from 'gitconfiglocal';
|
|
10
11
|
import { BROWSER_DESCRIPTION, DATA_ENDPOINT, DATA_EVENT_ENDPOINT, DATA_SCREENSHOT_ENDPOINT } from './constants.js';
|
|
11
12
|
import RequestQueueHandler from './request-handler.js';
|
|
13
|
+
import CrashReporter from './crash-reporter.js';
|
|
12
14
|
const pGitconfig = promisify(gitconfig);
|
|
13
15
|
const log = logger('@wdio/browserstack-service');
|
|
14
|
-
const DEFAULT_REQUEST_CONFIG = {
|
|
16
|
+
export const DEFAULT_REQUEST_CONFIG = {
|
|
15
17
|
agent: {
|
|
16
18
|
http: new http.Agent({ keepAlive: true }),
|
|
17
19
|
https: new https.Agent({ keepAlive: true }),
|
|
@@ -76,7 +78,60 @@ export function getParentSuiteName(fullTitle, testSuiteTitle) {
|
|
|
76
78
|
}
|
|
77
79
|
return parentSuiteName.trim();
|
|
78
80
|
}
|
|
79
|
-
|
|
81
|
+
function processError(error, fn, args) {
|
|
82
|
+
log.error(`Error in executing ${fn.name} with args ${args}: ${error}`);
|
|
83
|
+
let argsString;
|
|
84
|
+
try {
|
|
85
|
+
argsString = JSON.stringify(args);
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
argsString = util.inspect(args, { depth: 2 });
|
|
89
|
+
}
|
|
90
|
+
CrashReporter.uploadCrashReport(`Error in executing ${fn.name} with args ${argsString} : ${error}`, error && error.stack);
|
|
91
|
+
}
|
|
92
|
+
export function o11yErrorHandler(fn) {
|
|
93
|
+
return function (...args) {
|
|
94
|
+
try {
|
|
95
|
+
const result = fn(...args);
|
|
96
|
+
if (result instanceof Promise) {
|
|
97
|
+
return result.catch(error => processError(error, fn, args));
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
processError(error, fn, args);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export function o11yClassErrorHandler(errorClass) {
|
|
107
|
+
const prototype = errorClass.prototype;
|
|
108
|
+
if (Object.getOwnPropertyNames(prototype).length < 2) {
|
|
109
|
+
return errorClass;
|
|
110
|
+
}
|
|
111
|
+
Object.getOwnPropertyNames(prototype).forEach((methodName) => {
|
|
112
|
+
const method = prototype[methodName];
|
|
113
|
+
if (typeof method === 'function' && methodName !== 'constructor') {
|
|
114
|
+
// In order to preserve this context, need to define like this
|
|
115
|
+
Object.defineProperty(prototype, methodName, {
|
|
116
|
+
writable: true,
|
|
117
|
+
value: function (...args) {
|
|
118
|
+
try {
|
|
119
|
+
const result = method.call(this, ...args);
|
|
120
|
+
if (result instanceof Promise) {
|
|
121
|
+
return result.catch(error => processError(error, method, args));
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
processError(err, method, args);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return errorClass;
|
|
133
|
+
}
|
|
134
|
+
export const launchTestSession = o11yErrorHandler(async function launchTestSession(options, config, bsConfig) {
|
|
80
135
|
const data = {
|
|
81
136
|
format: 'json',
|
|
82
137
|
project_name: getObservabilityProject(options, bsConfig.projectName),
|
|
@@ -98,8 +153,18 @@ export async function launchTestSession(options, config, bsConfig) {
|
|
|
98
153
|
observability_version: {
|
|
99
154
|
frameworkName: 'WebdriverIO-' + config.framework,
|
|
100
155
|
sdkVersion: bsConfig.bstackServiceVersion
|
|
101
|
-
}
|
|
156
|
+
},
|
|
157
|
+
config: {}
|
|
102
158
|
};
|
|
159
|
+
try {
|
|
160
|
+
if (Object.keys(CrashReporter.userConfigForReporting).length === 0) {
|
|
161
|
+
CrashReporter.userConfigForReporting = process.env.USER_CONFIG_FOR_REPORTING !== undefined ? JSON.parse(process.env.USER_CONFIG_FOR_REPORTING) : {};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return log.error(`[Crash_Report_Upload] Failed to parse user config while sending build start event due to ${error}`);
|
|
166
|
+
}
|
|
167
|
+
data.config = CrashReporter.userConfigForReporting;
|
|
103
168
|
try {
|
|
104
169
|
const url = `${DATA_ENDPOINT}/api/v1/builds`;
|
|
105
170
|
const response = await got.post(url, {
|
|
@@ -142,8 +207,8 @@ export async function launchTestSession(options, config, bsConfig) {
|
|
|
142
207
|
log.error(`Data upload to BrowserStack Test Observability failed due to ${error}`);
|
|
143
208
|
}
|
|
144
209
|
}
|
|
145
|
-
}
|
|
146
|
-
export async function stopBuildUpstream() {
|
|
210
|
+
});
|
|
211
|
+
export const stopBuildUpstream = o11yErrorHandler(async function stopBuildUpstream() {
|
|
147
212
|
if (!process.env.BS_TESTOPS_BUILD_COMPLETED) {
|
|
148
213
|
return;
|
|
149
214
|
}
|
|
@@ -180,7 +245,7 @@ export async function stopBuildUpstream() {
|
|
|
180
245
|
message: error.message
|
|
181
246
|
};
|
|
182
247
|
}
|
|
183
|
-
}
|
|
248
|
+
});
|
|
184
249
|
export function getCiInfo() {
|
|
185
250
|
const env = process.env;
|
|
186
251
|
// Jenkins
|
|
@@ -306,7 +371,12 @@ export function getUniqueIdentifier(test, framework) {
|
|
|
306
371
|
if (framework === 'jasmine') {
|
|
307
372
|
return test.fullName;
|
|
308
373
|
}
|
|
309
|
-
|
|
374
|
+
let parentTitle = test.parent;
|
|
375
|
+
// Sometimes parent will be an object instead of a string
|
|
376
|
+
if (typeof parentTitle === 'object') {
|
|
377
|
+
parentTitle = parentTitle.title;
|
|
378
|
+
}
|
|
379
|
+
return `${parentTitle} - ${test.title}`;
|
|
310
380
|
}
|
|
311
381
|
export function getUniqueIdentifierForCucumber(world) {
|
|
312
382
|
return world.pickle.uri + '_' + world.pickle.astNodeIds.join(',');
|
|
@@ -420,16 +490,16 @@ export function getHierarchy(fullTitle) {
|
|
|
420
490
|
return fullTitle.split('.').slice(0, -1);
|
|
421
491
|
}
|
|
422
492
|
export function getHookType(hookName) {
|
|
423
|
-
if (hookName.
|
|
493
|
+
if (hookName.startsWith('"before each"')) {
|
|
424
494
|
return 'BEFORE_EACH';
|
|
425
495
|
}
|
|
426
|
-
else if (hookName.
|
|
496
|
+
else if (hookName.startsWith('"before all"')) {
|
|
427
497
|
return 'BEFORE_ALL';
|
|
428
498
|
}
|
|
429
|
-
else if (hookName.
|
|
499
|
+
else if (hookName.startsWith('"after each"')) {
|
|
430
500
|
return 'AFTER_EACH';
|
|
431
501
|
}
|
|
432
|
-
else if (hookName.
|
|
502
|
+
else if (hookName.startsWith('"after all"')) {
|
|
433
503
|
return 'AFTER_ALL';
|
|
434
504
|
}
|
|
435
505
|
return 'unknown';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/browserstack-service",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "WebdriverIO service for better Browserstack integration",
|
|
5
5
|
"author": "Adam Bjerstedt <abjerstedt@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browserstack-service",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"gitconfiglocal": "^2.1.0",
|
|
41
41
|
"got": "^12.1.0",
|
|
42
42
|
"uuid": "^8.3.2",
|
|
43
|
-
"webdriverio": "8.
|
|
43
|
+
"webdriverio": "8.9.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@wdio/cli": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "6aa655ac57e4917a15204fa776f0fc82bdf35317"
|
|
55
55
|
}
|