@wdio/browserstack-service 8.6.9 → 8.8.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/insights-handler.d.ts +2 -0
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +42 -30
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +19 -13
- package/build/service.d.ts +1 -0
- package/build/service.d.ts.map +1 -1
- package/build/service.js +6 -2
- package/build/util.d.ts +3 -1
- package/build/util.d.ts.map +1 -1
- package/build/util.js +19 -1
- package/package.json +5 -5
|
@@ -9,8 +9,10 @@ export default class InsightsHandler {
|
|
|
9
9
|
private _platformMeta;
|
|
10
10
|
private _commands;
|
|
11
11
|
private _gitConfigPath?;
|
|
12
|
+
private _suiteFile?;
|
|
12
13
|
private _requestQueueHandler;
|
|
13
14
|
constructor(_browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser, isAppAutomate?: boolean, _framework?: string | undefined);
|
|
15
|
+
setSuiteFile(filename: string): void;
|
|
14
16
|
before(): Promise<void>;
|
|
15
17
|
beforeHook(test: Frameworks.Test, context: any): Promise<void>;
|
|
16
18
|
afterHook(test: Frameworks.Test, result: Frameworks.TestResult): Promise<void>;
|
|
@@ -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;AAOzE,MAAM,CAAC,OAAO,OAAO,eAAe;
|
|
1
|
+
{"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,UAAU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,UAAU,CAAC,YAAY;IA0BzF,aAAa,CACf,WAAW,SAA2C,EACtD,YAAY,SAA4C,GACzD,OAAO,CAAC,OAAO,CAAC;IASb,QAAQ;IAId;;OAEG;IACG,cAAc,CAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,GAAG,sBAAsB;IA2DtI,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,YAAY;YAgBN,gBAAgB;YAwEhB,2BAA2B;IAmFzC,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,aAAa;CAMxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
-
import { 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, 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
|
export default class InsightsHandler {
|
|
@@ -11,6 +11,7 @@ export default class InsightsHandler {
|
|
|
11
11
|
_platformMeta;
|
|
12
12
|
_commands = {};
|
|
13
13
|
_gitConfigPath;
|
|
14
|
+
_suiteFile;
|
|
14
15
|
_requestQueueHandler = RequestQueueHandler.getInstance();
|
|
15
16
|
constructor(_browser, isAppAutomate, _framework) {
|
|
16
17
|
this._browser = _browser;
|
|
@@ -27,6 +28,9 @@ export default class InsightsHandler {
|
|
|
27
28
|
product: isAppAutomate ? 'app-automate' : 'automate'
|
|
28
29
|
};
|
|
29
30
|
}
|
|
31
|
+
setSuiteFile(filename) {
|
|
32
|
+
this._suiteFile = filename;
|
|
33
|
+
}
|
|
30
34
|
async before() {
|
|
31
35
|
if (isBrowserstackSession(this._browser)) {
|
|
32
36
|
await this._browser.execute(`browserstack_executor: ${JSON.stringify({
|
|
@@ -43,33 +47,35 @@ export default class InsightsHandler {
|
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
49
|
async beforeHook(test, context) {
|
|
46
|
-
if (this._framework
|
|
47
|
-
|
|
48
|
-
const hookId = uuidv4();
|
|
49
|
-
this._tests[fullTitle] = {
|
|
50
|
-
uuid: hookId,
|
|
51
|
-
startedAt: (new Date()).toISOString()
|
|
52
|
-
};
|
|
53
|
-
this.attachHookData(context, hookId);
|
|
54
|
-
await this.sendTestRunEvent(test, 'HookRunStarted');
|
|
50
|
+
if (!frameworkSupportsHook('before', this._framework)) {
|
|
51
|
+
return;
|
|
55
52
|
}
|
|
53
|
+
const fullTitle = getUniqueIdentifier(test, this._framework);
|
|
54
|
+
const hookId = uuidv4();
|
|
55
|
+
this._tests[fullTitle] = {
|
|
56
|
+
uuid: hookId,
|
|
57
|
+
startedAt: (new Date()).toISOString()
|
|
58
|
+
};
|
|
59
|
+
this.attachHookData(context, hookId);
|
|
60
|
+
await this.sendTestRunEvent(test, 'HookRunStarted');
|
|
56
61
|
}
|
|
57
62
|
async afterHook(test, result) {
|
|
58
|
-
if (this._framework
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
if (!frameworkSupportsHook('after', this._framework)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const fullTitle = getUniqueIdentifier(test, this._framework);
|
|
67
|
+
if (this._tests[fullTitle]) {
|
|
68
|
+
this._tests[fullTitle].finishedAt = (new Date()).toISOString();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this._tests[fullTitle] = {
|
|
72
|
+
finishedAt: (new Date()).toISOString()
|
|
73
|
+
};
|
|
69
74
|
}
|
|
75
|
+
await this.sendTestRunEvent(test, 'HookRunFinished', result);
|
|
70
76
|
}
|
|
71
77
|
async beforeTest(test) {
|
|
72
|
-
const fullTitle = getUniqueIdentifier(test);
|
|
78
|
+
const fullTitle = getUniqueIdentifier(test, this._framework);
|
|
73
79
|
this._tests[fullTitle] = {
|
|
74
80
|
uuid: uuidv4(),
|
|
75
81
|
startedAt: (new Date()).toISOString()
|
|
@@ -77,7 +83,7 @@ export default class InsightsHandler {
|
|
|
77
83
|
await this.sendTestRunEvent(test, 'TestRunStarted');
|
|
78
84
|
}
|
|
79
85
|
async afterTest(test, result) {
|
|
80
|
-
const fullTitle = getUniqueIdentifier(test);
|
|
86
|
+
const fullTitle = getUniqueIdentifier(test, this._framework);
|
|
81
87
|
this._tests[fullTitle] = {
|
|
82
88
|
...(this._tests[fullTitle] || {}),
|
|
83
89
|
finishedAt: (new Date()).toISOString()
|
|
@@ -237,15 +243,21 @@ export default class InsightsHandler {
|
|
|
237
243
|
parent = parent.parent;
|
|
238
244
|
}
|
|
239
245
|
}
|
|
246
|
+
else if (test.description && test.fullName) {
|
|
247
|
+
// for Jasmine
|
|
248
|
+
value.push(test.description);
|
|
249
|
+
value.push(test.fullName.replace(new RegExp(' ' + test.description + '$'), ''));
|
|
250
|
+
}
|
|
240
251
|
return value.reverse();
|
|
241
252
|
}
|
|
242
253
|
async sendTestRunEvent(test, eventType, results) {
|
|
243
|
-
const fullTitle = getUniqueIdentifier(test);
|
|
254
|
+
const fullTitle = getUniqueIdentifier(test, this._framework);
|
|
244
255
|
const testMetaData = this._tests[fullTitle];
|
|
256
|
+
const filename = test.file || this._suiteFile;
|
|
245
257
|
const testData = {
|
|
246
258
|
uuid: testMetaData.uuid,
|
|
247
|
-
type: test.type,
|
|
248
|
-
name: test.title,
|
|
259
|
+
type: test.type || 'test',
|
|
260
|
+
name: test.title || test.description,
|
|
249
261
|
body: {
|
|
250
262
|
lang: 'webdriverio',
|
|
251
263
|
code: test.body
|
|
@@ -253,9 +265,9 @@ export default class InsightsHandler {
|
|
|
253
265
|
scope: fullTitle,
|
|
254
266
|
scopes: this.getHierarchy(test),
|
|
255
267
|
identifier: fullTitle,
|
|
256
|
-
file_name:
|
|
257
|
-
location:
|
|
258
|
-
vc_filepath: (this._gitConfigPath &&
|
|
268
|
+
file_name: filename,
|
|
269
|
+
location: filename,
|
|
270
|
+
vc_filepath: (this._gitConfigPath && filename) ? path.relative(this._gitConfigPath, filename) : undefined,
|
|
259
271
|
started_at: testMetaData.startedAt,
|
|
260
272
|
finished_at: testMetaData.finishedAt,
|
|
261
273
|
result: 'pending',
|
|
@@ -391,6 +403,6 @@ export default class InsightsHandler {
|
|
|
391
403
|
if ('pickle' in test) {
|
|
392
404
|
return getUniqueIdentifierForCucumber(test);
|
|
393
405
|
}
|
|
394
|
-
return getUniqueIdentifier(test);
|
|
406
|
+
return getUniqueIdentifier(test, this._framework);
|
|
395
407
|
}
|
|
396
408
|
}
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAUA,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,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAG/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AAC,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;CAQtF"}
|
package/build/launcher.js
CHANGED
|
@@ -10,7 +10,7 @@ import os from 'node:os';
|
|
|
10
10
|
import * as BrowserstackLocalLauncher from 'browserstack-local';
|
|
11
11
|
import logger from '@wdio/logger';
|
|
12
12
|
import { VALID_APP_EXTENSION } from './constants.js';
|
|
13
|
-
import { launchTestSession, shouldAddServiceVersion, stopBuildUpstream, getCiInfo } from './util.js';
|
|
13
|
+
import { launchTestSession, shouldAddServiceVersion, stopBuildUpstream, getCiInfo, isBStackSession } from './util.js';
|
|
14
14
|
const require = createRequire(import.meta.url);
|
|
15
15
|
const { version: bstackServiceVersion } = require('../package.json');
|
|
16
16
|
const log = logger('@wdio/browserstack-service');
|
|
@@ -30,13 +30,17 @@ export default class BrowserstackLauncherService {
|
|
|
30
30
|
if (Array.isArray(capabilities)) {
|
|
31
31
|
capabilities.forEach((capability) => {
|
|
32
32
|
if (!capability['bstack:options']) {
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
// Skipping adding of service version if session is not of browserstack
|
|
34
|
+
if (isBStackSession(this._config)) {
|
|
35
|
+
const extensionCaps = Object.keys(capability).filter((cap) => cap.includes(':'));
|
|
36
|
+
if (extensionCaps.length) {
|
|
37
|
+
capability['bstack:options'] = { wdioService: bstackServiceVersion };
|
|
38
|
+
}
|
|
39
|
+
else if (shouldAddServiceVersion(this._config, this._options.testObservability)) {
|
|
40
|
+
capability['browserstack.wdioService'] = bstackServiceVersion;
|
|
41
|
+
}
|
|
39
42
|
}
|
|
43
|
+
// Need this details for sending data to Observability
|
|
40
44
|
this._buildIdentifier = capability['browserstack.buildIdentifier']?.toString();
|
|
41
45
|
this._buildName = capability.build?.toString();
|
|
42
46
|
}
|
|
@@ -52,12 +56,14 @@ export default class BrowserstackLauncherService {
|
|
|
52
56
|
else if (typeof capabilities === 'object') {
|
|
53
57
|
Object.entries(capabilities).forEach(([, caps]) => {
|
|
54
58
|
if (!caps.capabilities['bstack:options']) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
if (isBStackSession(this._config)) {
|
|
60
|
+
const extensionCaps = Object.keys(caps.capabilities).filter((cap) => cap.includes(':'));
|
|
61
|
+
if (extensionCaps.length) {
|
|
62
|
+
caps.capabilities['bstack:options'] = { wdioService: bstackServiceVersion };
|
|
63
|
+
}
|
|
64
|
+
else if (shouldAddServiceVersion(this._config, this._options.testObservability)) {
|
|
65
|
+
caps.capabilities['browserstack.wdioService'] = bstackServiceVersion;
|
|
66
|
+
}
|
|
61
67
|
}
|
|
62
68
|
this._buildIdentifier = caps.capabilities['browserstack.buildIdentifier'];
|
|
63
69
|
}
|
package/build/service.d.ts
CHANGED
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;AAG9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAA;AACxF,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAOlF,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,QAAQ,CAAC,eAAe;
|
|
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,E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,UAAU,CAAC,KAAK;IASpC,UAAU,CAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG;IAO/C,SAAS,CAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,UAAU;IAIjF,UAAU,CAAE,IAAI,EAAE,UAAU,CAAC,IAAI;IAoBjC,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU;IAS/E,KAAK,CAAE,MAAM,EAAE,MAAM;IAqB3B;;OAEG;IAEG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAMjD;;;OAGG;IACG,cAAc,CAAE,KAAK,EAAE,sBAAsB;IAO7C,aAAa,CAAE,KAAK,EAAE,sBAAsB;IAsB5C,UAAU,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM;IAKzD,SAAS,CAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,YAAY;IAIzF,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
|
@@ -14,6 +14,7 @@ export default class BrowserstackService {
|
|
|
14
14
|
_failureStatuses = ['failed', 'ambiguous', 'undefined', 'unknown'];
|
|
15
15
|
_browser;
|
|
16
16
|
_suiteTitle;
|
|
17
|
+
_suiteFile;
|
|
17
18
|
_fullTitle;
|
|
18
19
|
_options;
|
|
19
20
|
_specsRan = false;
|
|
@@ -48,10 +49,11 @@ export default class BrowserstackService {
|
|
|
48
49
|
// if no user and key is specified even though a browserstack service was
|
|
49
50
|
// provided set user and key with values so that the session request
|
|
50
51
|
// will fail
|
|
51
|
-
|
|
52
|
+
const testObservabilityOptions = this._options.testObservabilityOptions;
|
|
53
|
+
if (!config.user && !(testObservabilityOptions && testObservabilityOptions.user)) {
|
|
52
54
|
config.user = 'NotSetUser';
|
|
53
55
|
}
|
|
54
|
-
if (!config.key) {
|
|
56
|
+
if (!config.key && !(testObservabilityOptions && testObservabilityOptions.key)) {
|
|
55
57
|
config.key = 'NotSetKey';
|
|
56
58
|
}
|
|
57
59
|
this._config.user = config.user;
|
|
@@ -88,6 +90,7 @@ export default class BrowserstackService {
|
|
|
88
90
|
*/
|
|
89
91
|
async beforeSuite(suite) {
|
|
90
92
|
this._suiteTitle = suite.title;
|
|
93
|
+
this._insightsHandler?.setSuiteFile(suite.file);
|
|
91
94
|
if (suite.title && suite.title !== 'Jasmine__TopLevel__Suite') {
|
|
92
95
|
await this._setSessionName(suite.title);
|
|
93
96
|
}
|
|
@@ -209,6 +212,7 @@ export default class BrowserstackService {
|
|
|
209
212
|
this._scenariosThatRan = [];
|
|
210
213
|
delete this._suiteTitle;
|
|
211
214
|
delete this._fullTitle;
|
|
215
|
+
delete this._suiteFile;
|
|
212
216
|
this._failReasons = [];
|
|
213
217
|
await this._printSessionURL();
|
|
214
218
|
}
|
package/build/util.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare function getGitMetaData(): Promise<{
|
|
|
62
62
|
url: any;
|
|
63
63
|
}[];
|
|
64
64
|
} | undefined>;
|
|
65
|
-
export declare function getUniqueIdentifier(test: Frameworks.Test): string;
|
|
65
|
+
export declare function getUniqueIdentifier(test: Frameworks.Test, framework?: string): string;
|
|
66
66
|
export declare function getUniqueIdentifierForCucumber(world: ITestCaseHookParameter): string;
|
|
67
67
|
export declare function getCloudProvider(browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser): string;
|
|
68
68
|
export declare function isBrowserstackSession(browser?: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser): boolean | undefined;
|
|
@@ -76,6 +76,7 @@ export declare function uploadEventData(eventData: UploadType | Array<UploadType
|
|
|
76
76
|
export declare function getHierarchy(fullTitle?: string): string[];
|
|
77
77
|
export declare function getHookType(hookName: string): string;
|
|
78
78
|
export declare function isScreenshotCommand(args: BeforeCommandArgs & AfterCommandArgs): boolean | "" | undefined;
|
|
79
|
+
export declare function isBStackSession(config: Options.Testrunner): boolean;
|
|
79
80
|
export declare function shouldAddServiceVersion(config: Options.Testrunner, testObservability?: boolean): boolean;
|
|
80
81
|
export declare function batchAndPostEvents(eventUrl: string, kind: string, data: UploadType[]): Promise<void>;
|
|
81
82
|
export declare function getObservabilityUser(options: BrowserstackConfig & Options.Testrunner, config: Options.Testrunner): string | undefined;
|
|
@@ -83,5 +84,6 @@ export declare function getObservabilityKey(options: BrowserstackConfig & Option
|
|
|
83
84
|
export declare function getObservabilityProject(options: BrowserstackConfig & Options.Testrunner, bstackProjectName?: string): string | undefined;
|
|
84
85
|
export declare function getObservabilityBuild(options: BrowserstackConfig & Options.Testrunner, bstackBuildName?: string): string;
|
|
85
86
|
export declare function getObservabilityBuildTags(options: BrowserstackConfig & Options.Testrunner, bstackBuildTag?: string): string[];
|
|
87
|
+
export declare function frameworkSupportsHook(hook: string, framework?: string): boolean;
|
|
86
88
|
export declare const sleep: (ms?: number) => Promise<unknown>;
|
|
87
89
|
//# 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":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,KAAK,EA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AAE,kBAAkB,GAAG,OAAO,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
|
@@ -302,7 +302,10 @@ export async function getGitMetaData() {
|
|
|
302
302
|
remotes: remotes
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
export function getUniqueIdentifier(test) {
|
|
305
|
+
export function getUniqueIdentifier(test, framework) {
|
|
306
|
+
if (framework === 'jasmine') {
|
|
307
|
+
return test.fullName;
|
|
308
|
+
}
|
|
306
309
|
return `${test.parent} - ${test.title}`;
|
|
307
310
|
}
|
|
308
311
|
export function getUniqueIdentifierForCucumber(world) {
|
|
@@ -434,6 +437,12 @@ export function getHookType(hookName) {
|
|
|
434
437
|
export function isScreenshotCommand(args) {
|
|
435
438
|
return args.endpoint && args.endpoint.includes('/screenshot');
|
|
436
439
|
}
|
|
440
|
+
export function isBStackSession(config) {
|
|
441
|
+
if (typeof config.user === 'string' && typeof config.key === 'string' && config.key.length === 20) {
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
437
446
|
export function shouldAddServiceVersion(config, testObservability) {
|
|
438
447
|
if (config.services && config.services.toString().includes('chromedriver') && testObservability !== false) {
|
|
439
448
|
return false;
|
|
@@ -508,4 +517,13 @@ export function getObservabilityBuildTags(options, bstackBuildTag) {
|
|
|
508
517
|
}
|
|
509
518
|
return [];
|
|
510
519
|
}
|
|
520
|
+
export function frameworkSupportsHook(hook, framework) {
|
|
521
|
+
if (framework === 'mocha' && (hook === 'before' || hook === 'after' || hook === 'beforeEach' || hook === 'afterEach')) {
|
|
522
|
+
return true;
|
|
523
|
+
}
|
|
524
|
+
if (framework === 'jasmine' && (hook === 'beforeEach' || hook === 'afterEach')) {
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
511
529
|
export const sleep = (ms = 100) => new Promise((resolve) => setTimeout(resolve, ms));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/browserstack-service",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.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",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@types/gitconfiglocal": "^2.0.1",
|
|
34
34
|
"@wdio/logger": "8.6.6",
|
|
35
|
-
"@wdio/reporter": "8.
|
|
36
|
-
"@wdio/types": "8.
|
|
35
|
+
"@wdio/reporter": "8.8.0",
|
|
36
|
+
"@wdio/types": "8.8.0",
|
|
37
37
|
"browserstack-local": "^1.5.1",
|
|
38
38
|
"form-data": "^4.0.0",
|
|
39
39
|
"git-repo-info": "^2.1.1",
|
|
40
40
|
"gitconfiglocal": "^2.1.0",
|
|
41
41
|
"got": "^12.1.0",
|
|
42
42
|
"uuid": "^8.3.2",
|
|
43
|
-
"webdriverio": "8.
|
|
43
|
+
"webdriverio": "8.8.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": "5089710e47a4bf14dac948302ac12edd71a83331"
|
|
55
55
|
}
|