@allurereport/plugin-api 3.0.0-beta.18 → 3.0.0-beta.20
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/accessors/coverageDiffTreeMapAccessor.d.ts +17 -0
- package/dist/charts/accessors/coverageDiffTreeMapAccessor.js +181 -0
- package/dist/charts/accessors/problemsDistributionHeatMap.d.ts +2 -0
- package/dist/charts/accessors/problemsDistributionHeatMap.js +65 -0
- package/dist/{severityTrendAccessor.d.ts → charts/accessors/severityTrendAccessor.d.ts} +1 -1
- package/dist/{severityTrendAccessor.js → charts/accessors/severityTrendAccessor.js} +3 -3
- package/dist/charts/accessors/statusBySeverityBarAccessor.d.ts +3 -0
- package/dist/charts/accessors/statusBySeverityBarAccessor.js +33 -0
- package/dist/charts/accessors/statusChangeTrendBarAccessor.d.ts +4 -0
- package/dist/charts/accessors/statusChangeTrendBarAccessor.js +92 -0
- package/dist/{statusTrendAccessor.d.ts → charts/accessors/statusTrendAccessor.d.ts} +1 -1
- package/dist/{statusTrendAccessor.js → charts/accessors/statusTrendAccessor.js} +3 -3
- package/dist/charts/accessors/statusTrendBarAccessor.d.ts +5 -0
- package/dist/charts/accessors/statusTrendBarAccessor.js +63 -0
- package/dist/charts/accessors/successRateDistributionTreeMapAccessor.d.ts +14 -0
- package/dist/charts/accessors/successRateDistributionTreeMapAccessor.js +111 -0
- package/dist/charts/accessors/utils/behavior.d.ts +5 -0
- package/dist/charts/accessors/utils/behavior.js +4 -0
- package/dist/charts/bar.d.ts +3 -0
- package/dist/charts/bar.js +50 -0
- package/dist/charts/comingSoon.d.ts +2 -0
- package/dist/charts/comingSoon.js +7 -0
- package/dist/charts/heatmap.d.ts +3 -0
- package/dist/charts/heatmap.js +9 -0
- package/dist/charts/line.d.ts +8 -0
- package/dist/charts/line.js +140 -0
- package/dist/charts/pie.d.ts +6 -0
- package/dist/charts/pie.js +10 -0
- package/dist/charts/treeMap.d.ts +6 -0
- package/dist/charts/treeMap.js +88 -0
- package/dist/charts.d.ts +83 -38
- package/dist/charts.js +73 -153
- package/dist/config.d.ts +2 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.js +7 -2
- package/dist/store.d.ts +35 -1
- package/dist/store.js +18 -1
- package/package.json +2 -2
package/dist/charts.js
CHANGED
|
@@ -1,76 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const calculatePercentValues = (stats, executionId, itemType) => {
|
|
6
|
-
const points = {};
|
|
7
|
-
const series = createEmptySeries(itemType);
|
|
8
|
-
const values = Object.values(stats);
|
|
9
|
-
const total = values.reduce((sum, value) => sum + value, 0);
|
|
10
|
-
if (total === 0) {
|
|
11
|
-
return { points, series };
|
|
12
|
-
}
|
|
13
|
-
itemType.forEach((item) => {
|
|
14
|
-
const pointId = `${executionId}-${item}`;
|
|
15
|
-
const value = stats[item] ?? 0;
|
|
16
|
-
points[pointId] = {
|
|
17
|
-
x: executionId,
|
|
18
|
-
y: value / total,
|
|
19
|
-
};
|
|
20
|
-
series[item].push(pointId);
|
|
21
|
-
});
|
|
22
|
-
return { points, series };
|
|
23
|
-
};
|
|
24
|
-
const calculateRawValues = (stats, executionId, itemType) => {
|
|
25
|
-
const points = {};
|
|
26
|
-
const series = createEmptySeries(itemType);
|
|
27
|
-
itemType.forEach((item) => {
|
|
28
|
-
const pointId = `${executionId}-${item}`;
|
|
29
|
-
const value = stats[item] ?? 0;
|
|
30
|
-
points[pointId] = {
|
|
31
|
-
x: executionId,
|
|
32
|
-
y: value,
|
|
33
|
-
};
|
|
34
|
-
series[item].push(pointId);
|
|
35
|
-
});
|
|
36
|
-
return { points, series };
|
|
37
|
-
};
|
|
38
|
-
export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType, chartOptions) => {
|
|
39
|
-
const { type, dataType, title, mode = ChartMode.Raw, metadata = {} } = chartOptions;
|
|
40
|
-
const { executionIdAccessor, executionNameAccessor } = metadata;
|
|
41
|
-
const executionId = executionIdAccessor ? executionIdAccessor(executionOrder) : `execution-${executionOrder}`;
|
|
42
|
-
const { points, series } = mode === ChartMode.Percent
|
|
43
|
-
? calculatePercentValues(stats, executionId, itemType)
|
|
44
|
-
: calculateRawValues(stats, executionId, itemType);
|
|
45
|
-
const slices = {};
|
|
46
|
-
const pointsAsArray = Object.values(points);
|
|
47
|
-
const pointsCount = pointsAsArray.length;
|
|
48
|
-
const values = pointsAsArray.map((point) => point.y);
|
|
49
|
-
const min = pointsCount ? Math.min(...values) : 0;
|
|
50
|
-
const max = pointsCount ? Math.max(...values) : 0;
|
|
51
|
-
if (pointsCount > 0) {
|
|
52
|
-
const executionName = executionNameAccessor ? executionNameAccessor(executionOrder) : reportName;
|
|
53
|
-
slices[executionId] = {
|
|
54
|
-
min,
|
|
55
|
-
max,
|
|
56
|
-
metadata: {
|
|
57
|
-
executionId,
|
|
58
|
-
executionName,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
1
|
+
export const DEFAULT_CHART_HISTORY_LIMIT = 10;
|
|
2
|
+
export const limitHistoryDataPoints = (historyDataPoints, limit) => {
|
|
3
|
+
if (limit <= 0 || historyDataPoints.length === 0) {
|
|
4
|
+
return [];
|
|
61
5
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
dataType,
|
|
65
|
-
mode,
|
|
66
|
-
title,
|
|
67
|
-
points,
|
|
68
|
-
slices,
|
|
69
|
-
series,
|
|
70
|
-
min,
|
|
71
|
-
max,
|
|
72
|
-
};
|
|
6
|
+
const clampedLimit = Math.max(0, Math.floor(limit));
|
|
7
|
+
return historyDataPoints.slice(0, clampedLimit);
|
|
73
8
|
};
|
|
9
|
+
export const createEmptySeries = (items) => items.reduce((acc, item) => ({ ...acc, [item]: [] }), {});
|
|
74
10
|
export const createEmptyStats = (items) => items.reduce((acc, item) => ({ ...acc, [item]: 0 }), {});
|
|
75
11
|
export const normalizeStatistic = (statistic, itemType) => {
|
|
76
12
|
return itemType.reduce((acc, item) => {
|
|
@@ -78,86 +14,70 @@ export const normalizeStatistic = (statistic, itemType) => {
|
|
|
78
14
|
return acc;
|
|
79
15
|
}, {});
|
|
80
16
|
};
|
|
81
|
-
export const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
slices: {
|
|
89
|
-
...trendData.slices,
|
|
90
|
-
...trendDataPart.slices,
|
|
91
|
-
},
|
|
92
|
-
series: Object.entries(trendDataPart.series).reduce((series, [group, pointIds]) => {
|
|
93
|
-
if (Array.isArray(pointIds)) {
|
|
94
|
-
return {
|
|
95
|
-
...series,
|
|
96
|
-
[group]: [...(trendData.series?.[group] || []), ...pointIds],
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
return series;
|
|
100
|
-
}, trendData.series || createEmptySeries(itemType)),
|
|
101
|
-
min: Math.min(trendData.min ?? Infinity, trendDataPart.min),
|
|
102
|
-
max: Math.max(trendData.max ?? -Infinity, trendDataPart.max),
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
export const DEFAULT_CHART_HISTORY_LIMIT = 10;
|
|
106
|
-
export const getPieChartData = (stats, chartOptions) => ({
|
|
107
|
-
type: chartOptions.type,
|
|
108
|
-
title: chartOptions?.title,
|
|
109
|
-
...getPieChartValues(stats),
|
|
110
|
-
});
|
|
111
|
-
export const generatePieChart = (options, stores) => {
|
|
112
|
-
const { statistic } = stores;
|
|
113
|
-
return getPieChartData(statistic, options);
|
|
114
|
-
};
|
|
115
|
-
export const generateComingSoonChart = (options) => {
|
|
116
|
-
return {
|
|
117
|
-
type: options.type,
|
|
118
|
-
title: options.title,
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
export const generateTrendChartGeneric = (options, stores, context, dataAccessor) => {
|
|
122
|
-
const { trs = [], statistic, history } = stores;
|
|
123
|
-
const { limit } = options;
|
|
124
|
-
const historyLimit = limit && limit > 0 ? Math.max(0, limit - 1) : undefined;
|
|
125
|
-
const currentData = dataAccessor.getCurrentData(trs, statistic);
|
|
126
|
-
const limitedHistoryPoints = historyLimit !== undefined ? history.slice(-historyLimit) : history;
|
|
127
|
-
const firstOriginalIndex = historyLimit !== undefined ? Math.max(0, history.length - historyLimit) : 0;
|
|
128
|
-
const convertedHistoryPoints = limitedHistoryPoints.map((point, index) => {
|
|
129
|
-
const originalIndex = firstOriginalIndex + index;
|
|
130
|
-
return {
|
|
131
|
-
name: point.name,
|
|
132
|
-
originalIndex,
|
|
133
|
-
statistic: dataAccessor.getHistoricalData(point),
|
|
134
|
-
};
|
|
135
|
-
});
|
|
136
|
-
const allValues = dataAccessor.getAllValues();
|
|
137
|
-
const currentTrendData = getTrendDataGeneric(normalizeStatistic(currentData, allValues), context.reportName, history.length + 1, allValues, options);
|
|
138
|
-
const historicalTrendData = convertedHistoryPoints.reduce((acc, historyPoint) => {
|
|
139
|
-
const trendDataPart = getTrendDataGeneric(normalizeStatistic(historyPoint.statistic, allValues), historyPoint.name, historyPoint.originalIndex + 1, allValues, options);
|
|
140
|
-
return mergeTrendDataGeneric(acc, trendDataPart, allValues);
|
|
141
|
-
}, {
|
|
142
|
-
type: options.type,
|
|
143
|
-
dataType: options.dataType,
|
|
144
|
-
mode: options.mode,
|
|
145
|
-
title: options.title,
|
|
146
|
-
points: {},
|
|
147
|
-
slices: {},
|
|
148
|
-
series: createEmptySeries(allValues),
|
|
149
|
-
min: Infinity,
|
|
150
|
-
max: -Infinity,
|
|
151
|
-
});
|
|
152
|
-
return mergeTrendDataGeneric(historicalTrendData, currentTrendData, allValues);
|
|
153
|
-
};
|
|
154
|
-
export const generateTrendChart = (options, stores, context) => {
|
|
155
|
-
const newOptions = { limit: DEFAULT_CHART_HISTORY_LIMIT, ...options };
|
|
156
|
-
const { dataType } = newOptions;
|
|
157
|
-
if (dataType === ChartDataType.Status) {
|
|
158
|
-
return generateTrendChartGeneric(newOptions, stores, context, statusTrendDataAccessor);
|
|
159
|
-
}
|
|
160
|
-
else if (dataType === ChartDataType.Severity) {
|
|
161
|
-
return generateTrendChartGeneric(newOptions, stores, context, severityTrendDataAccessor);
|
|
162
|
-
}
|
|
17
|
+
export const hasLabels = (test, labelHierarchy) => test.labels?.some((label) => {
|
|
18
|
+
const { name } = label;
|
|
19
|
+
return name && labelHierarchy.includes(name);
|
|
20
|
+
}) ?? false;
|
|
21
|
+
export const isChildrenLeavesOnly = (node) => {
|
|
22
|
+
return node.children ? node.children.every((child) => child.children === undefined) : false;
|
|
163
23
|
};
|
|
24
|
+
export const defaultChartsConfig = [
|
|
25
|
+
{
|
|
26
|
+
type: "pie",
|
|
27
|
+
title: "Current status",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "trend",
|
|
31
|
+
dataType: "status",
|
|
32
|
+
title: "Status dynamics",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "bar",
|
|
36
|
+
dataType: "statusBySeverity",
|
|
37
|
+
title: "Test result severities",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "bar",
|
|
41
|
+
dataType: "statusTrend",
|
|
42
|
+
title: "Status change dynamics",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: "bar",
|
|
46
|
+
dataType: "statusChangeTrend",
|
|
47
|
+
title: "Test base growth dynamics",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: "treemap",
|
|
51
|
+
dataType: "coverageDiff",
|
|
52
|
+
title: "Coverage diff map",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "treemap",
|
|
56
|
+
dataType: "successRateDistribution",
|
|
57
|
+
title: "Success rate disctribution",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: "heatmap",
|
|
61
|
+
title: "Problems distribution by environment",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: "bar",
|
|
65
|
+
title: "Stability rate disctribution",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "bar",
|
|
69
|
+
title: "Duration by layer histogram",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "bar",
|
|
73
|
+
title: "Performance dynamics",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: "bar",
|
|
77
|
+
title: "FBSU age pyramid",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: "funnel",
|
|
81
|
+
title: "Testing pyramid",
|
|
82
|
+
},
|
|
83
|
+
];
|
package/dist/config.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export interface Config {
|
|
|
7
7
|
historyPath?: string;
|
|
8
8
|
knownIssuesPath?: string;
|
|
9
9
|
defaultLabels?: DefaultLabelsConfig;
|
|
10
|
+
stage?: string;
|
|
11
|
+
environment?: string;
|
|
10
12
|
environments?: EnvironmentsConfig;
|
|
11
13
|
variables?: ReportVariables;
|
|
12
14
|
plugins?: Record<string, PluginDescriptor>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export * from "./config.js";
|
|
2
2
|
export type * from "./plugin.js";
|
|
3
|
-
export type * from "./store.js";
|
|
4
|
-
export type * from "./resultFile.js";
|
|
5
3
|
export type * from "./qualityGate.js";
|
|
4
|
+
export * from "./store.js";
|
|
5
|
+
export type * from "./resultFile.js";
|
|
6
6
|
export * from "./utils/misc.js";
|
|
7
7
|
export * from "./utils/tree.js";
|
|
8
8
|
export * from "./utils/summary.js";
|
|
9
9
|
export * from "./charts.js";
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
10
|
+
export * from "./charts/treeMap.js";
|
|
11
|
+
export * from "./charts/bar.js";
|
|
12
|
+
export * from "./charts/line.js";
|
|
13
|
+
export * from "./charts/pie.js";
|
|
14
|
+
export * from "./charts/heatmap.js";
|
|
15
|
+
export * from "./charts/comingSoon.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export * from "./config.js";
|
|
2
|
+
export * from "./store.js";
|
|
2
3
|
export * from "./utils/misc.js";
|
|
3
4
|
export * from "./utils/tree.js";
|
|
4
5
|
export * from "./utils/summary.js";
|
|
5
6
|
export * from "./charts.js";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
7
|
+
export * from "./charts/treeMap.js";
|
|
8
|
+
export * from "./charts/bar.js";
|
|
9
|
+
export * from "./charts/line.js";
|
|
10
|
+
export * from "./charts/pie.js";
|
|
11
|
+
export * from "./charts/heatmap.js";
|
|
12
|
+
export * from "./charts/comingSoon.js";
|
package/dist/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttachmentLink, HistoryDataPoint, HistoryTestResult, KnownTestFailure, Statistic, TestCase, TestEnvGroup, TestError, TestFixtureResult, TestResult } from "@allurereport/core-api";
|
|
1
|
+
import type { AttachmentLink, HistoryDataPoint, HistoryTestResult, KnownTestFailure, ReportVariables, Statistic, TestCase, TestEnvGroup, TestError, TestFixtureResult, TestResult } from "@allurereport/core-api";
|
|
2
2
|
import type { ExitCode } from "./plugin.js";
|
|
3
3
|
import type { QualityGateValidationResult } from "./qualityGate.js";
|
|
4
4
|
import type { ResultFile } from "./resultFile.js";
|
|
@@ -41,3 +41,37 @@ export interface AllureStore {
|
|
|
41
41
|
allVariables: () => Promise<Record<string, any>>;
|
|
42
42
|
envVariables: (env: string) => Promise<Record<string, any>>;
|
|
43
43
|
}
|
|
44
|
+
export interface AllureStoreDump {
|
|
45
|
+
testResults: Record<string, TestResult>;
|
|
46
|
+
attachments: Record<string, AttachmentLink>;
|
|
47
|
+
globalAttachments: AttachmentLink[];
|
|
48
|
+
globalErrors: TestError[];
|
|
49
|
+
testCases: Record<string, TestCase>;
|
|
50
|
+
fixtures: Record<string, TestFixtureResult>;
|
|
51
|
+
environments: string[];
|
|
52
|
+
reportVariables: ReportVariables;
|
|
53
|
+
indexAttachmentByTestResult: Record<string, string[]>;
|
|
54
|
+
indexTestResultByHistoryId: Record<string, string[]>;
|
|
55
|
+
indexTestResultByTestCase: Record<string, string[]>;
|
|
56
|
+
indexLatestEnvTestResultByHistoryId: Record<string, string>;
|
|
57
|
+
indexAttachmentByFixture: Record<string, string[]>;
|
|
58
|
+
indexFixturesByTestResult: Record<string, string[]>;
|
|
59
|
+
indexKnownByHistoryId: Record<string, KnownTestFailure[]>;
|
|
60
|
+
}
|
|
61
|
+
export declare enum AllureStoreDumpFiles {
|
|
62
|
+
TestResults = "test-results.json",
|
|
63
|
+
TestCases = "test-cases.json",
|
|
64
|
+
Fixtures = "fixtures.json",
|
|
65
|
+
GlobalErrors = "global-errors.json",
|
|
66
|
+
GlobalAttachments = "global-attachments.json",
|
|
67
|
+
Attachments = "attachments.json",
|
|
68
|
+
Environments = "environments.json",
|
|
69
|
+
ReportVariables = "report-variables.json",
|
|
70
|
+
IndexAttachmentsByTestResults = "index-attachments-by-test-results.json",
|
|
71
|
+
IndexTestResultsByHistoryId = "index-test-results-by-history-id.json",
|
|
72
|
+
IndexTestResultsByTestCase = "index-test-results-by-test-case.json",
|
|
73
|
+
IndexLatestEnvTestResultsByHistoryId = "index-latest-env-test-results-by-history-id.json",
|
|
74
|
+
IndexAttachmentsByFixture = "index-attachments-by-fixture.json",
|
|
75
|
+
IndexFixturesByTestResult = "index-fixtures-by-test-result.json",
|
|
76
|
+
IndexKnownByHistoryId = "index-known-by-history-id.json"
|
|
77
|
+
}
|
package/dist/store.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var AllureStoreDumpFiles;
|
|
2
|
+
(function (AllureStoreDumpFiles) {
|
|
3
|
+
AllureStoreDumpFiles["TestResults"] = "test-results.json";
|
|
4
|
+
AllureStoreDumpFiles["TestCases"] = "test-cases.json";
|
|
5
|
+
AllureStoreDumpFiles["Fixtures"] = "fixtures.json";
|
|
6
|
+
AllureStoreDumpFiles["GlobalErrors"] = "global-errors.json";
|
|
7
|
+
AllureStoreDumpFiles["GlobalAttachments"] = "global-attachments.json";
|
|
8
|
+
AllureStoreDumpFiles["Attachments"] = "attachments.json";
|
|
9
|
+
AllureStoreDumpFiles["Environments"] = "environments.json";
|
|
10
|
+
AllureStoreDumpFiles["ReportVariables"] = "report-variables.json";
|
|
11
|
+
AllureStoreDumpFiles["IndexAttachmentsByTestResults"] = "index-attachments-by-test-results.json";
|
|
12
|
+
AllureStoreDumpFiles["IndexTestResultsByHistoryId"] = "index-test-results-by-history-id.json";
|
|
13
|
+
AllureStoreDumpFiles["IndexTestResultsByTestCase"] = "index-test-results-by-test-case.json";
|
|
14
|
+
AllureStoreDumpFiles["IndexLatestEnvTestResultsByHistoryId"] = "index-latest-env-test-results-by-history-id.json";
|
|
15
|
+
AllureStoreDumpFiles["IndexAttachmentsByFixture"] = "index-attachments-by-fixture.json";
|
|
16
|
+
AllureStoreDumpFiles["IndexFixturesByTestResult"] = "index-fixtures-by-test-result.json";
|
|
17
|
+
AllureStoreDumpFiles["IndexKnownByHistoryId"] = "index-known-by-history-id.json";
|
|
18
|
+
})(AllureStoreDumpFiles || (AllureStoreDumpFiles = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-api",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.20",
|
|
4
4
|
"description": "Allure Plugin API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "rimraf ./out && vitest run"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
29
|
+
"@allurereport/core-api": "3.0.0-beta.20"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@stylistic/eslint-plugin": "^2.6.1",
|