@allurereport/plugin-awesome 3.0.0-beta.15 → 3.0.0-beta.17
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 -8
- package/dist/charts.d.ts +4 -11
- package/dist/charts.js +7 -16
- package/dist/converters.js +2 -0
- package/dist/generators.d.ts +1 -0
- package/dist/generators.js +76 -35
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/model.d.ts +3 -6
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +12 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -47,11 +47,12 @@ export default defineConfig({
|
|
|
47
47
|
|
|
48
48
|
The plugin accepts the following options:
|
|
49
49
|
|
|
50
|
-
| Option | Description | Type
|
|
51
|
-
|
|
52
|
-
| `reportName` | Name of the report | `string`
|
|
53
|
-
| `singleFile` | Writes the report as a single `index.html` file | `boolean`
|
|
54
|
-
| `logo` | Path to the logo image | `string`
|
|
55
|
-
| `theme` | Default color theme of the report | `light \| dark`
|
|
56
|
-
| `reportLanguage` | Default language of the report | `string`
|
|
57
|
-
| `ci` | CI data which will be rendered in the report | `{ type: "github" \| "jenkins", url: string, name: string }` | `undefined`
|
|
50
|
+
| Option | Description | Type | Default |
|
|
51
|
+
|------------------|-------------------------------------------------|---------|-------------------------|
|
|
52
|
+
| `reportName` | Name of the report | `string` | `Allure Report` |
|
|
53
|
+
| `singleFile` | Writes the report as a single `index.html` file | `boolean` | `false` |
|
|
54
|
+
| `logo` | Path to the logo image | `string` | `null` |
|
|
55
|
+
| `theme` | Default color theme of the report | `light \| dark` | OS theme |
|
|
56
|
+
| `reportLanguage` | Default language of the report | `string` | OS language |
|
|
57
|
+
| `ci` | CI data which will be rendered in the report | `{ type: "github" \| "jenkins", url: string, name: string }` | `undefined` |
|
|
58
|
+
| `groupBy` | By default, tests are grouped using the `titlePath` provided by the test framework. | `string`| Grouping by `titlepath` |
|
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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { compareBy, incrementStatistic, nullsLast, ordinal, } from "@allurereport/core-api";
|
|
2
|
-
import { filterTree, } from "@allurereport/plugin-api";
|
|
3
|
-
import { createTreeByLabels, sortTree, transformTree } from "@allurereport/plugin-api";
|
|
2
|
+
import { createTreeByLabels, createTreeByTitlePath, filterTree, preciseTreeLabels, sortTree, transformTree, } from "@allurereport/plugin-api";
|
|
4
3
|
import { createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, getPieChartData, } from "@allurereport/web-commons";
|
|
5
4
|
import Handlebars from "handlebars";
|
|
6
5
|
import { readFile } from "node:fs/promises";
|
|
@@ -14,7 +13,7 @@ const template = `<!DOCTYPE html>
|
|
|
14
13
|
<head>
|
|
15
14
|
<meta charset="utf-8">
|
|
16
15
|
<title> {{ reportName }} </title>
|
|
17
|
-
<link rel="icon" href="
|
|
16
|
+
<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
17
|
{{{ headTags }}}
|
|
19
18
|
</head>
|
|
20
19
|
<body>
|
|
@@ -82,7 +81,8 @@ export const generateTestResults = async (writer, store, filter) => {
|
|
|
82
81
|
const convertedTr = convertTestResult(tr);
|
|
83
82
|
convertedTr.history = await store.historyByTrId(tr.id);
|
|
84
83
|
convertedTr.retries = await store.retriesByTrId(tr.id);
|
|
85
|
-
convertedTr.
|
|
84
|
+
convertedTr.retriesCount = convertedTr.retries.length;
|
|
85
|
+
convertedTr.retry = convertedTr.retriesCount > 0;
|
|
86
86
|
convertedTr.setup = convertedTrFixtures.filter((f) => f.type === "before");
|
|
87
87
|
convertedTr.teardown = convertedTrFixtures.filter((f) => f.type === "after");
|
|
88
88
|
convertedTr.attachments = (await store.attachmentsByTrId(tr.id)).map((attachment) => ({
|
|
@@ -118,26 +118,55 @@ export const generateNav = async (writer, trs, filename = "nav.json") => {
|
|
|
118
118
|
};
|
|
119
119
|
export const generateTree = async (writer, treeFilename, labels, tests) => {
|
|
120
120
|
const visibleTests = tests.filter((test) => !test.hidden);
|
|
121
|
-
const tree =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
nodeId: id,
|
|
125
|
-
retry: Boolean(retriesCount),
|
|
126
|
-
retriesCount,
|
|
127
|
-
name,
|
|
128
|
-
status,
|
|
129
|
-
duration,
|
|
130
|
-
flaky,
|
|
131
|
-
start,
|
|
132
|
-
};
|
|
133
|
-
}, undefined, (group, leaf) => {
|
|
134
|
-
incrementStatistic(group.statistic, leaf.status);
|
|
135
|
-
});
|
|
121
|
+
const tree = labels.length
|
|
122
|
+
? buildTreeByLabels(visibleTests, labels)
|
|
123
|
+
: buildTreeByTitlePath(visibleTests);
|
|
136
124
|
filterTree(tree, (leaf) => !leaf.hidden);
|
|
137
125
|
sortTree(tree, nullsLast(compareBy("start", ordinal())));
|
|
138
126
|
transformTree(tree, (leaf, idx) => ({ ...leaf, groupOrder: idx + 1 }));
|
|
139
127
|
await writer.writeWidget(treeFilename, tree);
|
|
140
128
|
};
|
|
129
|
+
const buildTreeByLabels = (tests, labels) => {
|
|
130
|
+
return createTreeByLabels(tests, labels, leafFactory, undefined, (group, leaf) => incrementStatistic(group.statistic, leaf.status));
|
|
131
|
+
};
|
|
132
|
+
const buildTreeByTitlePath = (tests) => {
|
|
133
|
+
const testsWithTitlePath = [];
|
|
134
|
+
const testsWithoutTitlePath = [];
|
|
135
|
+
for (const test of tests) {
|
|
136
|
+
if (Array.isArray(test.titlePath) && test.titlePath.length > 0) {
|
|
137
|
+
testsWithTitlePath.push(test);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
testsWithoutTitlePath.push(test);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const treeByTitlePath = createTreeByTitlePath(testsWithTitlePath, leafFactory, undefined, (group, leaf) => incrementStatistic(group.statistic, leaf.status));
|
|
144
|
+
const defaultLabels = preciseTreeLabels(["parentSuite", "suite", "subSuite"], testsWithoutTitlePath, ({ labels }) => labels.map(({ name }) => name));
|
|
145
|
+
const treeByDefaultLabels = createTreeByLabels(testsWithoutTitlePath, defaultLabels, leafFactory, undefined, (group, leaf) => incrementStatistic(group.statistic, leaf.status));
|
|
146
|
+
const mergedLeavesById = { ...treeByTitlePath.leavesById, ...treeByDefaultLabels.leavesById };
|
|
147
|
+
const mergedGroupsById = { ...treeByTitlePath.groupsById, ...treeByDefaultLabels.groupsById };
|
|
148
|
+
const mergedRootLeaves = Array.from(new Set([...(treeByTitlePath.root.leaves ?? []), ...(treeByDefaultLabels.root.leaves ?? [])]));
|
|
149
|
+
const mergedRootGroups = Array.from(new Set([...(treeByTitlePath.root.groups ?? []), ...(treeByDefaultLabels.root.groups ?? [])]));
|
|
150
|
+
return {
|
|
151
|
+
root: {
|
|
152
|
+
leaves: mergedRootLeaves,
|
|
153
|
+
groups: mergedRootGroups,
|
|
154
|
+
},
|
|
155
|
+
leavesById: mergedLeavesById,
|
|
156
|
+
groupsById: mergedGroupsById,
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
const leafFactory = ({ id, name, status, duration, flaky, start, transition, retry, retriesCount, }) => ({
|
|
160
|
+
nodeId: id,
|
|
161
|
+
name,
|
|
162
|
+
status,
|
|
163
|
+
duration,
|
|
164
|
+
flaky,
|
|
165
|
+
start,
|
|
166
|
+
retry,
|
|
167
|
+
retriesCount,
|
|
168
|
+
transition,
|
|
169
|
+
});
|
|
141
170
|
export const generateEnvironmentJson = async (writer, env) => {
|
|
142
171
|
await writer.writeWidget("allure_environment.json", env);
|
|
143
172
|
};
|
|
@@ -198,7 +227,7 @@ export const generateHistoryDataPoints = async (writer, store) => {
|
|
|
198
227
|
return result;
|
|
199
228
|
};
|
|
200
229
|
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;
|
|
230
|
+
const { id, reportName = "Allure Report", reportLanguage = "en", singleFile, logo = "", theme = "light", groupBy, reportFiles, reportDataFiles, reportUuid, allureVersion, layout = "base", charts = [], defaultSection = "", ci, } = payload;
|
|
202
231
|
const compile = Handlebars.compile(template);
|
|
203
232
|
const manifest = await readTemplateManifest(payload.singleFile);
|
|
204
233
|
const headTags = [];
|
|
@@ -230,34 +259,46 @@ export const generateStaticFiles = async (payload) => {
|
|
|
230
259
|
else {
|
|
231
260
|
const mainJs = manifest["main.js"];
|
|
232
261
|
const mainJsSource = require.resolve(`@allurereport/web-awesome/dist/single/${mainJs}`);
|
|
233
|
-
const
|
|
234
|
-
bodyTags.push(createScriptTag(`data:text/javascript;base64,${
|
|
262
|
+
const mainJsContent = await readFile(mainJsSource);
|
|
263
|
+
bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContent.toString("base64")}`));
|
|
235
264
|
}
|
|
236
265
|
const now = Date.now();
|
|
237
266
|
const reportOptions = {
|
|
267
|
+
id,
|
|
238
268
|
reportName,
|
|
239
269
|
logo,
|
|
240
270
|
theme,
|
|
241
271
|
reportLanguage,
|
|
242
272
|
createdAt: now,
|
|
243
273
|
reportUuid,
|
|
244
|
-
groupBy: groupBy?.length ? groupBy : [
|
|
274
|
+
groupBy: groupBy?.length ? groupBy : [],
|
|
245
275
|
cacheKey: now.toString(),
|
|
276
|
+
ci,
|
|
246
277
|
layout,
|
|
247
278
|
allureVersion,
|
|
248
279
|
sections,
|
|
249
280
|
defaultSection,
|
|
250
281
|
};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
282
|
+
try {
|
|
283
|
+
const html = compile({
|
|
284
|
+
headTags: headTags.join("\n"),
|
|
285
|
+
bodyTags: bodyTags.join("\n"),
|
|
286
|
+
reportFilesScript: createReportDataScript(reportDataFiles),
|
|
287
|
+
reportOptions: JSON.stringify(reportOptions),
|
|
288
|
+
analyticsEnable: true,
|
|
289
|
+
allureVersion,
|
|
290
|
+
reportUuid,
|
|
291
|
+
reportName,
|
|
292
|
+
singleFile: payload.singleFile,
|
|
293
|
+
});
|
|
294
|
+
await reportFiles.addFile("index.html", Buffer.from(html, "utf8"));
|
|
295
|
+
}
|
|
296
|
+
catch (err) {
|
|
297
|
+
if (err instanceof RangeError) {
|
|
298
|
+
console.error("The report is too large to be generated in the single file mode!");
|
|
299
|
+
process.exit(1);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
throw err;
|
|
303
|
+
}
|
|
263
304
|
};
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EnvironmentsConfig, TestResult } from "@allurereport/core-api";
|
|
1
|
+
import type { CiDescriptor, EnvironmentsConfig, TestResult } from "@allurereport/core-api";
|
|
2
2
|
import type { ChartOptions } from "./charts.js";
|
|
3
3
|
export type AwesomeOptions = {
|
|
4
4
|
reportName?: string;
|
|
@@ -9,15 +9,12 @@ export type AwesomeOptions = {
|
|
|
9
9
|
groupBy?: string[];
|
|
10
10
|
layout?: "base" | "split";
|
|
11
11
|
environments?: Record<string, EnvironmentsConfig>;
|
|
12
|
-
ci?:
|
|
13
|
-
type: "github" | "jenkins";
|
|
14
|
-
url: string;
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
12
|
+
ci?: CiDescriptor;
|
|
17
13
|
filter?: (testResult: TestResult) => boolean;
|
|
18
14
|
charts?: ChartOptions[];
|
|
19
15
|
sections?: string[];
|
|
20
16
|
defaultSection?: string;
|
|
17
|
+
publish?: boolean;
|
|
21
18
|
};
|
|
22
19
|
export type TemplateManifest = Record<string, string>;
|
|
23
20
|
export type AwesomePluginOptions = AwesomeOptions;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AllureStore, type Plugin, type PluginContext, type PluginSummary } from "@allurereport/plugin-api";
|
|
2
2
|
import type { AwesomePluginOptions } from "./model.js";
|
|
3
3
|
export declare class AwesomePlugin implements Plugin {
|
|
4
4
|
#private;
|
package/dist/plugin.js
CHANGED
|
@@ -11,6 +11,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _AwesomePlugin_writer, _AwesomePlugin_generate;
|
|
13
13
|
import { getWorstStatus } from "@allurereport/core-api";
|
|
14
|
+
import { convertToSummaryTestResult, } from "@allurereport/plugin-api";
|
|
14
15
|
import { preciseTreeLabels } from "@allurereport/plugin-api";
|
|
15
16
|
import { join } from "node:path";
|
|
16
17
|
import { generateAllCharts } from "./charts.js";
|
|
@@ -29,7 +30,10 @@ export class AwesomePlugin {
|
|
|
29
30
|
await generatePieChart(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, this.options.filter);
|
|
30
31
|
await generateAllCharts(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, this.options, context);
|
|
31
32
|
const convertedTrs = await generateTestResults(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store, this.options.filter);
|
|
32
|
-
const
|
|
33
|
+
const hasGroupBy = groupBy.length > 0;
|
|
34
|
+
const treeLabels = hasGroupBy
|
|
35
|
+
? preciseTreeLabels(groupBy, convertedTrs, ({ labels }) => labels.map(({ name }) => name))
|
|
36
|
+
: [];
|
|
33
37
|
await generateHistoryDataPoints(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), store);
|
|
34
38
|
await generateTestCases(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), convertedTrs);
|
|
35
39
|
await generateTree(__classPrivateFieldGet(this, _AwesomePlugin_writer, "f"), "tree.json", treeLabels, convertedTrs);
|
|
@@ -53,6 +57,7 @@ export class AwesomePlugin {
|
|
|
53
57
|
const reportDataFiles = singleFile ? __classPrivateFieldGet(this, _AwesomePlugin_writer, "f").reportFiles() : [];
|
|
54
58
|
await generateStaticFiles({
|
|
55
59
|
...this.options,
|
|
60
|
+
id: context.id,
|
|
56
61
|
allureVersion: context.allureVersion,
|
|
57
62
|
reportFiles: context.reportFiles,
|
|
58
63
|
reportDataFiles,
|
|
@@ -84,6 +89,9 @@ export class AwesomePlugin {
|
|
|
84
89
|
}
|
|
85
90
|
async info(context, store) {
|
|
86
91
|
const allTrs = (await store.allTestResults()).filter((tr) => this.options.filter ? this.options.filter(tr) : true);
|
|
92
|
+
const newTrs = await store.allNewTestResults();
|
|
93
|
+
const retryTrs = allTrs.filter((tr) => !!tr?.retries?.length);
|
|
94
|
+
const flakyTrs = allTrs.filter((tr) => !!tr?.flaky);
|
|
87
95
|
const duration = allTrs.reduce((acc, { duration: trDuration = 0 }) => acc + trDuration, 0);
|
|
88
96
|
const worstStatus = getWorstStatus(allTrs.map(({ status }) => status));
|
|
89
97
|
const createdAt = allTrs.reduce((acc, { stop }) => Math.max(acc, stop || 0), 0);
|
|
@@ -94,6 +102,9 @@ export class AwesomePlugin {
|
|
|
94
102
|
duration,
|
|
95
103
|
createdAt,
|
|
96
104
|
plugin: "Awesome",
|
|
105
|
+
newTests: newTrs.map(convertToSummaryTestResult),
|
|
106
|
+
flakyTests: flakyTrs.map(convertToSummaryTestResult),
|
|
107
|
+
retryTests: retryTrs.map(convertToSummaryTestResult),
|
|
97
108
|
};
|
|
98
109
|
}
|
|
99
110
|
}
|
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.17",
|
|
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.17",
|
|
34
|
+
"@allurereport/plugin-api": "3.0.0-beta.17",
|
|
35
|
+
"@allurereport/web-awesome": "3.0.0-beta.17",
|
|
36
|
+
"@allurereport/web-commons": "3.0.0-beta.17",
|
|
37
37
|
"d3-shape": "^3.2.0",
|
|
38
38
|
"handlebars": "^4.7.8"
|
|
39
39
|
},
|
|
@@ -44,8 +44,8 @@
|
|
|
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.
|
|
48
|
-
"allure-vitest": "^3.0
|
|
47
|
+
"@vitest/runner": "^2.1.9",
|
|
48
|
+
"allure-vitest": "^3.3.0",
|
|
49
49
|
"eslint": "^8.57.0",
|
|
50
50
|
"eslint-config-prettier": "^9.1.0",
|
|
51
51
|
"eslint-plugin-import": "^2.29.1",
|
|
@@ -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
|
}
|