@allurereport/plugin-awesome 3.0.0-beta.14 → 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 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: ChartData;
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: ChartData;
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 } from "@allurereport/web-commons";
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: (value / total) * 100,
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 = "raw", metadata = {} } = chartOptions;
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 === "percent"
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,
@@ -149,13 +140,14 @@ export const generateCharts = async (options, store, context) => {
149
140
  }, {});
150
141
  };
151
142
  export const generateTrendChart = (options, stores, context) => {
152
- const { dataType } = options;
143
+ const newOptions = { limit: DEFAULT_CHART_HISTORY_LIMIT, ...options };
144
+ const { dataType } = newOptions;
153
145
  const { statistic, historyDataPoints, testResults } = stores;
154
- if (dataType === ChartData.Status) {
155
- return getStatusTrendData(statistic, context.reportName, historyDataPoints, options);
146
+ if (dataType === ChartDataType.Status) {
147
+ return getStatusTrendData(statistic, context.reportName, historyDataPoints, newOptions);
156
148
  }
157
- else if (dataType === ChartData.Severity) {
158
- return getSeverityTrendData(testResults, context.reportName, historyDataPoints, options);
149
+ else if (dataType === ChartDataType.Severity) {
150
+ return getSeverityTrendData(testResults, context.reportName, historyDataPoints, newOptions);
159
151
  }
160
152
  };
161
153
  export const generateAllCharts = async (writer, store, options, context) => {
@@ -35,6 +35,7 @@ export const convertTestResult = (tr) => {
35
35
  retries: [],
36
36
  breadcrumbs: [],
37
37
  retry: false,
38
+ transition: tr.transition,
38
39
  };
39
40
  };
40
41
  export const convertTestStepResult = (tsr) => {
@@ -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[];
@@ -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="favicon.ico">
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.retry = convertedTr.retries.length > 0;
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, retries }) => {
122
- const retriesCount = retries?.length;
123
- return {
124
- nodeId: id,
125
- retry: Boolean(retriesCount),
126
- retriesCount,
127
- name,
128
- status,
129
- duration,
130
- flaky,
131
- start,
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,17 +229,20 @@ 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 mainJsContentBuffer = await readFile(mainJsSource);
234
- bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContentBuffer.toString("base64")}`));
232
+ const mainJsContent = await readFile(mainJsSource);
233
+ bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContent.toString("base64")}`));
235
234
  }
235
+ const now = Date.now();
236
236
  const reportOptions = {
237
+ id,
237
238
  reportName,
238
239
  logo,
239
240
  theme,
240
241
  reportLanguage,
241
- createdAt: Date.now(),
242
+ createdAt: now,
242
243
  reportUuid,
243
244
  groupBy: groupBy?.length ? groupBy : ["parentSuite", "suite", "subSuite"],
245
+ cacheKey: now.toString(),
244
246
  layout,
245
247
  allureVersion,
246
248
  sections,
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import { AwesomePlugin } from "./plugin.js";
2
1
  export type { AwesomePluginOptions } from "./model.js";
3
- export default AwesomePlugin;
2
+ export { AwesomePlugin as default } from "./plugin.js";
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
- import { AwesomePlugin } from "./plugin.js";
2
- export default AwesomePlugin;
1
+ export { AwesomePlugin as default } from "./plugin.js";
package/dist/model.d.ts CHANGED
@@ -18,6 +18,7 @@ export type AwesomeOptions = {
18
18
  charts?: ChartOptions[];
19
19
  sections?: string[];
20
20
  defaultSection?: string;
21
+ publish?: boolean;
21
22
  };
22
23
  export type TemplateManifest = Record<string, string>;
23
24
  export type AwesomePluginOptions = AwesomeOptions;
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.14",
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.14",
34
- "@allurereport/plugin-api": "3.0.0-beta.14",
35
- "@allurereport/web-awesome": "3.0.0-beta.14",
36
- "@allurereport/web-commons": "3.0.0-beta.14",
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.8",
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.8"
58
+ "vitest": "^2.1.9"
59
59
  }
60
60
  }