@testomatio/reporter 2.5.1 → 2.6.0-beta.1.allure
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 +4 -2
- package/lib/adapter/playwright.d.ts +3 -2
- package/lib/adapter/playwright.js +23 -17
- package/lib/allureReader.d.ts +65 -0
- package/lib/allureReader.js +448 -0
- package/lib/bin/cli.js +28 -0
- package/lib/data-storage.d.ts +1 -1
- package/lib/junit-adapter/index.js +4 -0
- package/lib/junit-adapter/kotlin.d.ts +5 -0
- package/lib/junit-adapter/kotlin.js +46 -0
- package/lib/pipe/debug.js +2 -1
- package/lib/pipe/testomatio.js +1 -1
- package/lib/reporter.d.ts +30 -78
- package/lib/services/artifacts.d.ts +1 -1
- package/lib/services/key-values.d.ts +1 -1
- package/lib/services/links.d.ts +1 -1
- package/lib/services/logger.d.ts +1 -1
- package/lib/utils/log-formatter.d.ts +2 -1
- package/lib/utils/utils.js +9 -0
- package/package.json +1 -1
- package/src/adapter/playwright.js +24 -18
- package/src/allureReader.js +523 -0
- package/src/bin/cli.js +38 -4
- package/src/junit-adapter/index.js +4 -0
- package/src/junit-adapter/kotlin.js +48 -0
- package/src/pipe/debug.js +2 -1
- package/src/pipe/testomatio.js +1 -1
- package/src/utils/utils.js +5 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const adapter_js_1 = __importDefault(require("./adapter.js"));
|
|
8
|
+
class KotlinAdapter extends adapter_js_1.default {
|
|
9
|
+
getFilePath(t) {
|
|
10
|
+
const fileName = namespaceToFileName(t.suite_title);
|
|
11
|
+
return this.opts.javaTests + path_1.default.sep + fileName;
|
|
12
|
+
}
|
|
13
|
+
formatTest(t) {
|
|
14
|
+
const fileParts = t.suite_title.split('.');
|
|
15
|
+
t.file = namespaceToFileName(t.suite_title);
|
|
16
|
+
t.title = t.title.split('(')[0];
|
|
17
|
+
// detect params
|
|
18
|
+
const paramMatches = t.title.match(/\[(.*?)\]/g);
|
|
19
|
+
if (paramMatches) {
|
|
20
|
+
const params = paramMatches.map((_match, index) => `param${index + 1}`);
|
|
21
|
+
if (params.length === 1)
|
|
22
|
+
params[0] = 'param';
|
|
23
|
+
let paramIndex = 0;
|
|
24
|
+
t.title = t.title.replace(/: \[(.*?)\]/g, () => {
|
|
25
|
+
if (params.length < 2)
|
|
26
|
+
return `\${param}`;
|
|
27
|
+
const paramName = params[paramIndex] || `param${paramIndex + 1}`;
|
|
28
|
+
paramIndex++;
|
|
29
|
+
return `\${${paramName}}`;
|
|
30
|
+
});
|
|
31
|
+
const example = {};
|
|
32
|
+
paramMatches.forEach((match, index) => {
|
|
33
|
+
example[params[index]] = match.replace(/[[\]]/g, '');
|
|
34
|
+
});
|
|
35
|
+
t.example = example;
|
|
36
|
+
}
|
|
37
|
+
t.suite_title = fileParts[fileParts.length - 1].replace(/\$/g, ' | ');
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function namespaceToFileName(fileName) {
|
|
42
|
+
const fileParts = fileName.split('.');
|
|
43
|
+
fileParts[fileParts.length - 1] = fileParts[fileParts.length - 1]?.replace(/\$.*/, '');
|
|
44
|
+
return `${fileParts.join(path_1.default.sep)}.kt`;
|
|
45
|
+
}
|
|
46
|
+
module.exports = KotlinAdapter;
|
package/lib/pipe/debug.js
CHANGED
|
@@ -10,6 +10,7 @@ const os_1 = __importDefault(require("os"));
|
|
|
10
10
|
const debug_1 = __importDefault(require("debug"));
|
|
11
11
|
const constants_js_1 = require("../constants.js");
|
|
12
12
|
const pretty_ms_1 = __importDefault(require("pretty-ms"));
|
|
13
|
+
const utils_js_1 = require("../utils/utils.js");
|
|
13
14
|
const debug = (0, debug_1.default)('@testomatio/reporter:pipe:debug');
|
|
14
15
|
class DebugPipe {
|
|
15
16
|
constructor(params, store) {
|
|
@@ -18,7 +19,7 @@ class DebugPipe {
|
|
|
18
19
|
this.isEnabled = !!process.env.TESTOMATIO_DEBUG || !!process.env.DEBUG;
|
|
19
20
|
if (this.isEnabled) {
|
|
20
21
|
this.batch = {
|
|
21
|
-
isEnabled: this.params.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD
|
|
22
|
+
isEnabled: this.params.isBatchEnabled ?? !(0, utils_js_1.transformEnvVarToBoolean)(process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD),
|
|
22
23
|
intervalFunction: null,
|
|
23
24
|
intervalTime: 5000,
|
|
24
25
|
tests: [],
|
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 ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD
|
|
26
|
+
isEnabled: params?.isBatchEnabled ?? !(0, utils_js_1.transformEnvVarToBoolean)(process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD),
|
|
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
|
package/lib/reporter.d.ts
CHANGED
|
@@ -12,59 +12,43 @@ 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
|
+
"__#private@#originalUserLogger": {
|
|
16
16
|
assert(condition?: boolean, ...data: any[]): void;
|
|
17
|
-
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
18
17
|
clear(): void;
|
|
19
|
-
clear(): void;
|
|
20
|
-
count(label?: string): void;
|
|
21
18
|
count(label?: string): void;
|
|
22
19
|
countReset(label?: string): void;
|
|
23
|
-
countReset(label?: string): void;
|
|
24
20
|
debug(...data: any[]): void;
|
|
25
|
-
debug(message?: any, ...optionalParams: any[]): void;
|
|
26
21
|
dir(item?: any, options?: any): void;
|
|
27
|
-
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
28
|
-
dirxml(...data: any[]): void;
|
|
29
22
|
dirxml(...data: any[]): void;
|
|
30
23
|
error(...data: any[]): void;
|
|
31
|
-
error(message?: any, ...optionalParams: any[]): void;
|
|
32
24
|
group(...data: any[]): void;
|
|
33
|
-
group(...label: any[]): void;
|
|
34
25
|
groupCollapsed(...data: any[]): void;
|
|
35
|
-
groupCollapsed(...label: any[]): void;
|
|
36
|
-
groupEnd(): void;
|
|
37
26
|
groupEnd(): void;
|
|
38
27
|
info(...data: any[]): void;
|
|
39
|
-
info(message?: any, ...optionalParams: any[]): void;
|
|
40
28
|
log(...data: any[]): void;
|
|
41
|
-
log(message?: any, ...optionalParams: any[]): void;
|
|
42
29
|
table(tabularData?: any, properties?: string[]): void;
|
|
43
|
-
table(tabularData: any, properties?: readonly string[]): void;
|
|
44
|
-
time(label?: string): void;
|
|
45
30
|
time(label?: string): void;
|
|
46
31
|
timeEnd(label?: string): void;
|
|
47
|
-
timeEnd(label?: string): void;
|
|
48
32
|
timeLog(label?: string, ...data: any[]): void;
|
|
49
|
-
timeLog(label?: string, ...data: any[]): void;
|
|
50
|
-
timeStamp(label?: string): void;
|
|
51
33
|
timeStamp(label?: string): void;
|
|
52
34
|
trace(...data: any[]): void;
|
|
53
|
-
trace(message?: any, ...optionalParams: any[]): void;
|
|
54
35
|
warn(...data: any[]): void;
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
Console: {
|
|
37
|
+
prototype: import("node:console").Console;
|
|
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
|
+
};
|
|
57
41
|
profile(label?: string): void;
|
|
58
42
|
profileEnd(label?: string): void;
|
|
59
43
|
};
|
|
60
|
-
"__#
|
|
44
|
+
"__#private@#userLoggerWithOverridenMethods": any;
|
|
61
45
|
logLevel: string;
|
|
62
46
|
step(strings: any, ...values: any[]): void;
|
|
63
47
|
getLogs(context: string): string[];
|
|
64
|
-
"__#
|
|
65
|
-
"__#
|
|
48
|
+
"__#private@#stringifyLogs"(...args: any[]): string;
|
|
49
|
+
"__#private@#formatMessage"(strings: any, ...args: any[]): string;
|
|
66
50
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
67
|
-
"__#
|
|
51
|
+
"__#private@#logWrapper"(argsArray: any, level: any): void;
|
|
68
52
|
assert(...args: any[]): void;
|
|
69
53
|
debug(...args: any[]): void;
|
|
70
54
|
error(...args: any[]): void;
|
|
@@ -91,59 +75,43 @@ export const linkTest: (...testIds: string[]) => void;
|
|
|
91
75
|
export const linkJira: (...jiraIds: string[]) => void;
|
|
92
76
|
declare namespace _default {
|
|
93
77
|
export let testomatioLogger: {
|
|
94
|
-
"__#
|
|
78
|
+
"__#private@#originalUserLogger": {
|
|
95
79
|
assert(condition?: boolean, ...data: any[]): void;
|
|
96
|
-
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
97
|
-
clear(): void;
|
|
98
80
|
clear(): void;
|
|
99
81
|
count(label?: string): void;
|
|
100
|
-
count(label?: string): void;
|
|
101
|
-
countReset(label?: string): void;
|
|
102
82
|
countReset(label?: string): void;
|
|
103
83
|
debug(...data: any[]): void;
|
|
104
|
-
debug(message?: any, ...optionalParams: any[]): void;
|
|
105
84
|
dir(item?: any, options?: any): void;
|
|
106
|
-
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
107
|
-
dirxml(...data: any[]): void;
|
|
108
85
|
dirxml(...data: any[]): void;
|
|
109
86
|
error(...data: any[]): void;
|
|
110
|
-
error(message?: any, ...optionalParams: any[]): void;
|
|
111
87
|
group(...data: any[]): void;
|
|
112
|
-
group(...label: any[]): void;
|
|
113
88
|
groupCollapsed(...data: any[]): void;
|
|
114
|
-
groupCollapsed(...label: any[]): void;
|
|
115
|
-
groupEnd(): void;
|
|
116
89
|
groupEnd(): void;
|
|
117
90
|
info(...data: any[]): void;
|
|
118
|
-
info(message?: any, ...optionalParams: any[]): void;
|
|
119
91
|
log(...data: any[]): void;
|
|
120
|
-
log(message?: any, ...optionalParams: any[]): void;
|
|
121
92
|
table(tabularData?: any, properties?: string[]): void;
|
|
122
|
-
table(tabularData: any, properties?: readonly string[]): void;
|
|
123
|
-
time(label?: string): void;
|
|
124
93
|
time(label?: string): void;
|
|
125
94
|
timeEnd(label?: string): void;
|
|
126
|
-
timeEnd(label?: string): void;
|
|
127
|
-
timeLog(label?: string, ...data: any[]): void;
|
|
128
95
|
timeLog(label?: string, ...data: any[]): void;
|
|
129
96
|
timeStamp(label?: string): void;
|
|
130
|
-
timeStamp(label?: string): void;
|
|
131
97
|
trace(...data: any[]): void;
|
|
132
|
-
trace(message?: any, ...optionalParams: any[]): void;
|
|
133
98
|
warn(...data: any[]): void;
|
|
134
|
-
|
|
135
|
-
|
|
99
|
+
Console: {
|
|
100
|
+
prototype: import("node:console").Console;
|
|
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
104
|
profile(label?: string): void;
|
|
137
105
|
profileEnd(label?: string): void;
|
|
138
106
|
};
|
|
139
|
-
"__#
|
|
107
|
+
"__#private@#userLoggerWithOverridenMethods": any;
|
|
140
108
|
logLevel: string;
|
|
141
109
|
step(strings: any, ...values: any[]): void;
|
|
142
110
|
getLogs(context: string): string[];
|
|
143
|
-
"__#
|
|
144
|
-
"__#
|
|
111
|
+
"__#private@#stringifyLogs"(...args: any[]): string;
|
|
112
|
+
"__#private@#formatMessage"(strings: any, ...args: any[]): string;
|
|
145
113
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
146
|
-
"__#
|
|
114
|
+
"__#private@#logWrapper"(argsArray: any, level: any): void;
|
|
147
115
|
assert(...args: any[]): void;
|
|
148
116
|
debug(...args: any[]): void;
|
|
149
117
|
error(...args: any[]): void;
|
|
@@ -166,59 +134,43 @@ declare namespace _default {
|
|
|
166
134
|
}, context?: any) => void;
|
|
167
135
|
export let log: (...args: any[]) => void;
|
|
168
136
|
export let logger: {
|
|
169
|
-
"__#
|
|
137
|
+
"__#private@#originalUserLogger": {
|
|
170
138
|
assert(condition?: boolean, ...data: any[]): void;
|
|
171
|
-
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
172
|
-
clear(): void;
|
|
173
139
|
clear(): void;
|
|
174
140
|
count(label?: string): void;
|
|
175
|
-
count(label?: string): void;
|
|
176
|
-
countReset(label?: string): void;
|
|
177
141
|
countReset(label?: string): void;
|
|
178
142
|
debug(...data: any[]): void;
|
|
179
|
-
debug(message?: any, ...optionalParams: any[]): void;
|
|
180
143
|
dir(item?: any, options?: any): void;
|
|
181
|
-
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
182
|
-
dirxml(...data: any[]): void;
|
|
183
144
|
dirxml(...data: any[]): void;
|
|
184
145
|
error(...data: any[]): void;
|
|
185
|
-
error(message?: any, ...optionalParams: any[]): void;
|
|
186
146
|
group(...data: any[]): void;
|
|
187
|
-
group(...label: any[]): void;
|
|
188
147
|
groupCollapsed(...data: any[]): void;
|
|
189
|
-
groupCollapsed(...label: any[]): void;
|
|
190
|
-
groupEnd(): void;
|
|
191
148
|
groupEnd(): void;
|
|
192
149
|
info(...data: any[]): void;
|
|
193
|
-
info(message?: any, ...optionalParams: any[]): void;
|
|
194
150
|
log(...data: any[]): void;
|
|
195
|
-
log(message?: any, ...optionalParams: any[]): void;
|
|
196
151
|
table(tabularData?: any, properties?: string[]): void;
|
|
197
|
-
table(tabularData: any, properties?: readonly string[]): void;
|
|
198
|
-
time(label?: string): void;
|
|
199
152
|
time(label?: string): void;
|
|
200
153
|
timeEnd(label?: string): void;
|
|
201
|
-
timeEnd(label?: string): void;
|
|
202
|
-
timeLog(label?: string, ...data: any[]): void;
|
|
203
154
|
timeLog(label?: string, ...data: any[]): void;
|
|
204
155
|
timeStamp(label?: string): void;
|
|
205
|
-
timeStamp(label?: string): void;
|
|
206
156
|
trace(...data: any[]): void;
|
|
207
|
-
trace(message?: any, ...optionalParams: any[]): void;
|
|
208
157
|
warn(...data: any[]): void;
|
|
209
|
-
|
|
210
|
-
|
|
158
|
+
Console: {
|
|
159
|
+
prototype: import("node:console").Console;
|
|
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
163
|
profile(label?: string): void;
|
|
212
164
|
profileEnd(label?: string): void;
|
|
213
165
|
};
|
|
214
|
-
"__#
|
|
166
|
+
"__#private@#userLoggerWithOverridenMethods": any;
|
|
215
167
|
logLevel: string;
|
|
216
168
|
step(strings: any, ...values: any[]): void;
|
|
217
169
|
getLogs(context: string): string[];
|
|
218
|
-
"__#
|
|
219
|
-
"__#
|
|
170
|
+
"__#private@#stringifyLogs"(...args: any[]): string;
|
|
171
|
+
"__#private@#formatMessage"(strings: any, ...args: any[]): string;
|
|
220
172
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
221
|
-
"__#
|
|
173
|
+
"__#private@#logWrapper"(argsArray: any, level: any): void;
|
|
222
174
|
assert(...args: any[]): void;
|
|
223
175
|
debug(...args: any[]): void;
|
|
224
176
|
error(...args: any[]): void;
|
package/lib/services/links.d.ts
CHANGED
package/lib/services/logger.d.ts
CHANGED
|
@@ -25,4 +25,5 @@ export function formatError(error: Error & {
|
|
|
25
25
|
actual?: any;
|
|
26
26
|
expected?: any;
|
|
27
27
|
}, message?: string): string;
|
|
28
|
-
export
|
|
28
|
+
export const stripColors: typeof stripVTControlCharacters;
|
|
29
|
+
import { stripVTControlCharacters } from 'util';
|
package/lib/utils/utils.js
CHANGED
|
@@ -311,6 +311,15 @@ const fetchSourceCode = (contents, opts = {}) => {
|
|
|
311
311
|
if (lineIndex === -1)
|
|
312
312
|
lineIndex = lines.findIndex(l => l.includes(`${title}(`));
|
|
313
313
|
}
|
|
314
|
+
else if (opts.lang === 'kotlin') {
|
|
315
|
+
lineIndex = lines.findIndex(l => l.includes(`fun test${title}`));
|
|
316
|
+
if (lineIndex === -1)
|
|
317
|
+
lineIndex = lines.findIndex(l => l.includes(`@DisplayName("${title}`));
|
|
318
|
+
if (lineIndex === -1)
|
|
319
|
+
lineIndex = lines.findIndex(l => l.includes(`fun ${title}`));
|
|
320
|
+
if (lineIndex === -1)
|
|
321
|
+
lineIndex = lines.findIndex(l => l.includes(`${title}(`));
|
|
322
|
+
}
|
|
314
323
|
else if (opts.lang === 'csharp') {
|
|
315
324
|
// Find the method declaration line
|
|
316
325
|
let methodLineIndex = lines.findIndex(l => l.includes(`public void ${title}(`));
|
package/package.json
CHANGED
|
@@ -96,7 +96,7 @@ class PlaywrightReporter {
|
|
|
96
96
|
test_id: getTestomatIdFromTestTitle(`${title} ${tags.join(' ')}`),
|
|
97
97
|
suite_title,
|
|
98
98
|
title,
|
|
99
|
-
tags,
|
|
99
|
+
tags: tags.map(tag => tag.replace('@', '')),
|
|
100
100
|
steps: steps.length ? steps : undefined,
|
|
101
101
|
time: duration,
|
|
102
102
|
logs,
|
|
@@ -248,29 +248,35 @@ function generateTmpFilepath(filename = '') {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
/**
|
|
251
|
-
* Extracts
|
|
251
|
+
* Extracts tags from test title, test options, and suite level
|
|
252
|
+
* Identifies duplicate tags (case-insensitive)
|
|
252
253
|
* @param {*} test - testInfo object from Playwright
|
|
253
|
-
* @returns {string[]} - array of normalized tags
|
|
254
|
+
* @returns {string[]} - array of normalized tags with @ prefix
|
|
254
255
|
*/
|
|
255
256
|
function extractTags(test) {
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
const tagsMap = new Map(); // key: lowercase tag, value: original case tag
|
|
258
|
+
|
|
259
|
+
function addTag(tag) {
|
|
260
|
+
if (typeof tag !== 'string') return;
|
|
261
|
+
const trimmed = tag.trim();
|
|
262
|
+
if (!trimmed) return;
|
|
263
|
+
const normalizedTag = trimmed.startsWith('@') ? trimmed : `@${trimmed}`;
|
|
264
|
+
const lowercaseTag = normalizedTag.toLowerCase();
|
|
265
|
+
if (!tagsMap.has(lowercaseTag)) {
|
|
266
|
+
tagsMap.set(lowercaseTag, normalizedTag);
|
|
267
|
+
}
|
|
264
268
|
}
|
|
265
269
|
|
|
266
|
-
// Extract tags from test
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
// Extract tags from test title (@tag format); only test title is considered
|
|
271
|
+
const titleTagsMatch = test.title.match(/@[A-Za-z0-9_-]+/g) || [];
|
|
272
|
+
titleTagsMatch.forEach(addTag);
|
|
273
|
+
|
|
274
|
+
// Extract tags from test.tags (Playwright built-in tags); ignore parents
|
|
275
|
+
if (Array.isArray(test.tags)) {
|
|
276
|
+
test.tags.forEach(addTag);
|
|
272
277
|
}
|
|
273
|
-
|
|
278
|
+
|
|
279
|
+
return Array.from(tagsMap.values());
|
|
274
280
|
}
|
|
275
281
|
|
|
276
282
|
/**
|