@wdio/browserstack-service 7.32.4 → 7.34.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/accessibility-handler.d.ts +39 -0
- package/build/accessibility-handler.d.ts.map +1 -0
- package/build/accessibility-handler.js +258 -0
- package/build/cleanup.d.ts +5 -0
- package/build/cleanup.d.ts.map +1 -0
- package/build/cleanup.js +23 -0
- package/build/constants.d.ts +3 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +6 -2
- package/build/cucumber-types.d.ts +17 -0
- package/build/cucumber-types.d.ts.map +1 -1
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -1
- package/build/insights-handler.d.ts +19 -3
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +275 -17
- package/build/launcher.d.ts +6 -0
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +164 -0
- package/build/log4jsAppender.d.ts +2 -0
- package/build/log4jsAppender.d.ts.map +1 -0
- package/build/log4jsAppender.js +26 -0
- package/build/logPatcher.d.ts +13 -0
- package/build/logPatcher.d.ts.map +1 -0
- package/build/logPatcher.js +43 -0
- package/build/logReportingAPI.d.ts +12 -0
- package/build/logReportingAPI.d.ts.map +1 -0
- package/build/logReportingAPI.js +61 -0
- package/build/reporter.d.ts +6 -1
- package/build/reporter.d.ts.map +1 -1
- package/build/reporter.js +42 -1
- package/build/request-handler.d.ts +1 -0
- package/build/request-handler.d.ts.map +1 -1
- package/build/request-handler.js +5 -0
- package/build/scripts/test-event-scripts.d.ts +10 -0
- package/build/scripts/test-event-scripts.d.ts.map +1 -0
- package/build/scripts/test-event-scripts.js +73 -0
- package/build/service.d.ts +6 -3
- package/build/service.d.ts.map +1 -1
- package/build/service.js +50 -7
- package/build/types.d.ts +43 -1
- package/build/types.d.ts.map +1 -1
- package/build/util.d.ts +48 -1
- package/build/util.d.ts.map +1 -1
- package/build/util.js +448 -11
- package/package.json +6 -5
|
@@ -4,11 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
7
8
|
const uuid_1 = require("uuid");
|
|
8
9
|
const reporter_1 = __importDefault(require("./reporter"));
|
|
9
10
|
const util_1 = require("./util");
|
|
10
11
|
const request_handler_1 = __importDefault(require("./request-handler"));
|
|
11
12
|
const constants_1 = require("./constants");
|
|
13
|
+
const log = (0, logger_1.default)('@wdio/browserstack-service');
|
|
12
14
|
class _InsightsHandler {
|
|
13
15
|
constructor(_browser, browserCaps, isAppAutomate, sessionId, _framework) {
|
|
14
16
|
this._browser = _browser;
|
|
@@ -17,6 +19,32 @@ class _InsightsHandler {
|
|
|
17
19
|
this._hooks = {};
|
|
18
20
|
this._commands = {};
|
|
19
21
|
this._requestQueueHandler = request_handler_1.default.getInstance();
|
|
22
|
+
this._currentTest = {};
|
|
23
|
+
this._currentHook = {};
|
|
24
|
+
this._cucumberData = {
|
|
25
|
+
stepsStarted: false,
|
|
26
|
+
scenariosStarted: false,
|
|
27
|
+
steps: []
|
|
28
|
+
};
|
|
29
|
+
this.appendTestItemLog = async (stdLog) => {
|
|
30
|
+
try {
|
|
31
|
+
if (this._currentHook.uuid && !this._currentHook.finished && (this._framework === 'mocha' || this._framework === 'cucumber')) {
|
|
32
|
+
stdLog.hook_run_uuid = this._currentHook.uuid;
|
|
33
|
+
}
|
|
34
|
+
else if (this._currentTest.uuid && (this._framework === 'mocha' || this._framework === 'cucumber')) {
|
|
35
|
+
stdLog.test_run_uuid = this._currentTest.uuid;
|
|
36
|
+
}
|
|
37
|
+
if (stdLog.hook_run_uuid || stdLog.test_run_uuid) {
|
|
38
|
+
await (0, util_1.pushDataToQueue)({
|
|
39
|
+
event_type: 'LogCreated',
|
|
40
|
+
logs: [stdLog]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
log.debug(`Exception in uploading log data to Observability with error : ${error}`);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
20
48
|
this._requestQueueHandler.start();
|
|
21
49
|
this._platformMeta = {
|
|
22
50
|
browserName: browserCaps === null || browserCaps === void 0 ? void 0 : browserCaps.browserName,
|
|
@@ -26,6 +54,14 @@ class _InsightsHandler {
|
|
|
26
54
|
sessionId: sessionId,
|
|
27
55
|
product: isAppAutomate ? 'app-automate' : 'automate'
|
|
28
56
|
};
|
|
57
|
+
this.registerListeners();
|
|
58
|
+
}
|
|
59
|
+
registerListeners() {
|
|
60
|
+
if (!(this._framework === 'mocha' || this._framework === 'cucumber')) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
process.removeAllListeners(`bs:addLog:${process.pid}`);
|
|
64
|
+
process.on(`bs:addLog:${process.pid}`, this.appendTestItemLog.bind(this));
|
|
29
65
|
}
|
|
30
66
|
async before() {
|
|
31
67
|
if ((0, util_1.isBrowserstackSession)(this._browser)) {
|
|
@@ -40,19 +76,31 @@ class _InsightsHandler {
|
|
|
40
76
|
if (!(0, util_1.frameworkSupportsHook)('before', this._framework)) {
|
|
41
77
|
return;
|
|
42
78
|
}
|
|
79
|
+
const hookUUID = (0, uuid_1.v4)();
|
|
80
|
+
if (this._framework === 'cucumber') {
|
|
81
|
+
test = test;
|
|
82
|
+
await this.processCucumberHook(test, { event: 'before', hookUUID });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
test = test;
|
|
43
86
|
const fullTitle = (0, util_1.getUniqueIdentifier)(test, this._framework);
|
|
44
|
-
const hookId = (0, uuid_1.v4)();
|
|
45
87
|
this._tests[fullTitle] = {
|
|
46
|
-
uuid:
|
|
88
|
+
uuid: hookUUID,
|
|
47
89
|
startedAt: (new Date()).toISOString()
|
|
48
90
|
};
|
|
49
|
-
this.
|
|
91
|
+
this.setCurrentHook({ uuid: hookUUID });
|
|
92
|
+
this.attachHookData(context, hookUUID);
|
|
50
93
|
await this.sendTestRunEvent(test, 'HookRunStarted');
|
|
51
94
|
}
|
|
52
95
|
async afterHook(test, result) {
|
|
53
96
|
if (!(0, util_1.frameworkSupportsHook)('after', this._framework)) {
|
|
54
97
|
return;
|
|
55
98
|
}
|
|
99
|
+
if (this._framework === 'cucumber') {
|
|
100
|
+
await this.processCucumberHook(test, { event: 'after' }, result);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
test = test;
|
|
56
104
|
const fullTitle = (0, util_1.getUniqueIdentifier)(test, this._framework);
|
|
57
105
|
if (this._tests[fullTitle]) {
|
|
58
106
|
this._tests[fullTitle].finishedAt = (new Date()).toISOString();
|
|
@@ -62,6 +110,7 @@ class _InsightsHandler {
|
|
|
62
110
|
finishedAt: (new Date()).toISOString()
|
|
63
111
|
};
|
|
64
112
|
}
|
|
113
|
+
this.setCurrentHook({ uuid: this._tests[fullTitle].uuid, finished: true });
|
|
65
114
|
await this.sendTestRunEvent(test, 'HookRunFinished', result);
|
|
66
115
|
const hookType = (0, util_1.getHookType)(test.title);
|
|
67
116
|
/*
|
|
@@ -97,11 +146,15 @@ class _InsightsHandler {
|
|
|
97
146
|
}
|
|
98
147
|
}
|
|
99
148
|
async beforeTest(test) {
|
|
149
|
+
const uuid = (0, uuid_1.v4)();
|
|
150
|
+
this._currentTest = {
|
|
151
|
+
test, uuid
|
|
152
|
+
};
|
|
100
153
|
if (this._framework !== 'mocha')
|
|
101
154
|
return;
|
|
102
155
|
const fullTitle = (0, util_1.getUniqueIdentifier)(test, this._framework);
|
|
103
156
|
this._tests[fullTitle] = {
|
|
104
|
-
uuid:
|
|
157
|
+
uuid: uuid,
|
|
105
158
|
startedAt: (new Date()).toISOString()
|
|
106
159
|
};
|
|
107
160
|
await this.sendTestRunEvent(test, 'TestRunStarted');
|
|
@@ -119,13 +172,25 @@ class _InsightsHandler {
|
|
|
119
172
|
/**
|
|
120
173
|
* Cucumber Only
|
|
121
174
|
*/
|
|
175
|
+
async beforeFeature(uri, feature) {
|
|
176
|
+
this._cucumberData.scenariosStarted = false;
|
|
177
|
+
this._cucumberData.feature = feature;
|
|
178
|
+
this._cucumberData.uri = uri;
|
|
179
|
+
}
|
|
122
180
|
async beforeScenario(world) {
|
|
181
|
+
const uuid = (0, uuid_1.v4)();
|
|
182
|
+
this._currentTest = {
|
|
183
|
+
uuid
|
|
184
|
+
};
|
|
185
|
+
this._cucumberData.scenario = world.pickle;
|
|
186
|
+
this._cucumberData.scenariosStarted = true;
|
|
187
|
+
this._cucumberData.stepsStarted = false;
|
|
123
188
|
const pickleData = world.pickle;
|
|
124
189
|
const gherkinDocument = world.gherkinDocument;
|
|
125
190
|
const featureData = gherkinDocument.feature;
|
|
126
191
|
const uniqueId = (0, util_1.getUniqueIdentifierForCucumber)(world);
|
|
127
192
|
let testMetaData = {
|
|
128
|
-
uuid:
|
|
193
|
+
uuid: uuid,
|
|
129
194
|
startedAt: (new Date()).toISOString()
|
|
130
195
|
};
|
|
131
196
|
if (pickleData) {
|
|
@@ -144,10 +209,13 @@ class _InsightsHandler {
|
|
|
144
209
|
await this.sendTestRunEventForCucumber(world, 'TestRunStarted');
|
|
145
210
|
}
|
|
146
211
|
async afterScenario(world) {
|
|
212
|
+
this._cucumberData.scenario = undefined;
|
|
147
213
|
await this.sendTestRunEventForCucumber(world, 'TestRunFinished');
|
|
148
214
|
}
|
|
149
215
|
async beforeStep(step, scenario) {
|
|
150
216
|
var _a;
|
|
217
|
+
this._cucumberData.stepsStarted = true;
|
|
218
|
+
this._cucumberData.steps.push(step);
|
|
151
219
|
const uniqueId = (0, util_1.getUniqueIdentifierForCucumber)({ pickle: scenario });
|
|
152
220
|
let testMetaData = this._tests[uniqueId];
|
|
153
221
|
if (!testMetaData) {
|
|
@@ -168,6 +236,7 @@ class _InsightsHandler {
|
|
|
168
236
|
}
|
|
169
237
|
async afterStep(step, scenario, result) {
|
|
170
238
|
var _a;
|
|
239
|
+
this._cucumberData.steps.pop();
|
|
171
240
|
const uniqueId = (0, util_1.getUniqueIdentifierForCucumber)({ pickle: scenario });
|
|
172
241
|
let testMetaData = this._tests[uniqueId];
|
|
173
242
|
if (!testMetaData) {
|
|
@@ -195,6 +264,75 @@ class _InsightsHandler {
|
|
|
195
264
|
}
|
|
196
265
|
this._tests[uniqueId] = testMetaData;
|
|
197
266
|
}
|
|
267
|
+
async sendScenarioObjectSkipped(scenario, feature, uri) {
|
|
268
|
+
const testMetaData = {
|
|
269
|
+
uuid: (0, uuid_1.v4)(),
|
|
270
|
+
startedAt: (new Date()).toISOString(),
|
|
271
|
+
finishedAt: (new Date()).toISOString(),
|
|
272
|
+
scenario: {
|
|
273
|
+
name: scenario.name
|
|
274
|
+
},
|
|
275
|
+
feature: {
|
|
276
|
+
path: uri,
|
|
277
|
+
name: feature.name,
|
|
278
|
+
description: feature.description
|
|
279
|
+
},
|
|
280
|
+
steps: scenario.steps.map((step) => {
|
|
281
|
+
return {
|
|
282
|
+
id: step.id,
|
|
283
|
+
text: step.text,
|
|
284
|
+
keyword: step.keyword,
|
|
285
|
+
result: 'skipped',
|
|
286
|
+
};
|
|
287
|
+
}),
|
|
288
|
+
};
|
|
289
|
+
await this.sendTestRunEventForCucumber(null, 'TestRunSkipped', testMetaData);
|
|
290
|
+
}
|
|
291
|
+
async processCucumberHook(test, params, result) {
|
|
292
|
+
const hookType = this.getCucumberHookType(test);
|
|
293
|
+
if (!hookType) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const { event, hookUUID } = params;
|
|
297
|
+
const hookId = this.getCucumberHookUniqueId(hookType, test);
|
|
298
|
+
if (!hookId) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (event === 'before') {
|
|
302
|
+
this.setCurrentHook({ uuid: hookUUID });
|
|
303
|
+
const hookMetaData = {
|
|
304
|
+
uuid: hookUUID,
|
|
305
|
+
startedAt: (new Date()).toISOString(),
|
|
306
|
+
testRunId: this._currentTest.uuid,
|
|
307
|
+
hookType: hookType
|
|
308
|
+
};
|
|
309
|
+
this._tests[hookId] = hookMetaData;
|
|
310
|
+
await this.sendHookRunEvent(hookMetaData, 'HookRunStarted');
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
this._tests[hookId].finishedAt = (new Date()).toISOString();
|
|
314
|
+
this.setCurrentHook({ uuid: this._tests[hookId].uuid, finished: true });
|
|
315
|
+
await this.sendHookRunEvent(this._tests[hookId], 'HookRunFinished', result);
|
|
316
|
+
if (hookType === 'BEFORE_ALL' && result && !result.passed) {
|
|
317
|
+
const { feature, uri } = this._cucumberData;
|
|
318
|
+
if (!feature) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
feature.children.map(async (childObj) => {
|
|
322
|
+
if (childObj.rule) {
|
|
323
|
+
childObj.rule.children.map(async (scenarioObj) => {
|
|
324
|
+
if (scenarioObj.scenario) {
|
|
325
|
+
await this.sendScenarioObjectSkipped(scenarioObj.scenario, feature, uri);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
else if (childObj.scenario) {
|
|
330
|
+
await this.sendScenarioObjectSkipped(childObj.scenario, feature, uri);
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
198
336
|
//@ts-ignore
|
|
199
337
|
async uploadPending(waitTimeout = constants_1.DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS, waitInterval = constants_1.DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS) {
|
|
200
338
|
if (this._requestQueueHandler.pendingUploads <= 0 || waitTimeout <= 0) {
|
|
@@ -204,6 +342,7 @@ class _InsightsHandler {
|
|
|
204
342
|
return this.uploadPending(waitTimeout - waitInterval);
|
|
205
343
|
}
|
|
206
344
|
async teardown() {
|
|
345
|
+
this._requestQueueHandler.tearDownInvoked = true;
|
|
207
346
|
await this._requestQueueHandler.shutdown();
|
|
208
347
|
}
|
|
209
348
|
/**
|
|
@@ -261,6 +400,12 @@ class _InsightsHandler {
|
|
|
261
400
|
/*
|
|
262
401
|
* private methods
|
|
263
402
|
*/
|
|
403
|
+
async sendData(data) {
|
|
404
|
+
const req = this._requestQueueHandler.add(data);
|
|
405
|
+
if (req.proceed && req.data) {
|
|
406
|
+
await (0, util_1.uploadEventData)(req.data, req.url);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
264
409
|
attachHookData(context, hookId) {
|
|
265
410
|
if (context.currentTest && context.currentTest.parent) {
|
|
266
411
|
const parentTest = `${context.currentTest.parent.title} - ${context.currentTest.title}`;
|
|
@@ -294,6 +439,63 @@ class _InsightsHandler {
|
|
|
294
439
|
}
|
|
295
440
|
return false;
|
|
296
441
|
}
|
|
442
|
+
getCucumberHookType(test) {
|
|
443
|
+
var _a;
|
|
444
|
+
let hookType = null;
|
|
445
|
+
if (!test) {
|
|
446
|
+
hookType = this._cucumberData.scenariosStarted ? 'AFTER_ALL' : 'BEFORE_ALL';
|
|
447
|
+
}
|
|
448
|
+
else if (!this._cucumberData.stepsStarted) {
|
|
449
|
+
hookType = 'BEFORE_EACH';
|
|
450
|
+
}
|
|
451
|
+
else if (((_a = this._cucumberData.steps) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
452
|
+
// beforeStep or afterStep
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
hookType = 'AFTER_EACH';
|
|
456
|
+
}
|
|
457
|
+
return hookType;
|
|
458
|
+
}
|
|
459
|
+
getCucumberHookName(hookType) {
|
|
460
|
+
var _a, _b;
|
|
461
|
+
switch (hookType) {
|
|
462
|
+
case 'BEFORE_EACH':
|
|
463
|
+
case 'AFTER_EACH':
|
|
464
|
+
return `${hookType} for ${(_a = this._cucumberData.scenario) === null || _a === void 0 ? void 0 : _a.name}`;
|
|
465
|
+
case 'BEFORE_ALL':
|
|
466
|
+
case 'AFTER_ALL':
|
|
467
|
+
return `${hookType} for ${(_b = this._cucumberData.feature) === null || _b === void 0 ? void 0 : _b.name}`;
|
|
468
|
+
}
|
|
469
|
+
return '';
|
|
470
|
+
}
|
|
471
|
+
getCucumberHookUniqueId(hookType, hook) {
|
|
472
|
+
switch (hookType) {
|
|
473
|
+
case 'BEFORE_EACH':
|
|
474
|
+
case 'AFTER_EACH':
|
|
475
|
+
return hook.hookId;
|
|
476
|
+
case 'BEFORE_ALL':
|
|
477
|
+
case 'AFTER_ALL':
|
|
478
|
+
// Can only work for single beforeAll or afterAll
|
|
479
|
+
return `${hookType} for ${this.getCucumberFeatureUniqueId()}`;
|
|
480
|
+
}
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
483
|
+
getCucumberFeatureUniqueId() {
|
|
484
|
+
const { uri, feature } = this._cucumberData;
|
|
485
|
+
return `${uri}:${feature === null || feature === void 0 ? void 0 : feature.name}`;
|
|
486
|
+
}
|
|
487
|
+
setCurrentHook(hookDetails) {
|
|
488
|
+
if (hookDetails.finished) {
|
|
489
|
+
if (this._currentHook.uuid === hookDetails.uuid) {
|
|
490
|
+
this._currentHook.finished = true;
|
|
491
|
+
}
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
this._currentHook = {
|
|
495
|
+
uuid: hookDetails.uuid,
|
|
496
|
+
finished: false
|
|
497
|
+
};
|
|
498
|
+
}
|
|
297
499
|
/*
|
|
298
500
|
* Get hierarchy info
|
|
299
501
|
*/
|
|
@@ -410,13 +612,19 @@ class _InsightsHandler {
|
|
|
410
612
|
await (0, util_1.uploadEventData)(req.data, req.url);
|
|
411
613
|
}
|
|
412
614
|
}
|
|
413
|
-
async sendTestRunEventForCucumber(
|
|
414
|
-
const
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
const examples = (0, util_1.getScenarioExamples)(world);
|
|
418
|
-
|
|
419
|
-
|
|
615
|
+
async sendTestRunEventForCucumber(worldObj, eventType, testMetaData = null) {
|
|
616
|
+
const world = worldObj;
|
|
617
|
+
const dataHub = testMetaData ? testMetaData : (this._tests[(0, util_1.getUniqueIdentifierForCucumber)(world)] || {});
|
|
618
|
+
const { feature, scenario, steps, uuid, startedAt, finishedAt } = dataHub;
|
|
619
|
+
const examples = !testMetaData ? (0, util_1.getScenarioExamples)(world) : undefined;
|
|
620
|
+
let fullNameWithExamples;
|
|
621
|
+
if (!testMetaData) {
|
|
622
|
+
fullNameWithExamples = examples
|
|
623
|
+
? world.pickle.name + ' (' + examples.join(', ') + ')'
|
|
624
|
+
: world.pickle.name;
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
fullNameWithExamples = (scenario === null || scenario === void 0 ? void 0 : scenario.name) || '';
|
|
420
628
|
}
|
|
421
629
|
let testData = {
|
|
422
630
|
uuid: uuid,
|
|
@@ -443,7 +651,7 @@ class _InsightsHandler {
|
|
|
443
651
|
examples: examples
|
|
444
652
|
}
|
|
445
653
|
};
|
|
446
|
-
if (eventType == 'TestRunStarted') {
|
|
654
|
+
if (eventType == 'TestRunStarted' || eventType === 'TestRunSkipped') {
|
|
447
655
|
testData.integrations = {};
|
|
448
656
|
if (this._browser && this._platformMeta) {
|
|
449
657
|
const provider = (0, util_1.getCloudProvider)(this._browser);
|
|
@@ -451,7 +659,7 @@ class _InsightsHandler {
|
|
|
451
659
|
}
|
|
452
660
|
}
|
|
453
661
|
/* istanbul ignore if */
|
|
454
|
-
if (world.result) {
|
|
662
|
+
if (world === null || world === void 0 ? void 0 : world.result) {
|
|
455
663
|
let result = world.result.status.toLowerCase();
|
|
456
664
|
if (result !== 'passed' && result !== 'failed') {
|
|
457
665
|
result = 'skipped'; // mark UNKNOWN/UNDEFINED/AMBIGUOUS/PENDING as skipped
|
|
@@ -464,8 +672,8 @@ class _InsightsHandler {
|
|
|
464
672
|
{
|
|
465
673
|
'backtrace': [world.result.message ? (0, util_1.removeAnsiColors)(world.result.message) : 'unknown']
|
|
466
674
|
}
|
|
467
|
-
]
|
|
468
|
-
|
|
675
|
+
];
|
|
676
|
+
testData.failure_reason = world.result.message ? (0, util_1.removeAnsiColors)(world.result.message) : world.result.message;
|
|
469
677
|
if (world.result.message) {
|
|
470
678
|
testData.failure_type = world.result.message.match(/AssertionError/)
|
|
471
679
|
? 'AssertionError'
|
|
@@ -473,9 +681,13 @@ class _InsightsHandler {
|
|
|
473
681
|
}
|
|
474
682
|
}
|
|
475
683
|
}
|
|
476
|
-
if (world.pickle) {
|
|
684
|
+
if (world === null || world === void 0 ? void 0 : world.pickle) {
|
|
477
685
|
testData.tags = world.pickle.tags.map(({ name }) => (name));
|
|
478
686
|
}
|
|
687
|
+
if (eventType === 'TestRunSkipped') {
|
|
688
|
+
testData.result = 'skipped';
|
|
689
|
+
eventType = 'TestRunFinished';
|
|
690
|
+
}
|
|
479
691
|
const uploadData = {
|
|
480
692
|
event_type: eventType,
|
|
481
693
|
test_run: testData
|
|
@@ -485,6 +697,52 @@ class _InsightsHandler {
|
|
|
485
697
|
await (0, util_1.uploadEventData)(req.data, req.url);
|
|
486
698
|
}
|
|
487
699
|
}
|
|
700
|
+
async sendHookRunEvent(hookData, eventType, result) {
|
|
701
|
+
const { uri, feature } = this._cucumberData;
|
|
702
|
+
const testData = {
|
|
703
|
+
uuid: hookData.uuid,
|
|
704
|
+
type: 'hook',
|
|
705
|
+
name: this.getCucumberHookName(hookData.hookType),
|
|
706
|
+
body: {
|
|
707
|
+
lang: 'webdriverio',
|
|
708
|
+
code: null
|
|
709
|
+
},
|
|
710
|
+
started_at: hookData.startedAt,
|
|
711
|
+
finished_at: hookData.finishedAt,
|
|
712
|
+
hook_type: hookData.hookType,
|
|
713
|
+
test_run_id: hookData.testRunId,
|
|
714
|
+
scope: feature === null || feature === void 0 ? void 0 : feature.name,
|
|
715
|
+
scopes: [(feature === null || feature === void 0 ? void 0 : feature.name) || ''],
|
|
716
|
+
file_name: uri ? path_1.default.relative(process.cwd(), uri) : undefined,
|
|
717
|
+
location: uri ? path_1.default.relative(process.cwd(), uri) : undefined,
|
|
718
|
+
vc_filepath: (this._gitConfigPath && uri) ? path_1.default.relative(this._gitConfigPath, uri) : undefined,
|
|
719
|
+
result: 'pending',
|
|
720
|
+
framework: this._framework
|
|
721
|
+
};
|
|
722
|
+
if (eventType === 'HookRunFinished' && result) {
|
|
723
|
+
testData.result = result.passed ? 'passed' : 'failed';
|
|
724
|
+
testData.retries = result.retries;
|
|
725
|
+
testData.duration_in_ms = result.duration;
|
|
726
|
+
if (!result.passed) {
|
|
727
|
+
Object.assign(testData, (0, util_1.getFailureObject)(result.error));
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (eventType === 'HookRunStarted') {
|
|
731
|
+
testData.integrations = {};
|
|
732
|
+
if (this._browser && this._platformMeta) {
|
|
733
|
+
const provider = (0, util_1.getCloudProvider)(this._browser);
|
|
734
|
+
testData.integrations[provider] = this.getIntegrationsObject();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
const uploadData = {
|
|
738
|
+
event_type: eventType,
|
|
739
|
+
hook_run: testData
|
|
740
|
+
};
|
|
741
|
+
const req = this._requestQueueHandler.add(uploadData);
|
|
742
|
+
if (req.proceed && req.data) {
|
|
743
|
+
await (0, util_1.uploadEventData)(req.data, req.url);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
488
746
|
getIntegrationsObject() {
|
|
489
747
|
var _a, _b, _c, _d, _e, _f;
|
|
490
748
|
return {
|
package/build/launcher.d.ts
CHANGED
|
@@ -13,7 +13,10 @@ export default class BrowserstackLauncherService implements Services.ServiceInst
|
|
|
13
13
|
private _projectName?;
|
|
14
14
|
private _buildTag?;
|
|
15
15
|
private _buildIdentifier?;
|
|
16
|
+
private _accessibilityAutomation?;
|
|
17
|
+
_testOpsBuildStopped?: boolean;
|
|
16
18
|
constructor(_options: BrowserstackConfig & Options.Testrunner, capabilities: Capabilities.RemoteCapability, _config: Options.Testrunner);
|
|
19
|
+
setupExitHandlers(): void;
|
|
17
20
|
onPrepare(config?: Options.Testrunner, capabilities?: Capabilities.RemoteCapabilities): Promise<unknown>;
|
|
18
21
|
onComplete(): Promise<unknown>;
|
|
19
22
|
_uploadApp(app: App): Promise<AppUploadResponse>;
|
|
@@ -22,6 +25,9 @@ export default class BrowserstackLauncherService implements Services.ServiceInst
|
|
|
22
25
|
* <object>: only "path" and "custom_id" should coexist as multiple properties.
|
|
23
26
|
*/
|
|
24
27
|
_validateApp(appConfig: AppConfig | string): Promise<App>;
|
|
28
|
+
_updateObjectTypeCaps(capabilities?: Capabilities.RemoteCapabilities, capType?: string, value?: {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}): void;
|
|
25
31
|
_updateCaps(capabilities?: Capabilities.RemoteCapabilities, capType?: string, value?: string): void;
|
|
26
32
|
_handleBuildIdentifier(capabilities?: Capabilities.RemoteCapabilities): void;
|
|
27
33
|
/**
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAMlE,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAkBpF,KAAK,iBAAiB,GAAG,yBAAyB,CAAC,KAAK,GAAG;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;CAC7C,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,YAAW,QAAQ,CAAC,eAAe;IAU5E,OAAO,CAAC,QAAQ;IAEhB,OAAO,CAAC,OAAO;IAXnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,YAAY,CAAC,CAAQ;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAQ;IAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAQ;IACjC,OAAO,CAAC,wBAAwB,CAAC,CAAS;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAA;gBAGzB,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EACzD,YAAY,EAAE,YAAY,CAAC,gBAAgB,EACnC,OAAO,EAAE,OAAO,CAAC,UAAU;IA+FvC,iBAAiB;IAUX,SAAS,CAAE,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,YAAY,CAAC,kBAAkB;IA4ItF,UAAU;IA6DV,UAAU,CAAC,GAAG,EAAC,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAkBrD;;;OAGG;IACG,YAAY,CAAE,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAyBhE,qBAAqB,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KAAE;IAiFvH,WAAW,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAC,MAAM;IAoF3F,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;CAQtF"}
|