@allurereport/plugin-awesome 3.14.3 → 3.16.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/dist/generators.d.ts +5 -1
- package/dist/generators.js +31 -6
- package/dist/plugin.js +20 -3
- package/package.json +6 -6
package/dist/generators.d.ts
CHANGED
|
@@ -33,7 +33,11 @@ export declare const generateGlobals: (writer: AwesomeDataWriter, payload: {
|
|
|
33
33
|
globalErrorsByEnv?: Record<string, PluginGlobalError[]>;
|
|
34
34
|
contentFunction: (id: string) => Promise<ResultFile | undefined>;
|
|
35
35
|
}) => Promise<void>;
|
|
36
|
-
export declare const generateQualityGateResults: (writer: AwesomeDataWriter, qualityGateResults?: Record<string, QualityGateValidationResult[]
|
|
36
|
+
export declare const generateQualityGateResults: (writer: AwesomeDataWriter, qualityGateResults?: Record<string, QualityGateValidationResult[]>, options?: {
|
|
37
|
+
tests?: AwesomeTestResult[];
|
|
38
|
+
labels?: string[];
|
|
39
|
+
appendTitlePath?: boolean;
|
|
40
|
+
}) => Promise<void>;
|
|
37
41
|
export declare const generateStaticFiles: (payload: AwesomeOptions & {
|
|
38
42
|
id: string;
|
|
39
43
|
allureVersion: string;
|
package/dist/generators.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readFile, readdir } from "node:fs/promises";
|
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { basename, dirname, join } from "node:path";
|
|
5
5
|
import { defaultChartsConfig } from "@allurereport/charts-api";
|
|
6
|
-
import { compareBy, createBaseUrlScript, createFontLinkTag, createReportDataScript, stringifyForInlineScript, createScriptTag, createStylesLinkTag, incrementStatistic, joinPosixPath, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
6
|
+
import { appLoaderFaviconDataUri, appLoaderStyles, compareBy, createAppLoaderMarkup, createBaseUrlScript, createFaviconLinkTag, createFontLinkTag, createReportDataScript, stringifyForInlineScript, createScriptTag, createStylesLinkTag, incrementStatistic, joinPosixPath, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
7
7
|
import { collapseTreeGroups, createTreeByLabels, createTreeByLabelsAndTitlePath, createTreeByTitlePath, preciseTreeLabels, processTree, } from "@allurereport/plugin-api";
|
|
8
8
|
import { generateCharts, getPieChartValues } from "@allurereport/web-commons";
|
|
9
9
|
import Handlebars from "handlebars";
|
|
@@ -14,13 +14,15 @@ const template = `<!DOCTYPE html>
|
|
|
14
14
|
<head>
|
|
15
15
|
<meta charset="utf-8">
|
|
16
16
|
<title> {{ reportName }} </title>
|
|
17
|
-
|
|
17
|
+
${createFaviconLinkTag(appLoaderFaviconDataUri)}
|
|
18
|
+
${appLoaderStyles}
|
|
18
19
|
{{{ headTags }}}
|
|
19
20
|
<script>
|
|
20
21
|
window.allureReportOptions = {{{ reportOptions }}}
|
|
21
22
|
</script>
|
|
22
23
|
</head>
|
|
23
24
|
<body>
|
|
25
|
+
${createAppLoaderMarkup()}
|
|
24
26
|
<div id="app"></div>
|
|
25
27
|
${createBaseUrlScript()}
|
|
26
28
|
<script>
|
|
@@ -84,7 +86,9 @@ export const generateTestResults = async (_writer, store, trs, options = {}) =>
|
|
|
84
86
|
const related = await store.relatedByTestResultIds(trs.map(({ id }) => id));
|
|
85
87
|
for (const tr of trs) {
|
|
86
88
|
const trFixtures = related.fixturesByTrId.get(tr.id) ?? [];
|
|
87
|
-
const convertedTrFixtures = trFixtures
|
|
89
|
+
const convertedTrFixtures = [...trFixtures]
|
|
90
|
+
.sort(nullsLast(compareBy("start", ordinal())))
|
|
91
|
+
.map(convertFixtureResult);
|
|
88
92
|
const convertedTr = convertTestResult(tr, {
|
|
89
93
|
hideLabels: options.hideLabels,
|
|
90
94
|
});
|
|
@@ -186,6 +190,10 @@ export const getRunSummary = (testResults) => {
|
|
|
186
190
|
: undefined;
|
|
187
191
|
};
|
|
188
192
|
export const generateTree = async (writer, treeFilename, labels, tests, options) => {
|
|
193
|
+
const tree = generateTreeData(labels, tests, options);
|
|
194
|
+
await writer.writeWidget(treeFilename, tree);
|
|
195
|
+
};
|
|
196
|
+
const generateTreeData = (labels, tests, options) => {
|
|
189
197
|
const visibleTests = tests.filter((test) => !test.isRetry);
|
|
190
198
|
const { appendTitlePath } = options || {};
|
|
191
199
|
let tree;
|
|
@@ -202,7 +210,7 @@ export const generateTree = async (writer, treeFilename, labels, tests, options)
|
|
|
202
210
|
sort: nullsLast(compareBy("start", ordinal())),
|
|
203
211
|
transform: (leaf, idx) => ({ ...leaf, groupOrder: idx + 1 }),
|
|
204
212
|
});
|
|
205
|
-
|
|
213
|
+
return tree;
|
|
206
214
|
};
|
|
207
215
|
const buildTreeByLabels = (tests, labels) => {
|
|
208
216
|
return createTreeByLabels(tests, labels, leafFactory, undefined, (group, leaf) => {
|
|
@@ -371,8 +379,25 @@ export const generateGlobals = async (writer, payload) => {
|
|
|
371
379
|
}
|
|
372
380
|
await writer.writeWidget("globals.json", globals);
|
|
373
381
|
};
|
|
374
|
-
export const generateQualityGateResults = async (writer, qualityGateResults = {}) => {
|
|
375
|
-
|
|
382
|
+
export const generateQualityGateResults = async (writer, qualityGateResults = {}, options = {}) => {
|
|
383
|
+
const { tests = [], labels = [], appendTitlePath } = options;
|
|
384
|
+
const testsById = new Map(tests.map((test) => [test.id, test]));
|
|
385
|
+
const resultsWithTrees = Object.fromEntries(Object.entries(qualityGateResults).map(([environment, results]) => [
|
|
386
|
+
environment,
|
|
387
|
+
results.map((result) => {
|
|
388
|
+
const relatedTests = [...new Set(result.testResults ?? [])]
|
|
389
|
+
.map((testResultId) => testsById.get(testResultId))
|
|
390
|
+
.filter((test) => Boolean(test));
|
|
391
|
+
if (relatedTests.length === 0) {
|
|
392
|
+
return result;
|
|
393
|
+
}
|
|
394
|
+
return {
|
|
395
|
+
...result,
|
|
396
|
+
testResultsTree: generateTreeData(labels, relatedTests, { appendTitlePath }),
|
|
397
|
+
};
|
|
398
|
+
}),
|
|
399
|
+
]));
|
|
400
|
+
await writer.writeWidget("quality-gate.json", resultsWithTrees);
|
|
376
401
|
};
|
|
377
402
|
export const generateStaticFiles = async (payload) => {
|
|
378
403
|
const { id, reportName = "Allure Report", reportLanguage = "en", singleFile, logo = "", theme = "auto", groupBy, reportFiles, reportDataFiles, reportUuid, allureVersion, layout = "base", defaultSection = "", ci, executor, runSummary, stepTreeExpansion, defaultSortBy, } = payload;
|
package/dist/plugin.js
CHANGED
|
@@ -68,9 +68,22 @@ export class AwesomePlugin {
|
|
|
68
68
|
}
|
|
69
69
|
envIdByTrId.set(tr.id, environmentId);
|
|
70
70
|
}));
|
|
71
|
+
const trsByEnvId = new Map();
|
|
72
|
+
for (const tr of allTrs) {
|
|
73
|
+
const environmentId = envIdByTrId.get(tr.id);
|
|
74
|
+
if (!environmentId) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const group = trsByEnvId.get(environmentId);
|
|
78
|
+
if (group) {
|
|
79
|
+
group.push(tr);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
trsByEnvId.set(environmentId, [tr]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
71
85
|
await Promise.all(environments.map(async ({ id }) => {
|
|
72
|
-
|
|
73
|
-
envStatistics.set(id, await statisticByTestResults(store, envTrs));
|
|
86
|
+
envStatistics.set(id, await statisticByTestResults(store, trsByEnvId.get(id) ?? []));
|
|
74
87
|
}));
|
|
75
88
|
await generateStatistic(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
|
|
76
89
|
stats: statistics,
|
|
@@ -126,7 +139,11 @@ export class AwesomePlugin {
|
|
|
126
139
|
if (attachments?.length) {
|
|
127
140
|
await generateAttachmentsFiles(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), attachments, (id) => store.attachmentContentById(id));
|
|
128
141
|
}
|
|
129
|
-
await generateQualityGateResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), qualityGateResults
|
|
142
|
+
await generateQualityGateResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), qualityGateResults, {
|
|
143
|
+
tests: convertedTrs,
|
|
144
|
+
labels: treeLabels,
|
|
145
|
+
appendTitlePath,
|
|
146
|
+
});
|
|
130
147
|
await generateGlobals(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), {
|
|
131
148
|
globalAttachments,
|
|
132
149
|
globalAttachmentsByEnv,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-awesome",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Allure Awesome Plugin – brand new HTML report with modern design and new features",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/charts-api": "3.
|
|
34
|
-
"@allurereport/core-api": "3.
|
|
35
|
-
"@allurereport/plugin-api": "3.
|
|
36
|
-
"@allurereport/web-awesome": "3.
|
|
37
|
-
"@allurereport/web-commons": "3.
|
|
33
|
+
"@allurereport/charts-api": "3.16.0",
|
|
34
|
+
"@allurereport/core-api": "3.16.0",
|
|
35
|
+
"@allurereport/plugin-api": "3.16.0",
|
|
36
|
+
"@allurereport/web-awesome": "3.16.0",
|
|
37
|
+
"@allurereport/web-commons": "3.16.0",
|
|
38
38
|
"d3-shape": "^3.2.0",
|
|
39
39
|
"handlebars": "^4.7.9",
|
|
40
40
|
"markdown-it": "^14.2.0"
|