@allurereport/plugin-awesome 3.0.0-beta.15 → 3.0.0-beta.16
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/charts.d.ts +4 -11
- package/dist/charts.js +7 -16
- package/dist/converters.js +1 -0
- package/dist/generators.d.ts +1 -0
- package/dist/generators.js +18 -18
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/model.d.ts +1 -0
- package/dist/plugin.js +1 -0
- package/package.json +7 -7
package/dist/charts.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HistoryDataPoint, SeverityLevel, Statistic, TestResult, TestStatus } from "@allurereport/core-api";
|
|
2
2
|
import type { AllureStore, PluginContext } from "@allurereport/plugin-api";
|
|
3
|
+
import { ChartDataType, ChartMode, ChartType } from "@allurereport/web-commons";
|
|
3
4
|
import type { PieArcDatum } from "d3-shape";
|
|
4
5
|
import type { AwesomeOptions } from "./model.js";
|
|
5
6
|
import type { AwesomeDataWriter } from "./writer.js";
|
|
@@ -7,15 +8,6 @@ export type BasePieSlice = Pick<PieSlice, "status" | "count">;
|
|
|
7
8
|
export declare const d3Arc: import("d3-shape").Arc<any, PieArcDatum<BasePieSlice>>;
|
|
8
9
|
export declare const d3Pie: import("d3-shape").Pie<any, BasePieSlice>;
|
|
9
10
|
export declare const getPercentage: (value: number, total: number) => number;
|
|
10
|
-
export declare enum ChartType {
|
|
11
|
-
Trend = "trend",
|
|
12
|
-
Pie = "pie"
|
|
13
|
-
}
|
|
14
|
-
export declare enum ChartData {
|
|
15
|
-
Status = "status",
|
|
16
|
-
Severity = "severity"
|
|
17
|
-
}
|
|
18
|
-
export type ChartMode = "raw" | "percent";
|
|
19
11
|
export type ChartId = string;
|
|
20
12
|
export type ExecutionIdFn = (executionOrder: number) => string;
|
|
21
13
|
export type ExecutionNameFn = (executionOrder: number) => string;
|
|
@@ -25,7 +17,7 @@ export type TrendMetadataFnOverrides = {
|
|
|
25
17
|
};
|
|
26
18
|
export type TrendChartOptions = {
|
|
27
19
|
type: ChartType.Trend;
|
|
28
|
-
dataType:
|
|
20
|
+
dataType: ChartDataType;
|
|
29
21
|
mode?: ChartMode;
|
|
30
22
|
title?: string;
|
|
31
23
|
limit?: number;
|
|
@@ -50,7 +42,8 @@ export type TrendSlice<Metadata extends BaseMetadata> = {
|
|
|
50
42
|
};
|
|
51
43
|
export type GenericTrendChartData<Metadata extends BaseMetadata, SeriesType extends string> = {
|
|
52
44
|
type: ChartType.Trend;
|
|
53
|
-
dataType:
|
|
45
|
+
dataType: ChartDataType;
|
|
46
|
+
mode: ChartMode;
|
|
54
47
|
title?: string;
|
|
55
48
|
points: Record<TrendPointId, TrendPoint>;
|
|
56
49
|
slices: Record<TrendSliceId, TrendSlice<Metadata>>;
|
package/dist/charts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPieChartDataDashboard, getSeverityTrendData, getStatusTrendData,
|
|
1
|
+
import { ChartDataType, ChartMode, ChartType, DEFAULT_CHART_HISTORY_LIMIT, getPieChartDataDashboard, getSeverityTrendData, getStatusTrendData, } from "@allurereport/web-commons";
|
|
2
2
|
import { randomUUID } from "crypto";
|
|
3
3
|
import { arc, pie } from "d3-shape";
|
|
4
4
|
export const d3Arc = arc().innerRadius(40).outerRadius(50).cornerRadius(2).padAngle(0.03);
|
|
@@ -7,16 +7,6 @@ export const d3Pie = pie()
|
|
|
7
7
|
.padAngle(0.03)
|
|
8
8
|
.sortValues((a, b) => a - b);
|
|
9
9
|
export const getPercentage = (value, total) => Math.floor((value / total) * 10000) / 100;
|
|
10
|
-
export var ChartType;
|
|
11
|
-
(function (ChartType) {
|
|
12
|
-
ChartType["Trend"] = "trend";
|
|
13
|
-
ChartType["Pie"] = "pie";
|
|
14
|
-
})(ChartType || (ChartType = {}));
|
|
15
|
-
export var ChartData;
|
|
16
|
-
(function (ChartData) {
|
|
17
|
-
ChartData["Status"] = "status";
|
|
18
|
-
ChartData["Severity"] = "severity";
|
|
19
|
-
})(ChartData || (ChartData = {}));
|
|
20
10
|
export const createEmptyStats = (items) => items.reduce((acc, item) => ({ ...acc, [item]: 0 }), {});
|
|
21
11
|
export const createEmptySeries = (items) => items.reduce((acc, item) => ({ ...acc, [item]: [] }), {});
|
|
22
12
|
export const normalizeStatistic = (statistic, itemType) => {
|
|
@@ -52,7 +42,7 @@ const calculatePercentValues = (stats, executionId, itemType) => {
|
|
|
52
42
|
const value = stats[item] ?? 0;
|
|
53
43
|
points[pointId] = {
|
|
54
44
|
x: executionId,
|
|
55
|
-
y:
|
|
45
|
+
y: value / total,
|
|
56
46
|
};
|
|
57
47
|
series[item].push(pointId);
|
|
58
48
|
});
|
|
@@ -83,10 +73,10 @@ export const mergeTrendDataGeneric = (trendData, trendDataPart, itemType) => {
|
|
|
83
73
|
};
|
|
84
74
|
};
|
|
85
75
|
export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType, chartOptions) => {
|
|
86
|
-
const { type, dataType, title, mode =
|
|
76
|
+
const { type, dataType, title, mode = ChartMode.Raw, metadata = {} } = chartOptions;
|
|
87
77
|
const { executionIdAccessor, executionNameAccessor } = metadata;
|
|
88
78
|
const executionId = executionIdAccessor ? executionIdAccessor(executionOrder) : `execution-${executionOrder}`;
|
|
89
|
-
const { points, series } = mode ===
|
|
79
|
+
const { points, series } = mode === ChartMode.Percent
|
|
90
80
|
? calculatePercentValues(stats, executionId, itemType)
|
|
91
81
|
: calculateRawValues(stats, executionId, itemType);
|
|
92
82
|
const slices = {};
|
|
@@ -109,6 +99,7 @@ export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType,
|
|
|
109
99
|
return {
|
|
110
100
|
type,
|
|
111
101
|
dataType,
|
|
102
|
+
mode,
|
|
112
103
|
title,
|
|
113
104
|
points,
|
|
114
105
|
slices,
|
|
@@ -152,10 +143,10 @@ export const generateTrendChart = (options, stores, context) => {
|
|
|
152
143
|
const newOptions = { limit: DEFAULT_CHART_HISTORY_LIMIT, ...options };
|
|
153
144
|
const { dataType } = newOptions;
|
|
154
145
|
const { statistic, historyDataPoints, testResults } = stores;
|
|
155
|
-
if (dataType ===
|
|
146
|
+
if (dataType === ChartDataType.Status) {
|
|
156
147
|
return getStatusTrendData(statistic, context.reportName, historyDataPoints, newOptions);
|
|
157
148
|
}
|
|
158
|
-
else if (dataType ===
|
|
149
|
+
else if (dataType === ChartDataType.Severity) {
|
|
159
150
|
return getSeverityTrendData(testResults, context.reportName, historyDataPoints, newOptions);
|
|
160
151
|
}
|
|
161
152
|
};
|
package/dist/converters.js
CHANGED
package/dist/generators.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const generatePieChart: (writer: AwesomeDataWriter, store: Allure
|
|
|
17
17
|
export declare const generateAttachmentsFiles: (writer: AwesomeDataWriter, attachmentLinks: AttachmentLink[], contentFunction: (id: string) => Promise<ResultFile | undefined>) => Promise<Map<string, string> | undefined>;
|
|
18
18
|
export declare const generateHistoryDataPoints: (writer: AwesomeDataWriter, store: AllureStore) => Promise<Map<string, string>>;
|
|
19
19
|
export declare const generateStaticFiles: (payload: AwesomeOptions & {
|
|
20
|
+
id: string;
|
|
20
21
|
allureVersion: string;
|
|
21
22
|
reportFiles: ReportFiles;
|
|
22
23
|
reportDataFiles: ReportFile[];
|
package/dist/generators.js
CHANGED
|
@@ -14,7 +14,7 @@ const template = `<!DOCTYPE html>
|
|
|
14
14
|
<head>
|
|
15
15
|
<meta charset="utf-8">
|
|
16
16
|
<title> {{ reportName }} </title>
|
|
17
|
-
<link rel="icon" href="
|
|
17
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg width='32' height='32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M22.232 4.662a3.6 3.6 0 0 1 5.09.035c2.855 2.894 4.662 6.885 4.662 11.295a3.6 3.6 0 0 1-7.2 0c0-2.406-.981-4.61-2.587-6.24a3.6 3.6 0 0 1 .035-5.09Z' fill='url(%23a)'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M12.392 3.6a3.6 3.6 0 0 1 3.6-3.6c4.41 0 8.401 1.807 11.296 4.662a3.6 3.6 0 1 1-5.056 5.126C20.602 8.18 18.398 7.2 15.992 7.2a3.6 3.6 0 0 1-3.6-3.6Z' fill='url(%23b)'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M0 15.992C0 7.157 7.157 0 15.992 0a3.6 3.6 0 0 1 0 7.2A8.789 8.789 0 0 0 7.2 15.992c0 2.406.981 4.61 2.588 6.24a3.6 3.6 0 0 1-5.126 5.056C1.807 24.393 0 20.402 0 15.992Z' fill='url(%23c)'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.661 22.232a3.6 3.6 0 0 1 5.091-.035c1.63 1.606 3.834 2.587 6.24 2.587a3.6 3.6 0 0 1 0 7.2c-4.41 0-8.401-1.807-11.295-4.661a3.6 3.6 0 0 1-.036-5.091Z' fill='url(%23d)'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M28.384 12.392a3.6 3.6 0 0 1 3.6 3.6c0 8.835-7.157 15.992-15.992 15.992a3.6 3.6 0 0 1 0-7.2 8.789 8.789 0 0 0 8.792-8.792 3.6 3.6 0 0 1 3.6-3.6Z' fill='url(%23e)'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M28.385 12.392a3.6 3.6 0 0 1 3.6 3.6v12.392a3.6 3.6 0 0 1-7.2 0V15.992a3.6 3.6 0 0 1 3.6-3.6Z' fill='url(%23f)'/%3E%3Cg clip-path='url(%23g)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M22.232 4.662a3.6 3.6 0 0 1 5.091.035c2.855 2.894 4.662 6.885 4.662 11.295a3.6 3.6 0 0 1-7.2 0c0-2.406-.982-4.61-2.588-6.24a3.6 3.6 0 0 1 .035-5.09Z' fill='url(%23h)'/%3E%3C/g%3E%3Cdefs%3E%3ClinearGradient id='a' x1='26.4' y1='9.6' x2='28.8' y2='15' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%237E22CE'/%3E%3Cstop offset='1' stop-color='%238B5CF6'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' x1='26.8' y1='9.4' x2='17.8' y2='3.6' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23EF4444'/%3E%3Cstop offset='1' stop-color='%23DC2626'/%3E%3C/linearGradient%3E%3ClinearGradient id='c' x1='3.6' y1='14' x2='5.4' y2='24.8' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%2322C55E'/%3E%3Cstop offset='1' stop-color='%2315803D'/%3E%3C/linearGradient%3E%3ClinearGradient id='d' x1='4.8' y1='22.2' x2='14.4' y2='29.2' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%2394A3B8'/%3E%3Cstop offset='.958' stop-color='%2364748B'/%3E%3Cstop offset='1' stop-color='%2364748B'/%3E%3C/linearGradient%3E%3ClinearGradient id='e' x1='28.4' y1='22.173' x2='22.188' y2='28.384' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23D97706'/%3E%3Cstop offset='1' stop-color='%23FBBF24'/%3E%3C/linearGradient%3E%3ClinearGradient id='f' x1='29.2' y1='54.4' x2='30.626' y2='54.256' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23FBBF24'/%3E%3Cstop offset='1' stop-color='%23FBBF24'/%3E%3C/linearGradient%3E%3ClinearGradient id='h' x1='26.4' y1='9.6' x2='28.8' y2='15' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%237E22CE'/%3E%3Cstop offset='1' stop-color='%238B5CF6'/%3E%3C/linearGradient%3E%3CclipPath id='g'%3E%3Cpath fill='%23fff' transform='translate(24.8 12)' d='M0 0h7.2v8H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E" />
|
|
18
18
|
{{{ headTags }}}
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
@@ -82,7 +82,8 @@ export const generateTestResults = async (writer, store, filter) => {
|
|
|
82
82
|
const convertedTr = convertTestResult(tr);
|
|
83
83
|
convertedTr.history = await store.historyByTrId(tr.id);
|
|
84
84
|
convertedTr.retries = await store.retriesByTrId(tr.id);
|
|
85
|
-
convertedTr.
|
|
85
|
+
convertedTr.retriesCount = convertedTr.retries.length;
|
|
86
|
+
convertedTr.retry = convertedTr.retriesCount > 0;
|
|
86
87
|
convertedTr.setup = convertedTrFixtures.filter((f) => f.type === "before");
|
|
87
88
|
convertedTr.teardown = convertedTrFixtures.filter((f) => f.type === "after");
|
|
88
89
|
convertedTr.attachments = (await store.attachmentsByTrId(tr.id)).map((attachment) => ({
|
|
@@ -118,19 +119,17 @@ export const generateNav = async (writer, trs, filename = "nav.json") => {
|
|
|
118
119
|
};
|
|
119
120
|
export const generateTree = async (writer, treeFilename, labels, tests) => {
|
|
120
121
|
const visibleTests = tests.filter((test) => !test.hidden);
|
|
121
|
-
const tree = createTreeByLabels(visibleTests, labels, ({ id, name, status, duration, flaky, start,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
};
|
|
133
|
-
}, undefined, (group, leaf) => {
|
|
122
|
+
const tree = createTreeByLabels(visibleTests, labels, ({ id, name, status, duration, flaky, transition, start, retry, retriesCount }) => ({
|
|
123
|
+
nodeId: id,
|
|
124
|
+
retry,
|
|
125
|
+
retriesCount,
|
|
126
|
+
name,
|
|
127
|
+
status,
|
|
128
|
+
start,
|
|
129
|
+
duration,
|
|
130
|
+
flaky,
|
|
131
|
+
transition,
|
|
132
|
+
}), undefined, (group, leaf) => {
|
|
134
133
|
incrementStatistic(group.statistic, leaf.status);
|
|
135
134
|
});
|
|
136
135
|
filterTree(tree, (leaf) => !leaf.hidden);
|
|
@@ -198,7 +197,7 @@ export const generateHistoryDataPoints = async (writer, store) => {
|
|
|
198
197
|
return result;
|
|
199
198
|
};
|
|
200
199
|
export const generateStaticFiles = async (payload) => {
|
|
201
|
-
const { reportName = "Allure Report", reportLanguage = "en", singleFile, logo = "", theme = "light", groupBy, reportFiles, reportDataFiles, reportUuid, allureVersion, layout = "base", charts = [], defaultSection = "", } = payload;
|
|
200
|
+
const { id, reportName = "Allure Report", reportLanguage = "en", singleFile, logo = "", theme = "light", groupBy, reportFiles, reportDataFiles, reportUuid, allureVersion, layout = "base", charts = [], defaultSection = "", } = payload;
|
|
202
201
|
const compile = Handlebars.compile(template);
|
|
203
202
|
const manifest = await readTemplateManifest(payload.singleFile);
|
|
204
203
|
const headTags = [];
|
|
@@ -230,11 +229,12 @@ export const generateStaticFiles = async (payload) => {
|
|
|
230
229
|
else {
|
|
231
230
|
const mainJs = manifest["main.js"];
|
|
232
231
|
const mainJsSource = require.resolve(`@allurereport/web-awesome/dist/single/${mainJs}`);
|
|
233
|
-
const
|
|
234
|
-
bodyTags.push(createScriptTag(`data:text/javascript;base64,${
|
|
232
|
+
const mainJsContent = await readFile(mainJsSource);
|
|
233
|
+
bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContent.toString("base64")}`));
|
|
235
234
|
}
|
|
236
235
|
const now = Date.now();
|
|
237
236
|
const reportOptions = {
|
|
237
|
+
id,
|
|
238
238
|
reportName,
|
|
239
239
|
logo,
|
|
240
240
|
theme,
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default AwesomePlugin;
|
|
1
|
+
export { AwesomePlugin as default } from "./plugin.js";
|
package/dist/model.d.ts
CHANGED
package/dist/plugin.js
CHANGED
|
@@ -53,6 +53,7 @@ export class AwesomePlugin {
|
|
|
53
53
|
const reportDataFiles = singleFile ? __classPrivateFieldGet(this, _AwesomePlugin_writer, "f").reportFiles() : [];
|
|
54
54
|
await generateStaticFiles({
|
|
55
55
|
...this.options,
|
|
56
|
+
id: context.id,
|
|
56
57
|
allureVersion: context.allureVersion,
|
|
57
58
|
reportFiles: context.reportFiles,
|
|
58
59
|
reportDataFiles,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-awesome",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.16",
|
|
4
4
|
"description": "Allure Awesome Plugin – brand new HTML report with modern design and new features",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"test": "rimraf ./out && vitest run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
34
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
35
|
-
"@allurereport/web-awesome": "3.0.0-beta.
|
|
36
|
-
"@allurereport/web-commons": "3.0.0-beta.
|
|
33
|
+
"@allurereport/core-api": "3.0.0-beta.16",
|
|
34
|
+
"@allurereport/plugin-api": "3.0.0-beta.16",
|
|
35
|
+
"@allurereport/web-awesome": "3.0.0-beta.16",
|
|
36
|
+
"@allurereport/web-commons": "3.0.0-beta.16",
|
|
37
37
|
"d3-shape": "^3.2.0",
|
|
38
38
|
"handlebars": "^4.7.8"
|
|
39
39
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/node": "^20.17.9",
|
|
45
45
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
46
46
|
"@typescript-eslint/parser": "^8.0.0",
|
|
47
|
-
"@vitest/runner": "^2.1.
|
|
47
|
+
"@vitest/runner": "^2.1.9",
|
|
48
48
|
"allure-vitest": "^3.0.9",
|
|
49
49
|
"eslint": "^8.57.0",
|
|
50
50
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
56
56
|
"rimraf": "^6.0.1",
|
|
57
57
|
"typescript": "^5.6.3",
|
|
58
|
-
"vitest": "^2.1.
|
|
58
|
+
"vitest": "^2.1.9"
|
|
59
59
|
}
|
|
60
60
|
}
|