@allurereport/core-api 3.0.0-beta.18 → 3.0.0-beta.19
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/types.d.ts +35 -1
- package/dist/charts/types.js +17 -0
- package/dist/history.d.ts +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/static.d.ts +12 -0
- package/dist/static.js +55 -0
- package/dist/utils/history.d.ts +3 -0
- package/dist/utils/history.js +22 -0
- package/dist/utils/strings.d.ts +1 -0
- package/dist/utils/strings.js +6 -0
- package/package.json +1 -1
package/dist/charts/types.d.ts
CHANGED
|
@@ -5,12 +5,22 @@ export declare enum ChartType {
|
|
|
5
5
|
TreeMap = "treemap",
|
|
6
6
|
HeatMap = "heatmap",
|
|
7
7
|
Bar = "bar",
|
|
8
|
-
Funnel = "funnel"
|
|
8
|
+
Funnel = "funnel",
|
|
9
|
+
ComingSoon = "coming-soon"
|
|
9
10
|
}
|
|
10
11
|
export declare enum ChartDataType {
|
|
11
12
|
Status = "status",
|
|
12
13
|
Severity = "severity"
|
|
13
14
|
}
|
|
15
|
+
export declare enum BarChartType {
|
|
16
|
+
StatusBySeverity = "statusBySeverity",
|
|
17
|
+
StatusTrend = "statusTrend",
|
|
18
|
+
StatusChangeTrend = "statusChangeTrend"
|
|
19
|
+
}
|
|
20
|
+
export declare enum TreeMapChartType {
|
|
21
|
+
SuccessRateDistribution = "successRateDistribution",
|
|
22
|
+
CoverageDiff = "coverageDiff"
|
|
23
|
+
}
|
|
14
24
|
export declare enum ChartMode {
|
|
15
25
|
Raw = "raw",
|
|
16
26
|
Percent = "percent"
|
|
@@ -44,3 +54,27 @@ export type PieChartValues = {
|
|
|
44
54
|
percentage: number;
|
|
45
55
|
slices: PieSlice[];
|
|
46
56
|
};
|
|
57
|
+
export type BarGroupValues<T extends string = string> = Record<T, number>;
|
|
58
|
+
export type BarGroup<G extends string, T extends string = string> = {
|
|
59
|
+
groupId: G;
|
|
60
|
+
} & BarGroupValues<T>;
|
|
61
|
+
export declare enum BarGroupMode {
|
|
62
|
+
Grouped = "grouped",
|
|
63
|
+
Stacked = "stacked"
|
|
64
|
+
}
|
|
65
|
+
export type NewKey<T extends string> = `new${Capitalize<T>}`;
|
|
66
|
+
export type RemovedKey<T extends string> = `removed${Capitalize<T>}`;
|
|
67
|
+
export type TreeMapNode<T extends Record<string, any> = {}> = T & {
|
|
68
|
+
id: string;
|
|
69
|
+
value?: number;
|
|
70
|
+
colorValue?: number;
|
|
71
|
+
children?: TreeMapNode<T>[];
|
|
72
|
+
};
|
|
73
|
+
export type HeatMapPoint = {
|
|
74
|
+
x: string;
|
|
75
|
+
y?: number;
|
|
76
|
+
};
|
|
77
|
+
export type HeatMapSerie<T extends Record<string, any> = Record<string, any>> = {
|
|
78
|
+
id: string;
|
|
79
|
+
data: HeatMapPoint[];
|
|
80
|
+
} & T;
|
package/dist/charts/types.js
CHANGED
|
@@ -6,14 +6,31 @@ export var ChartType;
|
|
|
6
6
|
ChartType["HeatMap"] = "heatmap";
|
|
7
7
|
ChartType["Bar"] = "bar";
|
|
8
8
|
ChartType["Funnel"] = "funnel";
|
|
9
|
+
ChartType["ComingSoon"] = "coming-soon";
|
|
9
10
|
})(ChartType || (ChartType = {}));
|
|
10
11
|
export var ChartDataType;
|
|
11
12
|
(function (ChartDataType) {
|
|
12
13
|
ChartDataType["Status"] = "status";
|
|
13
14
|
ChartDataType["Severity"] = "severity";
|
|
14
15
|
})(ChartDataType || (ChartDataType = {}));
|
|
16
|
+
export var BarChartType;
|
|
17
|
+
(function (BarChartType) {
|
|
18
|
+
BarChartType["StatusBySeverity"] = "statusBySeverity";
|
|
19
|
+
BarChartType["StatusTrend"] = "statusTrend";
|
|
20
|
+
BarChartType["StatusChangeTrend"] = "statusChangeTrend";
|
|
21
|
+
})(BarChartType || (BarChartType = {}));
|
|
22
|
+
export var TreeMapChartType;
|
|
23
|
+
(function (TreeMapChartType) {
|
|
24
|
+
TreeMapChartType["SuccessRateDistribution"] = "successRateDistribution";
|
|
25
|
+
TreeMapChartType["CoverageDiff"] = "coverageDiff";
|
|
26
|
+
})(TreeMapChartType || (TreeMapChartType = {}));
|
|
15
27
|
export var ChartMode;
|
|
16
28
|
(function (ChartMode) {
|
|
17
29
|
ChartMode["Raw"] = "raw";
|
|
18
30
|
ChartMode["Percent"] = "percent";
|
|
19
31
|
})(ChartMode || (ChartMode = {}));
|
|
32
|
+
export var BarGroupMode;
|
|
33
|
+
(function (BarGroupMode) {
|
|
34
|
+
BarGroupMode["Grouped"] = "grouped";
|
|
35
|
+
BarGroupMode["Stacked"] = "stacked";
|
|
36
|
+
})(BarGroupMode || (BarGroupMode = {}));
|
package/dist/history.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type * from "./model.js";
|
|
|
9
9
|
export type * from "./testCase.js";
|
|
10
10
|
export type * from "./testPlan.js";
|
|
11
11
|
export type * from "./config.js";
|
|
12
|
+
export * from "./static.js";
|
|
12
13
|
export * from "./utils/step.js";
|
|
13
14
|
export type * from "./utils/tree.js";
|
|
14
15
|
export * from "./utils/time.js";
|
|
@@ -18,5 +19,7 @@ export * from "./utils/label.js";
|
|
|
18
19
|
export * from "./utils/testplan.js";
|
|
19
20
|
export * from "./utils/status.js";
|
|
20
21
|
export * from "./utils/environment.js";
|
|
22
|
+
export * from "./utils/history.js";
|
|
23
|
+
export * from "./utils/strings.js";
|
|
21
24
|
export * from "./charts/types.js";
|
|
22
25
|
export * from "./charts/utils.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./constants.js";
|
|
2
2
|
export * from "./ci.js";
|
|
3
|
+
export * from "./static.js";
|
|
3
4
|
export * from "./utils/step.js";
|
|
4
5
|
export * from "./utils/time.js";
|
|
5
6
|
export * from "./utils/comparator.js";
|
|
@@ -8,5 +9,7 @@ export * from "./utils/label.js";
|
|
|
8
9
|
export * from "./utils/testplan.js";
|
|
9
10
|
export * from "./utils/status.js";
|
|
10
11
|
export * from "./utils/environment.js";
|
|
12
|
+
export * from "./utils/history.js";
|
|
13
|
+
export * from "./utils/strings.js";
|
|
11
14
|
export * from "./charts/types.js";
|
|
12
15
|
export * from "./charts/utils.js";
|
package/dist/static.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const createScriptTag: (src: string, options?: {
|
|
2
|
+
async?: false;
|
|
3
|
+
defer?: false;
|
|
4
|
+
}) => string;
|
|
5
|
+
export declare const createStylesLinkTag: (src: string) => string;
|
|
6
|
+
export declare const createFontLinkTag: (src: string) => string;
|
|
7
|
+
export declare const createFaviconLinkTag: (src: string) => string;
|
|
8
|
+
export declare const createBaseUrlScript: () => string;
|
|
9
|
+
export declare const createReportDataScript: (reportFiles?: {
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[]) => string;
|
package/dist/static.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const createScriptTag = (src, options) => {
|
|
2
|
+
return `<script ${options?.async ? "async" : ""} ${options?.defer ? "defer" : ""} src="${src}"></script>`;
|
|
3
|
+
};
|
|
4
|
+
export const createStylesLinkTag = (src) => {
|
|
5
|
+
return `<link rel="stylesheet" type="text/css" href="${src}">`;
|
|
6
|
+
};
|
|
7
|
+
export const createFontLinkTag = (src) => {
|
|
8
|
+
return `<link rel="preload" href="${src}" as="font" type="font/woff" crossorigin /> `;
|
|
9
|
+
};
|
|
10
|
+
export const createFaviconLinkTag = (src) => {
|
|
11
|
+
return `<link rel="icon" href="${src}">`;
|
|
12
|
+
};
|
|
13
|
+
export const createBaseUrlScript = () => {
|
|
14
|
+
return `
|
|
15
|
+
<script>
|
|
16
|
+
const { origin, pathname } = window.location;
|
|
17
|
+
const url = new URL(pathname, origin);
|
|
18
|
+
const baseEl = document.createElement("base");
|
|
19
|
+
|
|
20
|
+
baseEl.href = url.toString();
|
|
21
|
+
|
|
22
|
+
window.document.head.appendChild(baseEl);
|
|
23
|
+
</script>
|
|
24
|
+
`;
|
|
25
|
+
};
|
|
26
|
+
export const createReportDataScript = (reportFiles = []) => {
|
|
27
|
+
if (!reportFiles?.length) {
|
|
28
|
+
return `
|
|
29
|
+
<script async>
|
|
30
|
+
window.allureReportDataReady = true;
|
|
31
|
+
</script>
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
const reportFilesDeclaration = reportFiles.map(({ name, value }) => `d('${name}','${value}')`).join(",");
|
|
35
|
+
return `
|
|
36
|
+
<script async>
|
|
37
|
+
window.allureReportDataReady = false;
|
|
38
|
+
window.allureReportData = window.allureReportData || {};
|
|
39
|
+
|
|
40
|
+
function d(name, value){
|
|
41
|
+
return new Promise(function (resolve) {
|
|
42
|
+
window.allureReportData[name] = value;
|
|
43
|
+
|
|
44
|
+
return resolve(true);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
<script defer>
|
|
49
|
+
Promise.allSettled([${reportFilesDeclaration}])
|
|
50
|
+
.then(function(){
|
|
51
|
+
window.allureReportDataReady = true;
|
|
52
|
+
})
|
|
53
|
+
</script>
|
|
54
|
+
`;
|
|
55
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const htrsByTr = (hdps, tr) => {
|
|
2
|
+
if (!tr?.historyId) {
|
|
3
|
+
return [];
|
|
4
|
+
}
|
|
5
|
+
return hdps.reduce((acc, dp) => {
|
|
6
|
+
const htr = dp.testResults[tr.historyId];
|
|
7
|
+
if (htr) {
|
|
8
|
+
if (dp.url) {
|
|
9
|
+
const url = new URL(dp.url);
|
|
10
|
+
url.hash = tr.id;
|
|
11
|
+
acc.push({
|
|
12
|
+
...htr,
|
|
13
|
+
url: url.toString(),
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
acc.push(htr);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return acc;
|
|
21
|
+
}, []);
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const capitalize: <T extends string>(str: T) => Capitalize<T> | undefined;
|