@testomatio/reporter 2.6.0-beta.1.allure → 2.6.1
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/README.md +9 -11
- package/lib/adapter/playwright.d.ts +2 -0
- package/lib/adapter/playwright.js +29 -5
- package/lib/adapter/utils/playwright.d.ts +25 -0
- package/lib/adapter/utils/playwright.js +123 -0
- package/lib/adapter/vitest.js +2 -1
- package/lib/bin/cli.js +36 -36
- package/lib/data-storage.d.ts +1 -1
- package/lib/data-storage.js +1 -0
- package/lib/junit-adapter/index.js +0 -4
- package/lib/pipe/coverage.js +63 -5
- package/lib/pipe/debug.js +1 -2
- package/lib/pipe/github.js +15 -0
- package/lib/pipe/html.d.ts +2 -3
- package/lib/pipe/html.js +745 -37
- package/lib/pipe/testomatio.js +83 -36
- package/lib/reporter-functions.d.ts +36 -11
- package/lib/reporter-functions.js +72 -22
- package/lib/reporter.d.ts +90 -38
- package/lib/services/artifacts.d.ts +1 -1
- package/lib/services/key-values.d.ts +1 -1
- package/lib/services/links.d.ts +5 -3
- package/lib/services/links.js +1 -1
- package/lib/services/logger.d.ts +1 -1
- package/lib/template/testomatio-old.hbs +1421 -0
- package/lib/template/testomatio.hbs +3200 -1157
- package/lib/utils/log-formatter.d.ts +1 -2
- package/lib/utils/log-formatter.js +8 -4
- package/lib/utils/utils.js +0 -9
- package/package.json +2 -2
- package/src/adapter/playwright.js +32 -6
- package/src/adapter/utils/playwright.js +121 -0
- package/src/adapter/vitest.js +2 -1
- package/src/bin/cli.js +39 -47
- package/src/data-storage.js +1 -0
- package/src/junit-adapter/index.js +0 -4
- package/src/pipe/coverage.js +90 -32
- package/src/pipe/debug.js +1 -2
- package/src/pipe/github.js +14 -0
- package/src/pipe/html.js +844 -38
- package/src/pipe/testomatio.js +98 -53
- package/src/reporter-functions.js +73 -25
- package/src/services/links.js +1 -1
- package/src/template/testomatio-old.hbs +1421 -0
- package/src/template/testomatio.hbs +3200 -1157
- package/src/utils/log-formatter.js +9 -4
- package/src/utils/utils.js +0 -5
- package/types/types.d.ts +30 -6
- package/lib/allureReader.d.ts +0 -65
- package/lib/allureReader.js +0 -448
- package/lib/junit-adapter/kotlin.d.ts +0 -5
- package/lib/junit-adapter/kotlin.js +0 -46
- package/lib/services/labels.d.ts +0 -0
- package/lib/services/labels.js +0 -0
- package/src/allureReader.js +0 -523
- package/src/junit-adapter/kotlin.js +0 -48
- package/src/services/labels.js +0 -1
package/lib/pipe/testomatio.js
CHANGED
|
@@ -23,7 +23,7 @@ if (process.env.TESTOMATIO_RUN)
|
|
|
23
23
|
class TestomatioPipe {
|
|
24
24
|
constructor(params, store) {
|
|
25
25
|
this.batch = {
|
|
26
|
-
isEnabled: params?.isBatchEnabled ?? !
|
|
26
|
+
isEnabled: params?.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD ?? true,
|
|
27
27
|
intervalFunction: null, // will be created in createRun by setInterval function
|
|
28
28
|
intervalTime: 5000, // how often tests are sent
|
|
29
29
|
tests: [], // array of tests in batch
|
|
@@ -178,6 +178,9 @@ class TestomatioPipe {
|
|
|
178
178
|
return;
|
|
179
179
|
if (this.batch.isEnabled && this.isEnabled)
|
|
180
180
|
this.batch.intervalFunction = setInterval(this.#batchUpload, this.batch.intervalTime);
|
|
181
|
+
if (this.store) {
|
|
182
|
+
this.store.runKind = params.kind;
|
|
183
|
+
}
|
|
181
184
|
let buildUrl = process.env.BUILD_URL || process.env.CI_JOB_URL || process.env.CIRCLE_BUILD_URL;
|
|
182
185
|
// GitHub Actions Url
|
|
183
186
|
if (!buildUrl && process.env.GITHUB_RUN_ID) {
|
|
@@ -194,6 +197,16 @@ class TestomatioPipe {
|
|
|
194
197
|
if (buildUrl && !buildUrl.startsWith('http'))
|
|
195
198
|
buildUrl = undefined;
|
|
196
199
|
const accessEvent = process.env.TESTOMATIO_PUBLISH ? 'publish' : null;
|
|
200
|
+
const coverageConfiguration = this.store?.coverageConfiguration;
|
|
201
|
+
let description = null;
|
|
202
|
+
let configuration = null;
|
|
203
|
+
if (coverageConfiguration && (coverageConfiguration.tests?.length || coverageConfiguration.suites?.length)) {
|
|
204
|
+
description = this.store?.coverageDescription || null;
|
|
205
|
+
configuration = {
|
|
206
|
+
tests: coverageConfiguration.tests?.map(id => id.replace(/^T/, '')) || [],
|
|
207
|
+
suites: coverageConfiguration.suites?.map(id => id.replace(/^S/, '')) || [],
|
|
208
|
+
};
|
|
209
|
+
}
|
|
197
210
|
const runParams = Object.fromEntries(Object.entries({
|
|
198
211
|
ci_build_url: buildUrl,
|
|
199
212
|
api_key: this.apiKey.trim(),
|
|
@@ -206,6 +219,8 @@ class TestomatioPipe {
|
|
|
206
219
|
shared_run: this.sharedRun,
|
|
207
220
|
shared_run_timeout: this.sharedRunTimeout,
|
|
208
221
|
kind: params.kind,
|
|
222
|
+
configuration,
|
|
223
|
+
description,
|
|
209
224
|
}).filter(([, value]) => !!value));
|
|
210
225
|
debug(' >>>>>> Run params', JSON.stringify(runParams, null, 2));
|
|
211
226
|
if (this.runId) {
|
|
@@ -219,6 +234,15 @@ class TestomatioPipe {
|
|
|
219
234
|
});
|
|
220
235
|
if (resp.data.artifacts)
|
|
221
236
|
(0, pipe_utils_js_1.setS3Credentials)(resp.data.artifacts);
|
|
237
|
+
if (resp.data.url) {
|
|
238
|
+
const respUrl = new URL(resp.data.url);
|
|
239
|
+
this.runUrl = `${this.url}${respUrl.pathname}`;
|
|
240
|
+
this.runPublicUrl = resp.data.public_url;
|
|
241
|
+
this.store.runUrl = this.runUrl;
|
|
242
|
+
this.store.runPublicUrl = this.runPublicUrl;
|
|
243
|
+
console.log(constants_js_1.APP_PREFIX, '📊 Using existing run. Report ID:', this.runId);
|
|
244
|
+
console.log(constants_js_1.APP_PREFIX, '📊 Report URL:', picocolors_1.default.magenta(this.runUrl));
|
|
245
|
+
}
|
|
222
246
|
return;
|
|
223
247
|
}
|
|
224
248
|
debug('Creating run...');
|
|
@@ -250,8 +274,10 @@ class TestomatioPipe {
|
|
|
250
274
|
console.error('Testomat.io API key is not set');
|
|
251
275
|
if (!this.apiKey?.startsWith('tstmt'))
|
|
252
276
|
console.error('Testomat.io API key is invalid');
|
|
277
|
+
if (process.env.DEBUG || process.env.TESTOMATIO_DEBUG)
|
|
278
|
+
this.#logFailedResponse(err);
|
|
253
279
|
console.error(constants_js_1.APP_PREFIX, 'Error creating Testomat.io report (see details above), please check if your API key is valid. Skipping report');
|
|
254
|
-
printCreateIssue(
|
|
280
|
+
printCreateIssue();
|
|
255
281
|
}
|
|
256
282
|
debug('"createRun" function finished');
|
|
257
283
|
}
|
|
@@ -295,16 +321,8 @@ class TestomatioPipe {
|
|
|
295
321
|
this.requestFailures++;
|
|
296
322
|
this.notReportedTestsCount++;
|
|
297
323
|
if (err.response) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
console.log(constants_js_1.APP_PREFIX, picocolors_1.default.yellow(`Warning: ${responseData.message} (${err.response.status})`), picocolors_1.default.gray(data?.title || ''));
|
|
301
|
-
if (err.response?.data?.message?.includes('could not be matched')) {
|
|
302
|
-
this.hasUnmatchedTests = true;
|
|
303
|
-
}
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
console.log(constants_js_1.APP_PREFIX, picocolors_1.default.yellow(`Warning: ${data?.title || ''} (${err.response?.status})`), `Report couldn't be processed: ${err?.response?.data?.message}`);
|
|
307
|
-
printCreateIssue(err);
|
|
324
|
+
this.#logFailedResponse(err);
|
|
325
|
+
printCreateIssue();
|
|
308
326
|
}
|
|
309
327
|
else {
|
|
310
328
|
console.log(constants_js_1.APP_PREFIX, picocolors_1.default.blue(data?.title || ''), "Report couldn't be processed", err);
|
|
@@ -354,16 +372,8 @@ class TestomatioPipe {
|
|
|
354
372
|
this.requestFailures++;
|
|
355
373
|
this.notReportedTestsCount += testsToSend.length;
|
|
356
374
|
if (err.response) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
console.log(constants_js_1.APP_PREFIX, picocolors_1.default.yellow(`Warning: ${responseData.message} (${err.response.status})`));
|
|
360
|
-
if (err.response?.data?.message?.includes('could not be matched')) {
|
|
361
|
-
this.hasUnmatchedTests = true;
|
|
362
|
-
}
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
console.log(constants_js_1.APP_PREFIX, picocolors_1.default.yellow(`Warning: (${err.response?.status})`), `Report couldn't be processed: ${err?.response?.data?.message}`);
|
|
366
|
-
printCreateIssue(err);
|
|
375
|
+
this.#logFailedResponse(err);
|
|
376
|
+
printCreateIssue();
|
|
367
377
|
}
|
|
368
378
|
else {
|
|
369
379
|
console.log(constants_js_1.APP_PREFIX, "Report couldn't be processed", err);
|
|
@@ -462,32 +472,69 @@ class TestomatioPipe {
|
|
|
462
472
|
}
|
|
463
473
|
catch (err) {
|
|
464
474
|
console.log(constants_js_1.APP_PREFIX, 'Error updating status, skipping...', err);
|
|
465
|
-
|
|
475
|
+
if (process.env.DEBUG || process.env.TESTOMATIO_DEBUG)
|
|
476
|
+
this.#logFailedResponse(err);
|
|
477
|
+
printCreateIssue();
|
|
466
478
|
}
|
|
467
479
|
debug('Run finished');
|
|
468
480
|
}
|
|
481
|
+
#logFailedResponse(error) {
|
|
482
|
+
let responseBody = stringify(error.response?.data ?? error.response ?? error, { pretty: true });
|
|
483
|
+
if (!responseBody)
|
|
484
|
+
responseBody = '<empty>';
|
|
485
|
+
responseBody = hideTestomatioToken(responseBody);
|
|
486
|
+
const statusCode = error.status || error.code || error.response?.status || '<unknown status code>';
|
|
487
|
+
const method = error.response?.config.method || '<unknown method>';
|
|
488
|
+
const url = error.response?.config.url || '<unknown url>';
|
|
489
|
+
let message = picocolors_1.default.yellow('\n⚠️ Request to Testomat.io failed:\n');
|
|
490
|
+
message += picocolors_1.default.bold(`${picocolors_1.default.red(statusCode)} ${method} ${url}\n`);
|
|
491
|
+
message += `\t${picocolors_1.default.bold('response: ')}${picocolors_1.default.gray(responseBody)}\n`;
|
|
492
|
+
const requestBody = hideTestomatioToken(stringify(error.response?.config?.data));
|
|
493
|
+
if (process.env.DEBUG || process.env.TESTOMATIO_DEBUG) {
|
|
494
|
+
message += `\t${picocolors_1.default.bold('request: ')}${picocolors_1.default.gray(requestBody)}\n`;
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
const requestBodyCut = requestBody.slice(0, 1000);
|
|
498
|
+
message += `\t${picocolors_1.default.bold('request: ')}${picocolors_1.default.gray(`${requestBodyCut}.....`)}\n`;
|
|
499
|
+
message += '\trequest body is cut, run with TESTOMATIO_DEBUG=1 to see full body\n';
|
|
500
|
+
}
|
|
501
|
+
console.log(message);
|
|
502
|
+
if (error.response?.data?.message?.includes('could not be matched')) {
|
|
503
|
+
this.hasUnmatchedTests = true;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
469
506
|
toString() {
|
|
470
507
|
return 'Testomatio Reporter';
|
|
471
508
|
}
|
|
472
509
|
}
|
|
473
510
|
let registeredErrorHints = false;
|
|
474
|
-
function printCreateIssue(
|
|
511
|
+
function printCreateIssue() {
|
|
475
512
|
if (registeredErrorHints)
|
|
476
513
|
return;
|
|
477
514
|
registeredErrorHints = true;
|
|
478
515
|
process.on('exit', () => {
|
|
479
|
-
console.log();
|
|
480
|
-
console.log(constants_js_1.APP_PREFIX, 'There was an error reporting to Testomat.io:');
|
|
481
|
-
console.log(constants_js_1.APP_PREFIX, 'If you think this is a bug please create an issue: https://github.com/testomatio/reporter/issues/new');
|
|
482
|
-
console.log(constants_js_1.APP_PREFIX, 'Provide this information:');
|
|
483
|
-
console.log('Error:', err.message || err.code);
|
|
484
|
-
if (!err.config)
|
|
485
|
-
return;
|
|
486
|
-
const time = new Date().toUTCString();
|
|
487
|
-
const { body, url, baseURL, method } = err?.config || {};
|
|
488
|
-
console.log('```js');
|
|
489
|
-
console.log({ body: body?.replace(/"(tstmt_[^"]+)"/g, 'tstmt_*'), url, baseURL, method, time });
|
|
490
|
-
console.log('```');
|
|
516
|
+
console.log(constants_js_1.APP_PREFIX, 'There was an error reporting to Testomat.io.\n', picocolors_1.default.yellow('If you think this is a bug please create an issue: https://github.com/testomatio/reporter/issues/new.'), picocolors_1.default.yellow('Provide the logs from above'));
|
|
491
517
|
});
|
|
492
518
|
}
|
|
519
|
+
/**
|
|
520
|
+
* Removes Testomatio token from string data
|
|
521
|
+
*
|
|
522
|
+
* @param {string} data
|
|
523
|
+
* @returns {string}
|
|
524
|
+
*/
|
|
525
|
+
function hideTestomatioToken(data) {
|
|
526
|
+
return (typeof data === 'string' ? data : '')
|
|
527
|
+
.replace(/"api_key"\s*:\s*"[^"]+"/g, '"api_key": "<hidden>"')
|
|
528
|
+
.replace(/"(tstmt_[^"]+)"/g, '"tstmt_***"');
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Stringifies provided data
|
|
532
|
+
*
|
|
533
|
+
* @param {any} anything
|
|
534
|
+
* @param {{ pretty: boolean }} opts
|
|
535
|
+
* @returns {string}
|
|
536
|
+
*/
|
|
537
|
+
function stringify(anything, opts = { pretty: false }) {
|
|
538
|
+
return typeof anything === 'string' ? anything : JSON.stringify(anything, null, opts.pretty ? 2 : undefined);
|
|
539
|
+
}
|
|
493
540
|
module.exports = TestomatioPipe;
|
|
@@ -39,29 +39,54 @@ declare function addStep(message: string, logs?: {
|
|
|
39
39
|
}): void;
|
|
40
40
|
/**
|
|
41
41
|
* Add key-value pair(s) to the test report
|
|
42
|
-
* @param {{[key: string]: string} | string} keyValue - object { key: value } (multiple props allowed)
|
|
43
|
-
* @param {string|
|
|
42
|
+
* @param {{[key: string]: string} | string} keyValue - object { key: value } (multiple props allowed) OR key (string)
|
|
43
|
+
* @param {string|undefined} [value=undefined] - optional value when keyValue is a string
|
|
44
44
|
* @returns {void}
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* meta('key', 'value');
|
|
48
|
+
* meta({ key: 'value' });
|
|
49
|
+
* meta({ key1: 'value1', key2: 'value2' });
|
|
45
50
|
*/
|
|
46
51
|
declare function setKeyValue(keyValue: {
|
|
47
52
|
[key: string]: string;
|
|
48
|
-
} | string, value?: string |
|
|
53
|
+
} | string, value?: string | undefined): void;
|
|
49
54
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @param {string
|
|
52
|
-
*
|
|
55
|
+
* Adds label(s) to the test
|
|
56
|
+
* @param {string | {
|
|
57
|
+
* [key: string]: string}
|
|
58
|
+
* } key - just label OR custom field name OR object with custom field name and value
|
|
59
|
+
* @param {string | null} [value=null] - optional label value (of custom field value)
|
|
60
|
+
* (used when key is a string)
|
|
53
61
|
* @returns {void}
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* label('high');
|
|
65
|
+
* label('priority', 'high');
|
|
66
|
+
* label({priority: 'high'});
|
|
54
67
|
*/
|
|
55
|
-
declare function setLabel(key: string
|
|
68
|
+
declare function setLabel(key: string | {
|
|
69
|
+
[key: string]: string;
|
|
70
|
+
}, value?: string | null): void;
|
|
56
71
|
/**
|
|
57
72
|
* Add link(s) to the test report
|
|
58
|
-
* @param {...string} testIds - test IDs to link
|
|
73
|
+
* @param {...string | string[]} testIds - test IDs to link
|
|
59
74
|
* @returns {void}
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* linkTest('T11111111', 'T22222222')
|
|
78
|
+
* or
|
|
79
|
+
* linkTest(['T11111111', 'T22222222'])
|
|
60
80
|
*/
|
|
61
|
-
declare function linkTest(...testIds: string[]): void;
|
|
81
|
+
declare function linkTest(...testIds: (string | string[])[]): void;
|
|
62
82
|
/**
|
|
63
83
|
* Add JIRA issue link(s) to the test report
|
|
64
|
-
* @param {...string} jiraIds - JIRA issue IDs to link
|
|
84
|
+
* @param {...(string | string[])} jiraIds - JIRA issue IDs to link
|
|
65
85
|
* @returns {void}
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* linkJira('TICKET-1', 'TICKET-2')
|
|
89
|
+
* or
|
|
90
|
+
* linkJira(['TICKET-1', 'TICKET-2'])
|
|
66
91
|
*/
|
|
67
|
-
declare function linkJira(...jiraIds: string[]): void;
|
|
92
|
+
declare function linkJira(...jiraIds: (string | string[])[]): void;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const playwright_js_1 = require("./adapter/utils/playwright.js");
|
|
3
7
|
const helpers_js_1 = require("./helpers.js");
|
|
4
8
|
const index_js_1 = require("./services/index.js");
|
|
9
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
5
10
|
/**
|
|
6
11
|
* Stores path to file as artifact and uploads it to the S3 storage
|
|
7
12
|
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
@@ -9,7 +14,9 @@ const index_js_1 = require("./services/index.js");
|
|
|
9
14
|
* @returns {void}
|
|
10
15
|
*/
|
|
11
16
|
function saveArtifact(data, context = null) {
|
|
12
|
-
|
|
17
|
+
if (helpers_js_1.isPlaywright)
|
|
18
|
+
console.warn(`[TESTOMATIO] 'artifact' function is not supported for Playwright
|
|
19
|
+
Playwright supports artifacts out of the box.`);
|
|
13
20
|
if (!data)
|
|
14
21
|
return;
|
|
15
22
|
index_js_1.services.artifacts.put(data, context);
|
|
@@ -42,53 +49,96 @@ function addStep(message, logs) {
|
|
|
42
49
|
}
|
|
43
50
|
/**
|
|
44
51
|
* Add key-value pair(s) to the test report
|
|
45
|
-
* @param {{[key: string]: string} | string} keyValue - object { key: value } (multiple props allowed)
|
|
46
|
-
* @param {string|
|
|
52
|
+
* @param {{[key: string]: string} | string} keyValue - object { key: value } (multiple props allowed) OR key (string)
|
|
53
|
+
* @param {string|undefined} [value=undefined] - optional value when keyValue is a string
|
|
47
54
|
* @returns {void}
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* meta('key', 'value');
|
|
58
|
+
* meta({ key: 'value' });
|
|
59
|
+
* meta({ key1: 'value1', key2: 'value2' });
|
|
48
60
|
*/
|
|
49
|
-
function setKeyValue(keyValue, value =
|
|
50
|
-
|
|
61
|
+
function setKeyValue(keyValue, value = undefined) {
|
|
62
|
+
// in this case keyValue acts as key (value passed as second argument)
|
|
51
63
|
if (typeof keyValue === 'string') {
|
|
52
|
-
|
|
64
|
+
const key = keyValue;
|
|
65
|
+
keyValue = { [key]: value };
|
|
66
|
+
}
|
|
67
|
+
if (helpers_js_1.isPlaywright) {
|
|
68
|
+
console.log(`${playwright_js_1.playwrightLogsMarkers.meta} ${JSON.stringify(keyValue)}`);
|
|
69
|
+
return;
|
|
53
70
|
}
|
|
71
|
+
// in this case keyValue is expected to be an object
|
|
54
72
|
index_js_1.services.keyValues.put(keyValue);
|
|
55
73
|
}
|
|
56
74
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @param {string
|
|
59
|
-
*
|
|
75
|
+
* Adds label(s) to the test
|
|
76
|
+
* @param {string | {
|
|
77
|
+
* [key: string]: string}
|
|
78
|
+
* } key - just label OR custom field name OR object with custom field name and value
|
|
79
|
+
* @param {string | null} [value=null] - optional label value (of custom field value)
|
|
80
|
+
* (used when key is a string)
|
|
60
81
|
* @returns {void}
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* label('high');
|
|
85
|
+
* label('priority', 'high');
|
|
86
|
+
* label({priority: 'high'});
|
|
61
87
|
*/
|
|
62
88
|
function setLabel(key, value = null) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
89
|
+
let labelsArr = [];
|
|
90
|
+
// process label('priority', 'high') and label('high'
|
|
91
|
+
if (typeof key === 'string') {
|
|
92
|
+
labelsArr = [value ? `${key}:${value}` : key];
|
|
93
|
+
// process label({priority: 'high'}), label({priority: 'high', scope: 'smoke'})
|
|
94
|
+
}
|
|
95
|
+
else if (key !== null && typeof key === 'object') {
|
|
96
|
+
labelsArr = Object.entries(key).map(([key, value]) => `${key}:${value}`);
|
|
97
|
+
}
|
|
98
|
+
const labels = labelsArr.map(l => ({ label: l }));
|
|
99
|
+
if (helpers_js_1.isPlaywright) {
|
|
100
|
+
console.log(`${playwright_js_1.playwrightLogsMarkers.label} ${JSON.stringify(labels)}`);
|
|
101
|
+
return;
|
|
66
102
|
}
|
|
67
|
-
|
|
68
|
-
index_js_1.services.links.put([labelObject]);
|
|
103
|
+
index_js_1.services.links.put(labels);
|
|
69
104
|
}
|
|
70
105
|
/**
|
|
71
106
|
* Add link(s) to the test report
|
|
72
|
-
* @param {...string} testIds - test IDs to link
|
|
107
|
+
* @param {...string | string[]} testIds - test IDs to link
|
|
73
108
|
* @returns {void}
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* linkTest('T11111111', 'T22222222')
|
|
112
|
+
* or
|
|
113
|
+
* linkTest(['T11111111', 'T22222222'])
|
|
74
114
|
*/
|
|
75
115
|
function linkTest(...testIds) {
|
|
76
|
-
const
|
|
116
|
+
const testIdsArr = testIds.flat();
|
|
117
|
+
const links = testIdsArr.map(testId => ({ test: testId }));
|
|
118
|
+
if (helpers_js_1.isPlaywright) {
|
|
119
|
+
console.log(`${playwright_js_1.playwrightLogsMarkers.linkTest} ${JSON.stringify(links)}`);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
77
122
|
index_js_1.services.links.put(links);
|
|
78
123
|
}
|
|
79
124
|
/**
|
|
80
125
|
* Add JIRA issue link(s) to the test report
|
|
81
|
-
* @param {...string} jiraIds - JIRA issue IDs to link
|
|
126
|
+
* @param {...(string | string[])} jiraIds - JIRA issue IDs to link
|
|
82
127
|
* @returns {void}
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* linkJira('TICKET-1', 'TICKET-2')
|
|
131
|
+
* or
|
|
132
|
+
* linkJira(['TICKET-1', 'TICKET-2'])
|
|
83
133
|
*/
|
|
84
134
|
function linkJira(...jiraIds) {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
function showPlaywrightWarning(functionName, recommendation) {
|
|
135
|
+
const jiraIdsArr = jiraIds.flat();
|
|
136
|
+
const links = jiraIdsArr.map(jiraId => ({ jira: jiraId }));
|
|
89
137
|
if (helpers_js_1.isPlaywright) {
|
|
90
|
-
console.
|
|
138
|
+
console.log(`${playwright_js_1.playwrightLogsMarkers.linkJira} ${JSON.stringify(links)}`);
|
|
139
|
+
return;
|
|
91
140
|
}
|
|
141
|
+
index_js_1.services.links.put(links);
|
|
92
142
|
}
|
|
93
143
|
module.exports = {
|
|
94
144
|
artifact: saveArtifact,
|
package/lib/reporter.d.ts
CHANGED
|
@@ -12,43 +12,59 @@ export const artifact: (data: string | {
|
|
|
12
12
|
}, context?: any) => void;
|
|
13
13
|
export const log: (...args: any[]) => void;
|
|
14
14
|
export const logger: {
|
|
15
|
-
"__#
|
|
15
|
+
"__#14@#originalUserLogger": {
|
|
16
16
|
assert(condition?: boolean, ...data: any[]): void;
|
|
17
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
17
18
|
clear(): void;
|
|
19
|
+
clear(): void;
|
|
20
|
+
count(label?: string): void;
|
|
18
21
|
count(label?: string): void;
|
|
19
22
|
countReset(label?: string): void;
|
|
23
|
+
countReset(label?: string): void;
|
|
20
24
|
debug(...data: any[]): void;
|
|
25
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
21
26
|
dir(item?: any, options?: any): void;
|
|
27
|
+
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
28
|
+
dirxml(...data: any[]): void;
|
|
22
29
|
dirxml(...data: any[]): void;
|
|
23
30
|
error(...data: any[]): void;
|
|
31
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
24
32
|
group(...data: any[]): void;
|
|
33
|
+
group(...label: any[]): void;
|
|
25
34
|
groupCollapsed(...data: any[]): void;
|
|
35
|
+
groupCollapsed(...label: any[]): void;
|
|
36
|
+
groupEnd(): void;
|
|
26
37
|
groupEnd(): void;
|
|
27
38
|
info(...data: any[]): void;
|
|
39
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
28
40
|
log(...data: any[]): void;
|
|
41
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
29
42
|
table(tabularData?: any, properties?: string[]): void;
|
|
43
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
44
|
+
time(label?: string): void;
|
|
30
45
|
time(label?: string): void;
|
|
31
46
|
timeEnd(label?: string): void;
|
|
47
|
+
timeEnd(label?: string): void;
|
|
48
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
32
49
|
timeLog(label?: string, ...data: any[]): void;
|
|
33
50
|
timeStamp(label?: string): void;
|
|
51
|
+
timeStamp(label?: string): void;
|
|
34
52
|
trace(...data: any[]): void;
|
|
53
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
35
54
|
warn(...data: any[]): void;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): import("node:console").Console;
|
|
39
|
-
new (options: import("node:console").ConsoleOptions): import("node:console").Console;
|
|
40
|
-
};
|
|
55
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
56
|
+
Console: console.ConsoleConstructor;
|
|
41
57
|
profile(label?: string): void;
|
|
42
58
|
profileEnd(label?: string): void;
|
|
43
59
|
};
|
|
44
|
-
"__#
|
|
60
|
+
"__#14@#userLoggerWithOverridenMethods": any;
|
|
45
61
|
logLevel: string;
|
|
46
62
|
step(strings: any, ...values: any[]): void;
|
|
47
63
|
getLogs(context: string): string[];
|
|
48
|
-
"__#
|
|
49
|
-
"__#
|
|
64
|
+
"__#14@#stringifyLogs"(...args: any[]): string;
|
|
65
|
+
"__#14@#formatMessage"(strings: any, ...args: any[]): string;
|
|
50
66
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
51
|
-
"__#
|
|
67
|
+
"__#14@#logWrapper"(argsArray: any, level: any): void;
|
|
52
68
|
assert(...args: any[]): void;
|
|
53
69
|
debug(...args: any[]): void;
|
|
54
70
|
error(...args: any[]): void;
|
|
@@ -66,52 +82,70 @@ export const logger: {
|
|
|
66
82
|
};
|
|
67
83
|
export const meta: (keyValue: {
|
|
68
84
|
[key: string]: string;
|
|
69
|
-
} | string, value?: string |
|
|
85
|
+
} | string, value?: string | undefined) => void;
|
|
70
86
|
export const step: (message: string, logs?: {
|
|
71
87
|
[key: string]: any;
|
|
72
88
|
}) => void;
|
|
73
|
-
export const label: (key: string
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
export const label: (key: string | {
|
|
90
|
+
[key: string]: string;
|
|
91
|
+
}, value?: string | null) => void;
|
|
92
|
+
export const linkTest: (...testIds: (string | string[])[]) => void;
|
|
93
|
+
export const linkJira: (...jiraIds: (string | string[])[]) => void;
|
|
76
94
|
declare namespace _default {
|
|
77
95
|
export let testomatioLogger: {
|
|
78
|
-
"__#
|
|
96
|
+
"__#14@#originalUserLogger": {
|
|
79
97
|
assert(condition?: boolean, ...data: any[]): void;
|
|
98
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
99
|
+
clear(): void;
|
|
80
100
|
clear(): void;
|
|
81
101
|
count(label?: string): void;
|
|
102
|
+
count(label?: string): void;
|
|
103
|
+
countReset(label?: string): void;
|
|
82
104
|
countReset(label?: string): void;
|
|
83
105
|
debug(...data: any[]): void;
|
|
106
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
84
107
|
dir(item?: any, options?: any): void;
|
|
108
|
+
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
109
|
+
dirxml(...data: any[]): void;
|
|
85
110
|
dirxml(...data: any[]): void;
|
|
86
111
|
error(...data: any[]): void;
|
|
112
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
87
113
|
group(...data: any[]): void;
|
|
114
|
+
group(...label: any[]): void;
|
|
88
115
|
groupCollapsed(...data: any[]): void;
|
|
116
|
+
groupCollapsed(...label: any[]): void;
|
|
117
|
+
groupEnd(): void;
|
|
89
118
|
groupEnd(): void;
|
|
90
119
|
info(...data: any[]): void;
|
|
120
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
91
121
|
log(...data: any[]): void;
|
|
122
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
92
123
|
table(tabularData?: any, properties?: string[]): void;
|
|
124
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
125
|
+
time(label?: string): void;
|
|
93
126
|
time(label?: string): void;
|
|
94
127
|
timeEnd(label?: string): void;
|
|
128
|
+
timeEnd(label?: string): void;
|
|
129
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
95
130
|
timeLog(label?: string, ...data: any[]): void;
|
|
96
131
|
timeStamp(label?: string): void;
|
|
132
|
+
timeStamp(label?: string): void;
|
|
97
133
|
trace(...data: any[]): void;
|
|
134
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
98
135
|
warn(...data: any[]): void;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): import("node:console").Console;
|
|
102
|
-
new (options: import("node:console").ConsoleOptions): import("node:console").Console;
|
|
103
|
-
};
|
|
136
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
137
|
+
Console: console.ConsoleConstructor;
|
|
104
138
|
profile(label?: string): void;
|
|
105
139
|
profileEnd(label?: string): void;
|
|
106
140
|
};
|
|
107
|
-
"__#
|
|
141
|
+
"__#14@#userLoggerWithOverridenMethods": any;
|
|
108
142
|
logLevel: string;
|
|
109
143
|
step(strings: any, ...values: any[]): void;
|
|
110
144
|
getLogs(context: string): string[];
|
|
111
|
-
"__#
|
|
112
|
-
"__#
|
|
145
|
+
"__#14@#stringifyLogs"(...args: any[]): string;
|
|
146
|
+
"__#14@#formatMessage"(strings: any, ...args: any[]): string;
|
|
113
147
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
114
|
-
"__#
|
|
148
|
+
"__#14@#logWrapper"(argsArray: any, level: any): void;
|
|
115
149
|
assert(...args: any[]): void;
|
|
116
150
|
debug(...args: any[]): void;
|
|
117
151
|
error(...args: any[]): void;
|
|
@@ -134,43 +168,59 @@ declare namespace _default {
|
|
|
134
168
|
}, context?: any) => void;
|
|
135
169
|
export let log: (...args: any[]) => void;
|
|
136
170
|
export let logger: {
|
|
137
|
-
"__#
|
|
171
|
+
"__#14@#originalUserLogger": {
|
|
138
172
|
assert(condition?: boolean, ...data: any[]): void;
|
|
173
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
174
|
+
clear(): void;
|
|
139
175
|
clear(): void;
|
|
140
176
|
count(label?: string): void;
|
|
177
|
+
count(label?: string): void;
|
|
178
|
+
countReset(label?: string): void;
|
|
141
179
|
countReset(label?: string): void;
|
|
142
180
|
debug(...data: any[]): void;
|
|
181
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
143
182
|
dir(item?: any, options?: any): void;
|
|
183
|
+
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
184
|
+
dirxml(...data: any[]): void;
|
|
144
185
|
dirxml(...data: any[]): void;
|
|
145
186
|
error(...data: any[]): void;
|
|
187
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
146
188
|
group(...data: any[]): void;
|
|
189
|
+
group(...label: any[]): void;
|
|
147
190
|
groupCollapsed(...data: any[]): void;
|
|
191
|
+
groupCollapsed(...label: any[]): void;
|
|
192
|
+
groupEnd(): void;
|
|
148
193
|
groupEnd(): void;
|
|
149
194
|
info(...data: any[]): void;
|
|
195
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
150
196
|
log(...data: any[]): void;
|
|
197
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
151
198
|
table(tabularData?: any, properties?: string[]): void;
|
|
199
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
152
200
|
time(label?: string): void;
|
|
201
|
+
time(label?: string): void;
|
|
202
|
+
timeEnd(label?: string): void;
|
|
153
203
|
timeEnd(label?: string): void;
|
|
154
204
|
timeLog(label?: string, ...data: any[]): void;
|
|
205
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
206
|
+
timeStamp(label?: string): void;
|
|
155
207
|
timeStamp(label?: string): void;
|
|
156
208
|
trace(...data: any[]): void;
|
|
209
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
157
210
|
warn(...data: any[]): void;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): import("node:console").Console;
|
|
161
|
-
new (options: import("node:console").ConsoleOptions): import("node:console").Console;
|
|
162
|
-
};
|
|
211
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
212
|
+
Console: console.ConsoleConstructor;
|
|
163
213
|
profile(label?: string): void;
|
|
164
214
|
profileEnd(label?: string): void;
|
|
165
215
|
};
|
|
166
|
-
"__#
|
|
216
|
+
"__#14@#userLoggerWithOverridenMethods": any;
|
|
167
217
|
logLevel: string;
|
|
168
218
|
step(strings: any, ...values: any[]): void;
|
|
169
219
|
getLogs(context: string): string[];
|
|
170
|
-
"__#
|
|
171
|
-
"__#
|
|
220
|
+
"__#14@#stringifyLogs"(...args: any[]): string;
|
|
221
|
+
"__#14@#formatMessage"(strings: any, ...args: any[]): string;
|
|
172
222
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
173
|
-
"__#
|
|
223
|
+
"__#14@#logWrapper"(argsArray: any, level: any): void;
|
|
174
224
|
assert(...args: any[]): void;
|
|
175
225
|
debug(...args: any[]): void;
|
|
176
226
|
error(...args: any[]): void;
|
|
@@ -188,13 +238,15 @@ declare namespace _default {
|
|
|
188
238
|
};
|
|
189
239
|
export let meta: (keyValue: {
|
|
190
240
|
[key: string]: string;
|
|
191
|
-
} | string, value?: string |
|
|
241
|
+
} | string, value?: string | undefined) => void;
|
|
192
242
|
export let step: (message: string, logs?: {
|
|
193
243
|
[key: string]: any;
|
|
194
244
|
}) => void;
|
|
195
|
-
export let label: (key: string
|
|
196
|
-
|
|
197
|
-
|
|
245
|
+
export let label: (key: string | {
|
|
246
|
+
[key: string]: string;
|
|
247
|
+
}, value?: string | null) => void;
|
|
248
|
+
export let linkTest: (...testIds: (string | string[])[]) => void;
|
|
249
|
+
export let linkJira: (...jiraIds: (string | string[])[]) => void;
|
|
198
250
|
export { Client as TestomatioClient };
|
|
199
251
|
export { STATUS };
|
|
200
252
|
}
|