@allurereport/plugin-allure2 3.16.0 → 3.17.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/README.md +12 -11
- package/dist/categories.js +9 -6
- package/dist/converters.d.ts +2 -1
- package/dist/converters.js +111 -43
- package/dist/generators.d.ts +10 -15
- package/dist/generators.js +163 -123
- package/dist/model.d.ts +40 -3
- package/dist/model.js +1 -1
- package/dist/plugin.js +18 -3
- package/dist/static/report.tar +0 -0
- package/dist/tree.d.ts +1 -0
- package/dist/tree.js +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +11 -1
- package/package.json +7 -8
- package/static/multi/154.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/216.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/232.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/250.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/256.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/301.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/323.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/353.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/411d15fc5bb62472eea6ead4fb276ca9.ico +0 -0
- package/static/multi/564.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/594.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/623.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/647.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/7.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/729.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/783.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/826.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/925.app-fb0942f23106767a264c.js +0 -1
- package/static/multi/app-fb0942f23106767a264c.js +0 -2
- package/static/multi/app-fb0942f23106767a264c.js.LICENSE.txt +0 -22
- package/static/multi/checkmark.svg +0 -8
- package/static/multi/manifest.json +0 -28
- package/static/multi/sort-down-icon.svg +0 -8
- package/static/multi/sort-icon.svg +0 -8
- package/static/multi/sort-up-icon.svg +0 -8
- package/static/multi/sprite.svg +0 -4
- package/static/multi/styles-aa1ab4909f318c34044b.css +0 -558
- package/static/multi/vertical.png +0 -0
- package/static/single/411d15fc5bb62472eea6ead4fb276ca9.ico +0 -0
- package/static/single/app-1fe2002078c21c1001aa.js +0 -2
- package/static/single/app-1fe2002078c21c1001aa.js.LICENSE.txt +0 -22
- package/static/single/checkmark.svg +0 -8
- package/static/single/manifest.json +0 -10
- package/static/single/sort-down-icon.svg +0 -8
- package/static/single/sort-icon.svg +0 -8
- package/static/single/sort-up-icon.svg +0 -8
- package/static/single/sprite.svg +0 -4
- package/static/single/styles-0bf6b43f9cd1a3e65872.css +0 -558
package/dist/generators.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { createBaseUrlScript, createFaviconLinkTag, createReportDataScript, stringifyForInlineScript, createScriptTag, createStylesLinkTag, } from "@allurereport/core-api";
|
|
5
|
-
import { findUp } from "find-up";
|
|
1
|
+
import { createBaseUrlScript, createScriptTag, createStylesLinkTag } from "@allurereport/core-api";
|
|
2
|
+
import { copyReportStaticAssets, getReportStaticAsset, readReportStaticAssets, } from "@allurereport/plugin-api/static-assets";
|
|
6
3
|
import Handlebars from "handlebars";
|
|
7
4
|
import { byLabels, collapseTree, createTree, createWidget } from "./tree.js";
|
|
8
|
-
import { updateStatistic, updateTime } from "./utils.js";
|
|
5
|
+
import { createStatistic, updateStatistic, updateTime } from "./utils.js";
|
|
6
|
+
const reportStaticArchive = new URL("../dist/static/report.tar", import.meta.url);
|
|
9
7
|
const writeConcurrently = async (items, write, concurrency = 64) => {
|
|
10
8
|
for (let i = 0; i < items.length; i += concurrency) {
|
|
11
9
|
await Promise.all(items.slice(i, i + concurrency).map(write));
|
|
@@ -15,14 +13,11 @@ const template = `<!DOCTYPE html>
|
|
|
15
13
|
<html dir="ltr" lang="{{reportLanguage}}">
|
|
16
14
|
<head>
|
|
17
15
|
<meta charset="utf-8">
|
|
16
|
+
<meta name="allure-report-uuid" content="{{reportUuid}}">
|
|
18
17
|
<title>{{reportName}}</title>
|
|
19
18
|
{{{ headTags }}}
|
|
20
|
-
<script>
|
|
21
|
-
window.allureReportOptions = {{{ reportOptions }}};
|
|
22
|
-
</script>
|
|
23
19
|
</head>
|
|
24
20
|
<body>
|
|
25
|
-
<svg id="__SVG_SPRITE_NODE__" aria-hidden="true" style="position: absolute; width: 0; height: 0"></svg>
|
|
26
21
|
<div id="alert"></div>
|
|
27
22
|
<div id="content">
|
|
28
23
|
<span class="spinner">
|
|
@@ -30,19 +25,29 @@ const template = `<!DOCTYPE html>
|
|
|
30
25
|
</span>
|
|
31
26
|
</div>
|
|
32
27
|
<div id="popup"></div>
|
|
28
|
+
<script>
|
|
29
|
+
window.__allureCoreLoaded = new Promise(function (resolve, reject) {
|
|
30
|
+
window.__allureResolveCoreLoaded = resolve;
|
|
31
|
+
window.__allureRejectCoreLoaded = reject;
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
33
34
|
{{{ bodyTags }}}
|
|
35
|
+
<script>
|
|
36
|
+
if (typeof window.__allureResolveCoreLoaded === "function") {
|
|
37
|
+
window.__allureResolveCoreLoaded([]);
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
34
40
|
${createBaseUrlScript()}
|
|
35
41
|
{{#if analyticsEnable}}
|
|
36
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=G-
|
|
42
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FVWC4GKEYS"></script>
|
|
37
43
|
<script>
|
|
38
44
|
window.dataLayer = window.dataLayer || [];
|
|
39
45
|
function gtag(){dataLayer.push(arguments);}
|
|
40
46
|
gtag('js', new Date());
|
|
41
|
-
gtag('config', 'G-
|
|
47
|
+
gtag('config', 'G-FVWC4GKEYS', {
|
|
42
48
|
'allureVersion': '{{allureVersion}}',
|
|
43
|
-
'report':'classic',
|
|
44
49
|
'reportUuid': '{{reportUuid}}',
|
|
45
|
-
'single_file':
|
|
50
|
+
'single_file': {{singleFile}}
|
|
46
51
|
});
|
|
47
52
|
</script>
|
|
48
53
|
{{/if}}
|
|
@@ -51,90 +56,62 @@ const template = `<!DOCTYPE html>
|
|
|
51
56
|
</html>
|
|
52
57
|
`;
|
|
53
58
|
const compiledTemplate = Handlebars.compile(template);
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
const createEmbeddedReportDataScript = (reportFiles) => {
|
|
60
|
+
const reportFilesDeclaration = reportFiles
|
|
61
|
+
.map(({ name, value }) => `d(${JSON.stringify(name)},${JSON.stringify(value)})`)
|
|
62
|
+
.join(",");
|
|
63
|
+
return `
|
|
64
|
+
<script>
|
|
65
|
+
window.reportDataReady = false;
|
|
66
|
+
window.reportData = window.reportData || {};
|
|
67
|
+
|
|
68
|
+
function d(name, value) {
|
|
69
|
+
return new Promise(function (resolve) {
|
|
70
|
+
window.reportData[name] = value;
|
|
71
|
+
resolve(true);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
<script>
|
|
76
|
+
Promise.allSettled([${reportFilesDeclaration}]).then(function () {
|
|
77
|
+
window.reportDataReady = true;
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
80
|
+
`;
|
|
64
81
|
};
|
|
65
|
-
export const
|
|
66
|
-
const {
|
|
67
|
-
|
|
68
|
-
const scriptContentBuffer = await readFile(filePath);
|
|
69
|
-
if (singleFile) {
|
|
70
|
-
return inserter(`data:${mimeType};base64,${scriptContentBuffer.toString("base64")}`);
|
|
71
|
-
}
|
|
72
|
-
await reportFiles.addFile(fileName, scriptContentBuffer);
|
|
73
|
-
return inserter(fileName);
|
|
82
|
+
export const readTemplateManifest = async () => {
|
|
83
|
+
const { manifest } = await readReportStaticAssets(reportStaticArchive);
|
|
84
|
+
return manifest;
|
|
74
85
|
};
|
|
75
86
|
export const generateStaticFiles = async (payload) => {
|
|
76
|
-
const packageRoot = await getPackageRoot();
|
|
77
87
|
const { reportName, reportLanguage, singleFile, reportFiles, reportDataFiles, reportUuid, allureVersion } = payload;
|
|
78
|
-
const
|
|
88
|
+
const staticAssets = await readReportStaticAssets(reportStaticArchive);
|
|
89
|
+
const { manifest } = staticAssets;
|
|
90
|
+
const mainJs = manifest["main.js"];
|
|
91
|
+
const mainCss = manifest["main.css"];
|
|
79
92
|
const headTags = [];
|
|
80
93
|
const bodyTags = [];
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const tag = await readManifestEntry({
|
|
85
|
-
fileName,
|
|
86
|
-
singleFile,
|
|
87
|
-
reportFiles,
|
|
88
|
-
inserter: createFaviconLinkTag,
|
|
89
|
-
mimeType: "image/x-icon",
|
|
90
|
-
packageRoot,
|
|
91
|
-
});
|
|
92
|
-
headTags.push(tag);
|
|
93
|
-
continue;
|
|
94
|
+
if (!singleFile) {
|
|
95
|
+
if (mainCss) {
|
|
96
|
+
headTags.push(createStylesLinkTag(mainCss));
|
|
94
97
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
packageRoot,
|
|
103
|
-
});
|
|
104
|
-
headTags.push(tag);
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
if (key === "main.js") {
|
|
108
|
-
const tag = await readManifestEntry({
|
|
109
|
-
fileName,
|
|
110
|
-
singleFile,
|
|
111
|
-
reportFiles,
|
|
112
|
-
inserter: createScriptTag,
|
|
113
|
-
mimeType: "text/javascript",
|
|
114
|
-
packageRoot,
|
|
115
|
-
});
|
|
116
|
-
bodyTags.push(tag);
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
if (singleFile) {
|
|
120
|
-
continue;
|
|
98
|
+
bodyTags.push(createScriptTag(mainJs));
|
|
99
|
+
await copyReportStaticAssets(staticAssets, reportFiles);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (mainCss) {
|
|
103
|
+
const mainCssContent = getReportStaticAsset(staticAssets, mainCss);
|
|
104
|
+
headTags.push(createStylesLinkTag(`data:text/css;base64,${mainCssContent.toString("base64")}`));
|
|
121
105
|
}
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
await reportFiles.addFile(basename(filePath), fileContent);
|
|
106
|
+
const mainJsContent = getReportStaticAsset(staticAssets, mainJs);
|
|
107
|
+
bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContent.toString("base64")}`));
|
|
125
108
|
}
|
|
126
|
-
const reportOptions = {
|
|
127
|
-
reportName: reportName ?? "Allure Report",
|
|
128
|
-
reportLanguage: reportLanguage ?? "en",
|
|
129
|
-
createdAt: Date.now(),
|
|
130
|
-
};
|
|
131
109
|
try {
|
|
132
110
|
const html = compiledTemplate({
|
|
133
111
|
headTags: headTags.join("\n"),
|
|
134
112
|
bodyTags: bodyTags.join("\n"),
|
|
135
|
-
reportFilesScript:
|
|
136
|
-
|
|
137
|
-
analyticsEnable: true,
|
|
113
|
+
reportFilesScript: singleFile ? createEmbeddedReportDataScript(reportDataFiles) : "",
|
|
114
|
+
analyticsEnable: process.env.ALLURE_NO_ANALYTICS?.toLowerCase() !== "true",
|
|
138
115
|
allureVersion,
|
|
139
116
|
reportLanguage,
|
|
140
117
|
reportUuid,
|
|
@@ -198,7 +175,7 @@ export const generateTestResults = async (writer, tests) => {
|
|
|
198
175
|
await writeConcurrently(tests, (test) => writer.writeTestCase(test));
|
|
199
176
|
};
|
|
200
177
|
export const generateSummaryJson = async (writer, reportName, tests) => {
|
|
201
|
-
const statistic =
|
|
178
|
+
const statistic = createStatistic();
|
|
202
179
|
const time = {};
|
|
203
180
|
tests
|
|
204
181
|
.filter((test) => !test.isRetry)
|
|
@@ -235,50 +212,85 @@ export const generateDefaultWidgetData = async (writer, tests, ...fileNames) =>
|
|
|
235
212
|
await writer.writeWidget(fileName, statusChartData);
|
|
236
213
|
}
|
|
237
214
|
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
]);
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
export const generateTrendData = async (writer, reportName, tests, historyDataPoints) => {
|
|
250
|
-
const statistic = { total: 0 };
|
|
215
|
+
const trendIdentity = (executor) => ({
|
|
216
|
+
buildOrder: executor?.buildOrder,
|
|
217
|
+
reportName: executor?.reportName,
|
|
218
|
+
reportUrl: executor?.reportUrl,
|
|
219
|
+
});
|
|
220
|
+
const prependTrendItem = (current, previous) => [current, ...previous].slice(0, 20);
|
|
221
|
+
export const generateHistoryTrendData = async (writer, reportName, tests, historyDataPoints, legacyHistory = [], executor) => {
|
|
222
|
+
const statistic = createStatistic();
|
|
251
223
|
tests
|
|
252
224
|
.filter((test) => !test.isRetry)
|
|
253
225
|
.forEach((test) => {
|
|
254
226
|
updateStatistic(statistic, test);
|
|
255
227
|
});
|
|
256
|
-
const history =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
228
|
+
const history = legacyHistory.length
|
|
229
|
+
? legacyHistory.map(({ data, statistic: legacyStatistic, ...item }) => ({
|
|
230
|
+
...item,
|
|
231
|
+
data: createStatistic(data ?? legacyStatistic),
|
|
232
|
+
}))
|
|
233
|
+
: historyDataPoints
|
|
234
|
+
.map((point) => {
|
|
235
|
+
const stat = createStatistic();
|
|
236
|
+
Object.values(point.testResults).forEach((testResult) => {
|
|
237
|
+
updateStatistic(stat, testResult);
|
|
238
|
+
});
|
|
239
|
+
return {
|
|
240
|
+
data: stat,
|
|
241
|
+
reportName: point.name,
|
|
242
|
+
reportUrl: point.url,
|
|
243
|
+
timestamp: point.timestamp,
|
|
244
|
+
};
|
|
245
|
+
})
|
|
246
|
+
.sort((left, right) => right.timestamp - left.timestamp)
|
|
247
|
+
.map(({ timestamp: _timestamp, ...item }, index, values) => ({
|
|
248
|
+
...item,
|
|
249
|
+
buildOrder: values.length - index,
|
|
250
|
+
}));
|
|
251
|
+
const current = {
|
|
252
|
+
data: statistic,
|
|
253
|
+
...(executor
|
|
254
|
+
? trendIdentity(executor)
|
|
255
|
+
: {
|
|
256
|
+
buildOrder: history.length + 1,
|
|
257
|
+
reportName,
|
|
258
|
+
}),
|
|
259
|
+
};
|
|
260
|
+
await writer.writeWidget("history-trend.json", prependTrendItem(current, history));
|
|
261
|
+
};
|
|
262
|
+
export const generateDurationTrendData = async (writer, tests, history = [], executor) => {
|
|
263
|
+
const time = {};
|
|
264
|
+
tests.forEach((test) => updateTime(time, test));
|
|
265
|
+
const current = {
|
|
266
|
+
data: { duration: time.duration ?? 0 },
|
|
267
|
+
...trendIdentity(executor),
|
|
268
|
+
};
|
|
269
|
+
await writer.writeWidget("duration-trend.json", prependTrendItem(current, history));
|
|
270
|
+
};
|
|
271
|
+
export const generateRetryTrendData = async (writer, tests, history = [], executor) => {
|
|
272
|
+
const current = {
|
|
273
|
+
data: {
|
|
274
|
+
run: tests.filter((test) => !test.isRetry).length,
|
|
275
|
+
retry: tests.filter((test) => test.isRetry).length,
|
|
276
|
+
},
|
|
277
|
+
...trendIdentity(executor),
|
|
278
|
+
};
|
|
279
|
+
await writer.writeWidget("retry-trend.json", prependTrendItem(current, history));
|
|
280
|
+
};
|
|
281
|
+
export const generateCategoriesTrendData = async (writer, tests, history = [], executor) => {
|
|
282
|
+
const categories = {};
|
|
283
|
+
tests.forEach((test) => {
|
|
284
|
+
const testCategories = test.extra.categories ?? [];
|
|
285
|
+
testCategories.forEach(({ name }) => {
|
|
286
|
+
categories[name] = (categories[name] ?? 0) + 1;
|
|
260
287
|
});
|
|
261
|
-
return {
|
|
262
|
-
data: stat,
|
|
263
|
-
timestamp: point.timestamp,
|
|
264
|
-
reportName: point.name,
|
|
265
|
-
};
|
|
266
|
-
});
|
|
267
|
-
history
|
|
268
|
-
.sort((a, b) => b.timestamp - a.timestamp)
|
|
269
|
-
.forEach((element, index) => {
|
|
270
|
-
element.buildOrder = history.length - index;
|
|
271
288
|
});
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
reportName: reportName,
|
|
278
|
-
},
|
|
279
|
-
...history,
|
|
280
|
-
];
|
|
281
|
-
await writer.writeWidget("history-trend.json", data);
|
|
289
|
+
const current = {
|
|
290
|
+
data: categories,
|
|
291
|
+
...trendIdentity(executor),
|
|
292
|
+
};
|
|
293
|
+
await writer.writeWidget("categories-trend.json", prependTrendItem(current, history));
|
|
282
294
|
};
|
|
283
295
|
export const generateAttachmentsData = async (writer, attachmentLinks, contentFunction) => {
|
|
284
296
|
const result = new Map();
|
|
@@ -296,3 +308,31 @@ export const generateAttachmentsData = async (writer, attachmentLinks, contentFu
|
|
|
296
308
|
}
|
|
297
309
|
return result;
|
|
298
310
|
};
|
|
311
|
+
export const generateGlobalsData = async (writer, globalErrors, globalAttachments, attachmentMap, attachmentTimestamps = {}, errorTimestamps = []) => {
|
|
312
|
+
const data = {
|
|
313
|
+
errors: globalErrors.map(({ message, trace, actual, expected }, index) => ({
|
|
314
|
+
message,
|
|
315
|
+
trace,
|
|
316
|
+
actual,
|
|
317
|
+
expected,
|
|
318
|
+
timestamp: errorTimestamps[index],
|
|
319
|
+
})),
|
|
320
|
+
attachments: globalAttachments.flatMap((attachment) => {
|
|
321
|
+
const source = attachmentMap.get(attachment.id);
|
|
322
|
+
if (!source) {
|
|
323
|
+
return [];
|
|
324
|
+
}
|
|
325
|
+
return [
|
|
326
|
+
{
|
|
327
|
+
uid: attachment.id,
|
|
328
|
+
name: attachment.name,
|
|
329
|
+
source,
|
|
330
|
+
type: attachment.contentType ?? "application/octet-stream",
|
|
331
|
+
size: !attachment.missed ? attachment.contentLength : undefined,
|
|
332
|
+
timestamp: attachment.originalFileName ? attachmentTimestamps[attachment.originalFileName] : undefined,
|
|
333
|
+
},
|
|
334
|
+
];
|
|
335
|
+
}),
|
|
336
|
+
};
|
|
337
|
+
await writer.writeWidget("globals.json", data);
|
|
338
|
+
};
|
package/dist/model.d.ts
CHANGED
|
@@ -25,6 +25,22 @@ export interface Allure2Attachment {
|
|
|
25
25
|
type?: string;
|
|
26
26
|
size?: number;
|
|
27
27
|
}
|
|
28
|
+
export interface Allure2GlobalError {
|
|
29
|
+
timestamp?: number;
|
|
30
|
+
message?: string;
|
|
31
|
+
trace?: string;
|
|
32
|
+
actual?: string;
|
|
33
|
+
expected?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface Allure2GlobalAttachment extends Allure2Attachment {
|
|
36
|
+
source: string;
|
|
37
|
+
type: string;
|
|
38
|
+
timestamp?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface Allure2GlobalsData {
|
|
41
|
+
errors: Allure2GlobalError[];
|
|
42
|
+
attachments: Allure2GlobalAttachment[];
|
|
43
|
+
}
|
|
28
44
|
export interface Allure2Step {
|
|
29
45
|
name: string;
|
|
30
46
|
time: Allure2Time;
|
|
@@ -60,7 +76,7 @@ export interface Allure2TestResult {
|
|
|
60
76
|
retriesCount: number;
|
|
61
77
|
retriesStatusChange: boolean;
|
|
62
78
|
beforeStages: Allure2StageResult[];
|
|
63
|
-
testStage: Allure2StageResult;
|
|
79
|
+
testStage: Allure2StageResult | null;
|
|
64
80
|
afterStages: Allure2StageResult[];
|
|
65
81
|
labels: Allure2Label[];
|
|
66
82
|
parameters: Allure2Parameter[];
|
|
@@ -73,7 +89,8 @@ export interface Allure2TestResult {
|
|
|
73
89
|
[key: string]: any;
|
|
74
90
|
};
|
|
75
91
|
}
|
|
76
|
-
|
|
92
|
+
type StatisticKey = "failed" | "broken" | "skipped" | "passed" | "unknown" | "total";
|
|
93
|
+
export declare const statisticKeys: StatisticKey[];
|
|
77
94
|
export interface GroupTime {
|
|
78
95
|
start?: number;
|
|
79
96
|
stop?: number;
|
|
@@ -113,7 +130,7 @@ export interface Allure2RetryItem {
|
|
|
113
130
|
}
|
|
114
131
|
export interface Allure2HistoryItem {
|
|
115
132
|
uid: string;
|
|
116
|
-
reportUrl
|
|
133
|
+
reportUrl?: string;
|
|
117
134
|
status: Allure2Status;
|
|
118
135
|
statusDetails?: string;
|
|
119
136
|
time: Allure2Time;
|
|
@@ -128,6 +145,25 @@ export interface Allure2HistoryTrendItem {
|
|
|
128
145
|
reportUrl?: string;
|
|
129
146
|
reportName?: string;
|
|
130
147
|
}
|
|
148
|
+
export interface Allure2LegacyHistoryTrendItem extends Omit<Allure2HistoryTrendItem, "data"> {
|
|
149
|
+
data?: Statistic;
|
|
150
|
+
statistic?: Statistic;
|
|
151
|
+
}
|
|
152
|
+
export interface Allure2TrendItem<T extends Record<string, number> = Record<string, number>> {
|
|
153
|
+
data: T;
|
|
154
|
+
buildOrder?: number;
|
|
155
|
+
reportUrl?: string;
|
|
156
|
+
reportName?: string;
|
|
157
|
+
}
|
|
158
|
+
export type Allure2DurationTrendItem = Allure2TrendItem<{
|
|
159
|
+
duration: number;
|
|
160
|
+
}>;
|
|
161
|
+
export type Allure2RetryTrendItem = Allure2TrendItem<{
|
|
162
|
+
run: number;
|
|
163
|
+
retry: number;
|
|
164
|
+
}>;
|
|
165
|
+
export type Allure2CategoriesTrendItem = Allure2TrendItem<Record<string, number>>;
|
|
166
|
+
export type Allure2LegacyHistory = Record<string, Allure2HistoryData>;
|
|
131
167
|
export type Allure2Options = {
|
|
132
168
|
reportName?: string;
|
|
133
169
|
singleFile?: boolean;
|
|
@@ -145,3 +181,4 @@ export interface Allure2ExecutorInfo {
|
|
|
145
181
|
reportName: string;
|
|
146
182
|
reportUrl: string;
|
|
147
183
|
}
|
|
184
|
+
export {};
|
package/dist/model.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const statisticKeys = ["failed", "broken", "
|
|
1
|
+
export const statisticKeys = ["failed", "broken", "skipped", "passed", "unknown", "total"];
|
|
2
2
|
export const severityValues = ["blocker", "critical", "normal", "minor", "trivial"];
|
package/dist/plugin.js
CHANGED
|
@@ -6,7 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _Allure2Plugin_generate;
|
|
7
7
|
import { createPluginSummary, preciseTreeLabels, } from "@allurereport/plugin-api";
|
|
8
8
|
import { convertTestResult } from "./converters.js";
|
|
9
|
-
import { generateAttachmentsData, generateCategoriesData, generateDefaultWidgetData,
|
|
9
|
+
import { generateAttachmentsData, generateCategoriesData, generateCategoriesTrendData, generateDefaultWidgetData, generateDurationTrendData, generateEnvironmentJson, generateExecutorJson, generateGlobalsData, generateHistoryTrendData, generatePackagesData, generateRetryTrendData, generateStaticFiles, generateSummaryJson, generateTestResults, generateTimelineData, generateTree, } from "./generators.js";
|
|
10
10
|
import { InMemoryReportDataWriter, ReportFileDataWriter } from "./writer.js";
|
|
11
11
|
export class Allure2Plugin {
|
|
12
12
|
constructor(options = {}) {
|
|
@@ -16,7 +16,15 @@ export class Allure2Plugin {
|
|
|
16
16
|
const writer = singleFile ? new InMemoryReportDataWriter() : new ReportFileDataWriter(context.reportFiles);
|
|
17
17
|
const attachmentLinks = await store.allAttachments();
|
|
18
18
|
const attachmentMap = await generateAttachmentsData(writer, attachmentLinks, (id) => store.attachmentContentById(id));
|
|
19
|
+
const [globalErrors, globalAttachments] = await Promise.all([
|
|
20
|
+
store.allGlobalErrors(),
|
|
21
|
+
store.allGlobalAttachments(),
|
|
22
|
+
]);
|
|
23
|
+
const globalAttachmentTimestamps = (await store.metadataByKey("allure2_global_attachment_timestamps")) ?? {};
|
|
24
|
+
const globalErrorTimestamps = (await store.metadataByKey("allure2_global_error_timestamps")) ?? [];
|
|
25
|
+
await generateGlobalsData(writer, globalErrors, globalAttachments, attachmentMap, globalAttachmentTimestamps, globalErrorTimestamps);
|
|
19
26
|
const categories = (await store.metadataByKey("allure2_categories")) ?? [];
|
|
27
|
+
const legacyHistory = (await store.metadataByKey("allure2_history")) ?? {};
|
|
20
28
|
const environmentItems = (await store.metadataByKey("allure_environment")) ?? [];
|
|
21
29
|
const tests = await store.allTestResults({ includeRetries: true });
|
|
22
30
|
const related = await store.relatedByTestResultIds(tests.map(({ id }) => id));
|
|
@@ -31,6 +39,7 @@ export class Allure2Plugin {
|
|
|
31
39
|
categories,
|
|
32
40
|
retries,
|
|
33
41
|
history,
|
|
42
|
+
legacyHistory: value.historyId ? legacyHistory[value.historyId] : undefined,
|
|
34
43
|
}, value);
|
|
35
44
|
allTr.push(allure2TestResult);
|
|
36
45
|
}
|
|
@@ -51,10 +60,16 @@ export class Allure2Plugin {
|
|
|
51
60
|
await generateEnvironmentJson(writer, environmentItems);
|
|
52
61
|
const executor = await store.metadataByKey("allure2_executor");
|
|
53
62
|
const historyDataPoints = await store.allHistoryDataPoints();
|
|
63
|
+
const historyTrend = (await store.metadataByKey("allure2_history_trend")) ?? [];
|
|
64
|
+
const durationTrend = (await store.metadataByKey("allure2_duration_trend")) ?? [];
|
|
65
|
+
const retryTrend = (await store.metadataByKey("allure2_retry_trend")) ?? [];
|
|
66
|
+
const categoriesTrend = (await store.metadataByKey("allure2_categories_trend")) ?? [];
|
|
54
67
|
await generateExecutorJson(writer, executor);
|
|
55
68
|
await generateDefaultWidgetData(writer, displayedTr, "duration.json", "status-chart.json", "severity.json");
|
|
56
|
-
await
|
|
57
|
-
await
|
|
69
|
+
await generateHistoryTrendData(writer, reportName, displayedTr, historyDataPoints, historyTrend, executor);
|
|
70
|
+
await generateDurationTrendData(writer, displayedTr, durationTrend, executor);
|
|
71
|
+
await generateRetryTrendData(writer, allTr, retryTrend, executor);
|
|
72
|
+
await generateCategoriesTrendData(writer, allTr, categoriesTrend, executor);
|
|
58
73
|
const reportDataFiles = singleFile ? writer.reportFiles() : [];
|
|
59
74
|
await generateStaticFiles({
|
|
60
75
|
allureVersion: context.allureVersion,
|
|
Binary file
|
package/dist/tree.d.ts
CHANGED
package/dist/tree.js
CHANGED
|
@@ -15,6 +15,7 @@ const createLeaf = (endNode, test) => {
|
|
|
15
15
|
newPassed: test.newPassed,
|
|
16
16
|
retriesCount: test.retriesCount,
|
|
17
17
|
retriesStatusChange: test.retriesStatusChange,
|
|
18
|
+
retry: test.retry,
|
|
18
19
|
parameters: test.parameters.filter((p) => p.value).map((p) => p.value),
|
|
19
20
|
tags: test.extra.tags ?? [],
|
|
20
21
|
};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Statistic } from "@allurereport/core-api";
|
|
2
2
|
import type { Allure2Status, Allure2TestResult, GroupTime } from "./model.js";
|
|
3
3
|
import type { TreeGroup } from "./tree.js";
|
|
4
|
+
export declare const createStatistic: (source?: Partial<Statistic>) => Statistic;
|
|
4
5
|
export declare const updateStatistic: (statistic: Statistic, test: {
|
|
5
6
|
status: Allure2Status;
|
|
6
7
|
}) => undefined;
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { statisticKeys } from "./model.js";
|
|
2
|
+
export const createStatistic = (source = {}) => ({
|
|
3
|
+
failed: 0,
|
|
4
|
+
broken: 0,
|
|
5
|
+
skipped: 0,
|
|
6
|
+
passed: 0,
|
|
7
|
+
unknown: 0,
|
|
8
|
+
...source,
|
|
9
|
+
total: source.total ??
|
|
10
|
+
(source.failed ?? 0) + (source.broken ?? 0) + (source.skipped ?? 0) + (source.passed ?? 0) + (source.unknown ?? 0),
|
|
11
|
+
});
|
|
2
12
|
export const updateStatistic = (statistic, test) => {
|
|
3
13
|
statistic[test.status] = (statistic[test.status] ?? 0) + 1;
|
|
4
14
|
statistic.total = (statistic.total ?? 0) + 1;
|
|
@@ -22,7 +32,7 @@ export const updateTime = (time, test) => {
|
|
|
22
32
|
}
|
|
23
33
|
};
|
|
24
34
|
export const calculateStatisticByLeafs = (treeGroup) => {
|
|
25
|
-
const current =
|
|
35
|
+
const current = createStatistic();
|
|
26
36
|
treeGroup.children.forEach((child) => {
|
|
27
37
|
if ("children" in child) {
|
|
28
38
|
const childGroup = child;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-allure2",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "The
|
|
3
|
+
"version": "3.17.0",
|
|
4
|
+
"description": "The Allure 2-compatible HTML report",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
7
7
|
"html",
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"author": "Qameta Software",
|
|
14
14
|
"repository": "https://github.com/allure-framework/allure3",
|
|
15
15
|
"files": [
|
|
16
|
-
"./dist"
|
|
17
|
-
"./static"
|
|
16
|
+
"./dist"
|
|
18
17
|
],
|
|
19
18
|
"type": "module",
|
|
20
19
|
"main": "./dist/index.js",
|
|
@@ -24,19 +23,19 @@
|
|
|
24
23
|
".": "./dist/index.js"
|
|
25
24
|
},
|
|
26
25
|
"scripts": {
|
|
27
|
-
"build": "run clean && tsc --project ./tsconfig.json",
|
|
26
|
+
"build": "run clean && tsc --project ./tsconfig.json && node ../../scripts/pack-report-static.mjs ../web-allure2/dist/multi ./dist/static/report.tar",
|
|
28
27
|
"clean": "rimraf ./dist",
|
|
29
28
|
"test": "rimraf ./out && vitest run",
|
|
30
29
|
"lint": "oxlint --import-plugin src test features stories",
|
|
31
30
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"@allurereport/core-api": "3.
|
|
35
|
-
"@allurereport/plugin-api": "3.
|
|
36
|
-
"find-up": "^8.0.0",
|
|
33
|
+
"@allurereport/core-api": "3.17.0",
|
|
34
|
+
"@allurereport/plugin-api": "3.17.0",
|
|
37
35
|
"handlebars": "^4.7.9"
|
|
38
36
|
},
|
|
39
37
|
"devDependencies": {
|
|
38
|
+
"@allurereport/web-allure2": "3.17.0",
|
|
40
39
|
"@types/node": "^20",
|
|
41
40
|
"@vitest/runner": "^2",
|
|
42
41
|
"allure-js-commons": "^3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_allurereport_web_allure2=self.webpackChunk_allurereport_web_allure2||[]).push([[154],{154:function(n){n.exports='{\n "chart": {\n "duration": {\n "empty": "没有信息",\n "name": "耗时"\n },\n "severity": {\n "name": "优先级"\n },\n "status": {\n "name": "状态"\n },\n "trend": {\n "empty": "没有信息"\n }\n },\n "component": {\n "statusToggle": {\n "hideCases": "隐藏{{status}}状态的用例",\n "showCases": "显示{{status}}状态的用例"\n },\n "tree": {\n "empty": "没有记录",\n "filter": "通过用例状态过滤",\n "filtered": {\n "shown": "显示{{count}}个",\n "total": "共{{count}}个用例",\n "total_plural": "共{{count}}个用例"\n },\n "groups": "开关测试套信息",\n "time": {\n "max": {\n "name": "最长",\n "tooltip": "好使最长的用例"\n },\n "sum": {\n "name": "合并",\n "tooltip": "所有用例耗时之和"\n },\n "total": {\n "name": "整体",\n "tooltip": "从首个用例的开始时间到最后一个用例的结束时间"\n }\n },\n "unknown": "空小组"\n },\n "widgetStatus": {\n "showAll": "显示所有",\n "total": "总共{{count}}项",\n "total_plural": "总共{{count}}项"\n }\n },\n "controls": {\n "backto": "返回",\n "clipboard": "复制到剪贴板",\n "collapse": "折叠",\n "expand": "展开",\n "fullscreen": "全屏",\n "language": "切换地区语言"\n },\n "errors": {\n "missedAttachment": "没有找到附件",\n "notFound": "没有找到"\n },\n "marks": {\n "flaky": "不稳定",\n "newBroken": "新的故障",\n "newFailed": "新的失败",\n "newPassed": "新的通过",\n "retriesStatusChange": "重试后状态改变"\n },\n "sorter": {\n "duration": "用时",\n "name": "名称",\n "status": "状态"\n },\n "status": {\n "broken": "故障",\n "failed": "失败",\n "passed": "通过",\n "skipped": "跳过",\n "unknown": "未知"\n },\n "tab": {\n "categories": {\n "name": "类别"\n },\n "graph": {\n "name": "图表"\n },\n "overview": {\n "name": "总览"\n },\n "suites": {\n "name": "测试套"\n },\n "timeline": {\n "name": "时间刻度",\n "selected": "{{count}}个测试用例({{percent}}%)执行时间超过{{duration}}",\n "selected_plural": "{{count}}个测试用例({{percent}}%)执行时间超过{{duration}}"\n }\n },\n "testResult": {\n "categories": {\n "name": "类别"\n },\n "description": {\n "name": "描述"\n },\n "duration": {\n "name": "耗时"\n },\n "execution": {\n "body": "测试步骤",\n "name": "执行",\n "setup": "前置",\n "teardown": "后置"\n },\n "history": {\n "name": "历史",\n "successRate": "成功率"\n },\n "links": {\n "name": "链接"\n },\n "overview": {\n "name": "总览"\n },\n "owner": {\n "name": "作者"\n },\n "parameters": {\n "name": "参数"\n },\n "retries": {\n "name": "重试次数"\n },\n "severity": {\n "name": "优先级"\n },\n "stats": {\n "count": {\n "attachments": "{{count}}个附件",\n "attachments_plural": "{{count}}个附件",\n "parameters": "{{count}}个参数",\n "parameters_plural": "{{count}}个参数",\n "steps": "{{count}}个步骤",\n "steps_plural": "{{count}}个步骤"\n }\n },\n "status": {\n "empty": "状态详情为空",\n "trace": "展示堆栈"\n },\n "tags": {\n "name": "标签"\n }\n },\n "widget": {\n "categories": {\n "name": "类别"\n },\n "environment": {\n "empty": "没有环境变量",\n "name": "环境",\n "showAll": "显示所有"\n },\n "executors": {\n "empty": "没有运行器的信息",\n "name": "运行器",\n "unknown": "未知"\n },\n "launches": {\n "empty": "没有用例启动执行的信息",\n "name": "启动"\n },\n "suites": {\n "name": "测试套"\n },\n "summary": {\n "aggregatedName": "汇总报告",\n "launches": "启动",\n "launches_plural": "启动",\n "testResults": "测试用例",\n "testResults_plural": "测试用例"\n },\n "trend": {\n "name": "趋势"\n }\n }\n}\n'}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_allurereport_web_allure2=self.webpackChunk_allurereport_web_allure2||[]).push([[216],{7216:function(n){n.exports='{\n "chart": {\n "duration": {\n "empty": "Brak czegokolwiek do pokazania",\n "name": "Czas trwania"\n },\n "severity": {\n "name": "Ważność"\n },\n "status": {\n "name": "Status"\n },\n "trend": {\n "empty": "Brak czegokolwiek do pokazania"\n }\n },\n "component": {\n "statusToggle": {\n "hideCases": "Ukryj rezultaty testów ze statusem {{status}}",\n "showCases": "Pokaż rezultaty testów ze statusem {{status}}"\n },\n "tree": {\n "download": "Pobierz CSV",\n "empty": "Brak elementów",\n "filter": "Filtrowanie według statusu",\n "filter-marks": "Filtrowanie według oznaczenia",\n "filtered": {\n "shown_0": "{{count}} pokazany",\n "shown_1": "{{count}} pokazane",\n "shown_2": "{{count}} pokazanych",\n "total_0": "{{count}} rezultat testu",\n "total_1": "{{count}} rezultaty testów",\n "total_2": "{{count}} rezultatów testów"\n },\n "groups": "Przełącz informacje o grupach",\n "time": {\n "max": {\n "name": "Najdłuższy",\n "tooltip": "Najdłuższy czas trwania"\n },\n "sum": {\n "name": "Suma",\n "tooltip": "Suma czasów trwania wszystkich testów"\n },\n "total": {\n "name": "Całkowity",\n "tooltip": "Czas od uruchomienia pierwszego testu do zakończenia ostatniego testu"\n }\n },\n "unknown": "<Pusty>"\n },\n "widgetStatus": {\n "showAll": "Pokaż wszystko",\n "total_0": "Razem {{count}} pozycja",\n "total_1": "Razem {{count}} pozycje",\n "total_2": "Razem {{count}} pozycji"\n }\n },\n "controls": {\n "backto": "Powrót do",\n "clipboard": "Zapisz do schowka",\n "clipboardError": "Nie można skopiować do schowka. Najprawdopodobniej twoja przeglądarka nie obsługuje tej funkcji",\n "clipboardSuccess": "Skopiowano pomyślnie",\n "collapse": "Zwiń",\n "expand": "Rozwiń",\n "fullscreen": "Pełny ekran",\n "language": "Zmień język"\n },\n "errors": {\n "missedAttachment": "Nie znaleziono załącznika",\n "notFound": "Nie znaleziono"\n },\n "marks": {\n "flaky": "Niestabilny",\n "newBroken": "Nowy uszkodzony",\n "newFailed": "Nowy nieudany",\n "newPassed": "Nowy udany",\n "retriesStatusChange": "Status zmieniony po ponownej próbie"\n },\n "sorter": {\n "duration": "czas trwania",\n "name": "nazwa",\n "order": "kolejność",\n "status": "status"\n },\n "status": {\n "broken": "Uszkodzony",\n "failed": "Nieudany",\n "passed": "Pomyślny",\n "skipped": "Pominięty",\n "unknown": "Nieznany"\n },\n "tab": {\n "categories": {\n "name": "Kategorie"\n },\n "graph": {\n "name": "Wykresy"\n },\n "overview": {\n "name": "Podsumowanie"\n },\n "suites": {\n "name": "Zestawy"\n },\n "timeline": {\n "name": "Oś czasowa",\n "selected_0": "{{count}} wybrany test ({{percent}}%) z czasem trwania powyżej {{duration}}",\n "selected_1": "{{count}} wybrane testy ({{percent}}%) z czasem trwania powyżej {{duration}}",\n "selected_2": "{{count}} wybranych testów ({{percent}}%) z czasem trwania powyżej {{duration}}"\n }\n },\n "testResult": {\n "categories": {\n "name": "Kategorie"\n },\n "description": {\n "name": "Opis"\n },\n "duration": {\n "name": "Czas trwania"\n },\n "execution": {\n "body": "Ciało testu",\n "name": "Wykonanie",\n "setup": "Przygotowanie",\n "teardown": "Zakończenie"\n },\n "history": {\n "name": "Historia",\n "successRate": "Współczynnik powodzenia"\n },\n "links": {\n "name": "Odnośniki"\n },\n "overview": {\n "name": "Podsumowanie"\n },\n "owner": {\n "name": "Właściciel"\n },\n "parameters": {\n "name": "Parametery"\n },\n "retries": {\n "empty": "Brak dostępnych informacji o powtórzeniach testów",\n "name": "Powtórzenia"\n },\n "severity": {\n "name": "Ważność",\n "blocker": "bloker",\n "critical": "krytyczna",\n "normal": "zwyczajna",\n "minor": "niewielka",\n "trivial": "minimalna"\n },\n "stats": {\n "count": {\n "attachments_0": "{{count}} załącznik",\n "attachments_1": "{{count}} załączniki",\n "attachments_2": "{{count}} załączników",\n "parameters_0": "{{count}} parametr",\n "parameters_1": "{{count}} parametry",\n "parameters_2": "{{count}} parametrów",\n "steps": "{{count}} podetap",\n "steps_plural": "{{count}} podetapy"\n }\n },\n "status": {\n "empty": "Puste szczegóły statusu",\n "trace": "Pokaż ślady"\n },\n "tags": {\n "name": "Tagi"\n }\n },\n "widget": {\n "categories": {\n "name": "Kategorie"\n },\n "categoriesTrend": {\n "name": "Trend kategorii"\n },\n "durationTrend": {\n "name": "Trend czasu trwania"\n },\n "environment": {\n "empty": "Brak zmiennych środowiskowych",\n "name": "Środowisko",\n "showAll": "Pokaż wszystkie"\n },\n "executors": {\n "empty": "Brak informacji o wykonawcach testów",\n "name": "Wykonawcy",\n "unknown": "Nieznany"\n },\n "launches": {\n "empty": "Brak informacji o uruchomieniach",\n "name": "Uruchomienia"\n },\n "retryTrend": {\n "name": "Trend powtórzeń"\n },\n "suites": {\n "name": "Zestawy"\n },\n "summary": {\n "aggregatedName": "Raport zbiorczy",\n "launches_0": "uruchomienie",\n "launches_1": "uruchomienia",\n "launches_3": "uruchomień",\n "testResults_0": "przypadek testowy",\n "testResults_1": "przypadki testowe",\n "testResults_3": "przypadków testowych"\n },\n "trend": {\n "name": "Trend"\n }\n }\n}\n'}}]);
|