@allurereport/charts-api 3.0.0-beta.27 → 3.0.1

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/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BarChartType, ChartType, FunnelChartType, TreeMapChartType } from "./types.js";
1
+ import { ChartType } from "./types.js";
2
2
  export const DEFAULT_CHART_HISTORY_LIMIT = 10;
3
3
  export const defaultChartsConfig = [
4
4
  {
@@ -10,57 +10,74 @@ export const defaultChartsConfig = [
10
10
  title: "Status dynamics",
11
11
  },
12
12
  {
13
- type: ChartType.Bar,
14
- dataType: BarChartType.StatusBySeverity,
15
- title: "Test result severities",
13
+ type: ChartType.TrSeverities,
14
+ title: "Test results by severities",
15
+ levels: ["blocker", "critical", "normal", "minor", "trivial"],
16
+ statuses: ["passed", "failed", "broken", "skipped", "unknown"],
17
+ includeUnset: true,
16
18
  },
17
19
  {
18
- type: ChartType.Bar,
19
- dataType: BarChartType.StatusTrend,
20
- title: "Status change dynamics",
20
+ type: ChartType.StatusTransitions,
21
+ title: "Status transitions",
21
22
  },
22
23
  {
23
- type: ChartType.Bar,
24
- dataType: BarChartType.StatusChangeTrend,
24
+ type: ChartType.TestBaseGrowthDynamics,
25
25
  title: "Test base growth dynamics",
26
26
  },
27
27
  {
28
- type: ChartType.TreeMap,
29
- dataType: TreeMapChartType.CoverageDiff,
28
+ type: ChartType.CoverageDiff,
30
29
  title: "Coverage diff map",
31
30
  },
32
31
  {
33
- type: ChartType.TreeMap,
34
- dataType: TreeMapChartType.SuccessRateDistribution,
32
+ type: ChartType.SuccessRateDistribution,
35
33
  title: "Success rate distribution",
36
34
  },
37
35
  {
38
- type: ChartType.HeatMap,
36
+ type: ChartType.ProblemsDistribution,
37
+ by: "environment",
39
38
  title: "Problems distribution by environment",
40
39
  },
41
40
  {
42
- type: ChartType.Bar,
43
- dataType: BarChartType.StabilityRateDistribution,
44
- title: "Stability rate distribution",
41
+ type: ChartType.StabilityDistribution,
42
+ title: "Stability distribution by features",
43
+ skipStatuses: ["skipped", "unknown"],
44
+ threshold: 90,
45
+ groupBy: "feature",
45
46
  },
46
47
  {
47
- type: ChartType.Bar,
48
- dataType: BarChartType.DurationsByLayer,
48
+ type: ChartType.StabilityDistribution,
49
+ title: "Stability distribution by epics",
50
+ skipStatuses: ["skipped", "unknown"],
51
+ threshold: 90,
52
+ groupBy: "epic",
53
+ },
54
+ {
55
+ type: ChartType.StabilityDistribution,
56
+ title: "Stability distribution by stories",
57
+ skipStatuses: ["skipped", "unknown"],
58
+ threshold: 90,
59
+ groupBy: "story",
60
+ },
61
+ {
62
+ type: ChartType.Durations,
63
+ title: "Durations histogram",
64
+ groupBy: "none",
65
+ },
66
+ {
67
+ type: ChartType.Durations,
49
68
  title: "Durations by layer histogram",
69
+ groupBy: "layer",
50
70
  },
51
71
  {
52
- type: ChartType.Bar,
53
- dataType: "performanceTrend",
54
- title: "Performance dynamics",
72
+ type: ChartType.DurationDynamics,
73
+ title: "Durations dynamics",
55
74
  },
56
75
  {
57
- type: ChartType.Bar,
58
- dataType: BarChartType.FbsuAgePyramid,
76
+ type: ChartType.FBSUAgePyramid,
59
77
  title: "FBSU age pyramid",
60
78
  },
61
79
  {
62
- type: ChartType.Funnel,
63
- dataType: FunnelChartType.TestingPyramid,
80
+ type: ChartType.TestingPyramid,
64
81
  title: "Testing pyramid",
65
82
  },
66
83
  ];
package/dist/types.d.ts CHANGED
@@ -1,33 +1,23 @@
1
1
  import type { HistoryDataPoint, SeverityLevel, Statistic, TestResult, TestStatus } from "@allurereport/core-api";
2
2
  export declare enum ChartType {
3
- Trend = "trend",
4
3
  CurrentStatus = "currentStatus",
5
4
  StatusDynamics = "statusDynamics",
6
- TreeMap = "treemap",
7
- HeatMap = "heatmap",
8
- Bar = "bar",
9
- Funnel = "funnel",
10
- ComingSoon = "coming-soon"
5
+ StatusTransitions = "statusTransitions",
6
+ StabilityDistribution = "stabilityDistribution",
7
+ TestBaseGrowthDynamics = "testBaseGrowthDynamics",
8
+ FBSUAgePyramid = "fbsuAgePyramid",
9
+ Durations = "durations",
10
+ DurationDynamics = "durationDynamics",
11
+ TrSeverities = "testResultSeverities",
12
+ TestingPyramid = "testingPyramid",
13
+ CoverageDiff = "coverageDiff",
14
+ SuccessRateDistribution = "successRateDistribution",
15
+ ProblemsDistribution = "problemsDistribution"
11
16
  }
12
17
  export declare enum ChartDataType {
13
18
  Status = "status",
14
19
  Severity = "severity"
15
20
  }
16
- export declare enum BarChartType {
17
- StatusBySeverity = "statusBySeverity",
18
- StatusTrend = "statusTrend",
19
- StatusChangeTrend = "statusChangeTrend",
20
- DurationsByLayer = "durationsByLayer",
21
- FbsuAgePyramid = "fbsuAgePyramid",
22
- StabilityRateDistribution = "stabilityRateDistribution"
23
- }
24
- export declare enum FunnelChartType {
25
- TestingPyramid = "testingPyramid"
26
- }
27
- export declare enum TreeMapChartType {
28
- SuccessRateDistribution = "successRateDistribution",
29
- CoverageDiff = "coverageDiff"
30
- }
31
21
  export declare enum ChartMode {
32
22
  Raw = "raw",
33
23
  Percent = "percent",
@@ -51,8 +41,9 @@ export interface TrendSlice<Metadata extends BaseTrendSliceMetadata = BaseTrendS
51
41
  max: number;
52
42
  metadata: TrendSliceMetadata<Metadata>;
53
43
  }
44
+ export type PieSliceStatus = TestStatus | "__empty__";
54
45
  export interface BasePieSlice {
55
- status: TestStatus;
46
+ status: PieSliceStatus;
56
47
  count: number;
57
48
  }
58
49
  export interface PieSlice extends BasePieSlice {
@@ -62,16 +53,6 @@ export type PieChartValues = {
62
53
  percentage: number;
63
54
  slices: PieSlice[];
64
55
  };
65
- export type BarGroupValues<T extends string = string> = Record<T, number>;
66
- export type BarGroup<G extends string, T extends string = string> = {
67
- groupId: G;
68
- } & BarGroupValues<T>;
69
- export declare enum BarGroupMode {
70
- Grouped = "grouped",
71
- Stacked = "stacked"
72
- }
73
- export type NewKey<T extends string> = `new${Capitalize<T>}`;
74
- export type RemovedKey<T extends string> = `removed${Capitalize<T>}`;
75
56
  export type TreeMapNode<T extends Record<string, any> = {}> = T & {
76
57
  id: string;
77
58
  value?: number;
@@ -99,7 +80,7 @@ export type TrendCalculationResult<T extends TrendDataType> = {
99
80
  series: Record<T, TrendPointId[]>;
100
81
  };
101
82
  export interface GenericTrendChartData<SeriesType extends string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> {
102
- type: ChartType.Trend;
83
+ type: "trend";
103
84
  dataType: ChartDataType;
104
85
  mode: ChartMode;
105
86
  title?: string;
@@ -112,52 +93,25 @@ export interface GenericTrendChartData<SeriesType extends string, Metadata exten
112
93
  export type StatusTrendChartData = GenericTrendChartData<TestStatus>;
113
94
  export type SeverityTrendChartData = GenericTrendChartData<SeverityLevel>;
114
95
  export type TrendChartData = StatusTrendChartData | SeverityTrendChartData;
115
- export interface BarChartData {
116
- type: ChartType.Bar;
117
- dataType: BarChartType;
118
- mode: ChartMode;
119
- title?: string;
120
- data: BarGroup<string, string>[];
121
- keys: readonly string[];
122
- indexBy: string;
123
- groupMode: BarGroupMode;
124
- xAxisConfig?: {
125
- legend?: string;
126
- enabled?: boolean;
127
- format?: string;
128
- domain?: number[];
129
- tickValues?: number | number[];
130
- };
131
- yAxisConfig?: {
132
- legend?: string;
133
- enabled?: boolean;
134
- format?: string;
135
- tickValues?: number | number[];
136
- domain?: number[];
137
- };
138
- layout?: "horizontal" | "vertical";
139
- threshold?: number;
140
- }
141
96
  export interface TreeMapChartData {
142
- type: ChartType.TreeMap;
143
- dataType: TreeMapChartType;
97
+ type: ChartType.CoverageDiff | ChartType.SuccessRateDistribution;
144
98
  title?: string;
145
99
  treeMap: TreeMapNode;
146
100
  }
147
101
  export interface HeatMapChartData<T extends Record<string, any> = {}> {
148
- type: ChartType.HeatMap;
102
+ type: ChartType.ProblemsDistribution;
149
103
  title?: string;
150
104
  data: HeatMapSerie<T>[];
151
105
  }
152
- export interface ComingSoonChartData {
153
- type: ChartType.ComingSoon;
106
+ export interface TestingPyramidChartData {
107
+ type: ChartType.TestingPyramid;
154
108
  title?: string;
155
- }
156
- export interface FunnelChartData {
157
- type: ChartType.Funnel;
158
- dataType: FunnelChartType;
159
- title?: string;
160
- data: Record<string, number | string>[];
109
+ data: {
110
+ layer: string;
111
+ testCount: number;
112
+ successRate: number;
113
+ percentage: number;
114
+ }[];
161
115
  }
162
116
  export interface CurrentStatusChartData {
163
117
  type: ChartType.CurrentStatus;
@@ -176,16 +130,89 @@ export interface StatusDynamicsChartData {
176
130
  limit?: number;
177
131
  statuses?: TestStatus[];
178
132
  }
179
- export type GeneratedChartData = TrendChartData | BarChartData | CurrentStatusChartData | StatusDynamicsChartData | ComingSoonChartData | TreeMapChartData | HeatMapChartData | FunnelChartData;
180
- export type GeneratedChartsData = Record<ChartId, GeneratedChartData>;
181
- export type TrendChartOptions = {
182
- type: ChartType.Trend;
183
- dataType: ChartDataType;
184
- mode?: ChartMode;
133
+ export interface StatusTransitionsChartData {
134
+ type: ChartType.StatusTransitions;
185
135
  title?: string;
186
- limit?: number;
187
- metadata?: TrendMetadataFnOverrides;
136
+ data: {
137
+ id: string | "current";
138
+ timestamp: number;
139
+ prevItemTimestamp: number;
140
+ fixed: number;
141
+ regressed: number;
142
+ malfunctioned: number;
143
+ }[];
144
+ }
145
+ export interface DurationsChartData {
146
+ type: ChartType.Durations;
147
+ title?: string;
148
+ data: {
149
+ from: number;
150
+ to: number;
151
+ [key: string]: number;
152
+ }[];
153
+ keys: {
154
+ [id: string]: string;
155
+ };
156
+ groupBy: "layer" | "none";
157
+ }
158
+ export interface StabilityDistributionChartData {
159
+ type: ChartType.StabilityDistribution;
160
+ title?: string;
161
+ data: {
162
+ id: string;
163
+ stabilityRate: number;
164
+ }[];
165
+ keys: {
166
+ [id: string]: string;
167
+ };
168
+ threshold?: number;
169
+ }
170
+ export interface TestBaseGrowthDynamicsChartData {
171
+ type: ChartType.TestBaseGrowthDynamics;
172
+ title?: string;
173
+ data: ({
174
+ [key in `new:${TestStatus}` | `removed:${TestStatus}`]: number;
175
+ } & {
176
+ id: string;
177
+ timestamp: number;
178
+ })[];
179
+ statuses: TestStatus[];
180
+ }
181
+ export interface FBSUAgePyramidChartData {
182
+ type: ChartType.FBSUAgePyramid;
183
+ title?: string;
184
+ data: {
185
+ id: string;
186
+ timestamp: number;
187
+ failed: number;
188
+ broken: number;
189
+ skipped: number;
190
+ unknown: number;
191
+ }[];
192
+ statuses: Exclude<TestStatus, "passed">[];
193
+ }
194
+ export type TrSeveritiesChartData = {
195
+ type: ChartType.TrSeverities;
196
+ title?: string;
197
+ data: ({
198
+ id: SeverityLevel | "unset";
199
+ } & Record<TestStatus, number>)[];
200
+ levels: (SeverityLevel | "unset")[];
201
+ statuses: TestStatus[];
188
202
  };
203
+ export type DurationDynamicsChartData = {
204
+ type: ChartType.DurationDynamics;
205
+ title?: string;
206
+ data: {
207
+ id: string;
208
+ timestamp: number;
209
+ duration: number;
210
+ sequentialDuration: number;
211
+ speedup: number;
212
+ }[];
213
+ };
214
+ export type GeneratedChartData = TrendChartData | CurrentStatusChartData | StatusDynamicsChartData | StatusTransitionsChartData | DurationsChartData | StabilityDistributionChartData | TestBaseGrowthDynamicsChartData | FBSUAgePyramidChartData | TreeMapChartData | HeatMapChartData | TestingPyramidChartData | TrSeveritiesChartData | DurationDynamicsChartData;
215
+ export type GeneratedChartsData = Record<ChartId, GeneratedChartData>;
189
216
  export type CurrentStatusChartOptions = {
190
217
  type: ChartType.CurrentStatus;
191
218
  title?: string;
@@ -198,34 +225,62 @@ export type StatusDynamicsChartOptions = {
198
225
  limit?: number;
199
226
  statuses?: TestStatus[];
200
227
  };
201
- export type BarChartOptions = {
202
- type: ChartType.Bar;
203
- dataType: BarChartType;
204
- mode?: ChartMode;
228
+ export type StatusTransitionsChartOptions = {
229
+ type: ChartType.StatusTransitions;
205
230
  title?: string;
206
231
  limit?: number;
232
+ };
233
+ export type DurationsChartOptions = {
234
+ type: ChartType.Durations;
235
+ title?: string;
236
+ groupBy?: "layer" | "none";
237
+ };
238
+ export type StabilityDistributionChartOptions = {
239
+ type: ChartType.StabilityDistribution;
240
+ title?: string;
207
241
  threshold?: number;
242
+ skipStatuses?: TestStatus[];
243
+ groupBy?: "feature" | "epic" | "story" | "suite" | "severity" | "owner" | `label-name:${string}`;
244
+ groupValues?: string[];
208
245
  };
209
- export type TreeMapChartOptions = {
210
- type: ChartType.TreeMap;
211
- dataType: TreeMapChartType;
246
+ export type TestBaseGrowthDynamicsChartOptions = {
247
+ type: ChartType.TestBaseGrowthDynamics;
212
248
  title?: string;
249
+ statuses?: TestStatus[];
250
+ limit?: number;
213
251
  };
214
- export type HeatMapChartOptions = {
215
- type: ChartType.HeatMap;
252
+ export type FBSUAgePyramidChartOptions = {
253
+ type: ChartType.FBSUAgePyramid;
254
+ title?: string;
255
+ limit?: number;
256
+ };
257
+ export type TrSeveritiesChartOptions = {
258
+ type: ChartType.TrSeverities;
216
259
  title?: string;
260
+ levels?: SeverityLevel[];
261
+ statuses?: TestStatus[];
262
+ includeUnset?: boolean;
217
263
  };
218
- export type ComingSoonChartOptions = {
219
- type: ChartType.ComingSoon;
264
+ export type DurationDynamicsChartOptions = {
265
+ type: ChartType.DurationDynamics;
220
266
  title?: string;
267
+ limit?: number;
221
268
  };
222
- export type FunnelChartOptions = {
223
- type: ChartType.Funnel;
224
- dataType: FunnelChartType;
269
+ export type TreeMapChartOptions = {
270
+ type: ChartType.CoverageDiff | ChartType.SuccessRateDistribution;
271
+ title?: string;
272
+ };
273
+ export type HeatMapChartOptions = {
274
+ type: ChartType.ProblemsDistribution;
275
+ by: "environment";
276
+ title?: string;
277
+ };
278
+ export type TestingPyramidChartOptions = {
279
+ type: ChartType.TestingPyramid;
225
280
  title?: string;
226
281
  layers?: string[];
227
282
  };
228
- export type ChartOptions = TrendChartOptions | CurrentStatusChartOptions | StatusDynamicsChartOptions | BarChartOptions | ComingSoonChartOptions | TreeMapChartOptions | HeatMapChartOptions | FunnelChartOptions;
283
+ export type ChartOptions = CurrentStatusChartOptions | StatusDynamicsChartOptions | DurationsChartOptions | TreeMapChartOptions | HeatMapChartOptions | TestingPyramidChartOptions | StatusTransitionsChartOptions | StabilityDistributionChartOptions | FBSUAgePyramidChartOptions | TestBaseGrowthDynamicsChartOptions | TrSeveritiesChartOptions | DurationDynamicsChartOptions;
229
284
  export interface AllureChartsStoreData {
230
285
  historyDataPoints: HistoryDataPoint[];
231
286
  testResults: TestResult[];
@@ -236,11 +291,6 @@ export interface TrendDataAccessor<T extends TrendDataType> {
236
291
  getHistoricalData: (historyPoint: HistoryDataPoint) => TrendStats<T>;
237
292
  getAllValues: () => readonly T[];
238
293
  }
239
- export interface BarDataAccessor<G extends string, T extends string> {
240
- getItems: (storeData: AllureChartsStoreData, limitedHistoryDataPoints: HistoryDataPoint[], isFullHistory: boolean) => BarGroup<G, T>[];
241
- getGroupKeys: () => readonly T[];
242
- getGroupMode: () => BarGroupMode;
243
- }
244
294
  export interface TreeMapDataAccessor<T extends TreeMapNode> {
245
295
  getTreeMap: (storeData: AllureChartsStoreData) => T;
246
296
  }
package/dist/types.js CHANGED
@@ -1,45 +1,27 @@
1
1
  export var ChartType;
2
2
  (function (ChartType) {
3
- ChartType["Trend"] = "trend";
4
3
  ChartType["CurrentStatus"] = "currentStatus";
5
4
  ChartType["StatusDynamics"] = "statusDynamics";
6
- ChartType["TreeMap"] = "treemap";
7
- ChartType["HeatMap"] = "heatmap";
8
- ChartType["Bar"] = "bar";
9
- ChartType["Funnel"] = "funnel";
10
- ChartType["ComingSoon"] = "coming-soon";
5
+ ChartType["StatusTransitions"] = "statusTransitions";
6
+ ChartType["StabilityDistribution"] = "stabilityDistribution";
7
+ ChartType["TestBaseGrowthDynamics"] = "testBaseGrowthDynamics";
8
+ ChartType["FBSUAgePyramid"] = "fbsuAgePyramid";
9
+ ChartType["Durations"] = "durations";
10
+ ChartType["DurationDynamics"] = "durationDynamics";
11
+ ChartType["TrSeverities"] = "testResultSeverities";
12
+ ChartType["TestingPyramid"] = "testingPyramid";
13
+ ChartType["CoverageDiff"] = "coverageDiff";
14
+ ChartType["SuccessRateDistribution"] = "successRateDistribution";
15
+ ChartType["ProblemsDistribution"] = "problemsDistribution";
11
16
  })(ChartType || (ChartType = {}));
12
17
  export var ChartDataType;
13
18
  (function (ChartDataType) {
14
19
  ChartDataType["Status"] = "status";
15
20
  ChartDataType["Severity"] = "severity";
16
21
  })(ChartDataType || (ChartDataType = {}));
17
- export var BarChartType;
18
- (function (BarChartType) {
19
- BarChartType["StatusBySeverity"] = "statusBySeverity";
20
- BarChartType["StatusTrend"] = "statusTrend";
21
- BarChartType["StatusChangeTrend"] = "statusChangeTrend";
22
- BarChartType["DurationsByLayer"] = "durationsByLayer";
23
- BarChartType["FbsuAgePyramid"] = "fbsuAgePyramid";
24
- BarChartType["StabilityRateDistribution"] = "stabilityRateDistribution";
25
- })(BarChartType || (BarChartType = {}));
26
- export var FunnelChartType;
27
- (function (FunnelChartType) {
28
- FunnelChartType["TestingPyramid"] = "testingPyramid";
29
- })(FunnelChartType || (FunnelChartType = {}));
30
- export var TreeMapChartType;
31
- (function (TreeMapChartType) {
32
- TreeMapChartType["SuccessRateDistribution"] = "successRateDistribution";
33
- TreeMapChartType["CoverageDiff"] = "coverageDiff";
34
- })(TreeMapChartType || (TreeMapChartType = {}));
35
22
  export var ChartMode;
36
23
  (function (ChartMode) {
37
24
  ChartMode["Raw"] = "raw";
38
25
  ChartMode["Percent"] = "percent";
39
26
  ChartMode["Diverging"] = "diverging";
40
27
  })(ChartMode || (ChartMode = {}));
41
- export var BarGroupMode;
42
- (function (BarGroupMode) {
43
- BarGroupMode["Grouped"] = "grouped";
44
- BarGroupMode["Stacked"] = "stacked";
45
- })(BarGroupMode || (BarGroupMode = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/charts-api",
3
- "version": "3.0.0-beta.27",
3
+ "version": "3.0.1",
4
4
  "description": "Allure Charts API",
5
5
  "keywords": [
6
6
  "allure",
@@ -27,8 +27,8 @@
27
27
  "eslint:format": "eslint --fix ./src/**/*.{js,jsx,ts,tsx}"
28
28
  },
29
29
  "dependencies": {
30
- "@allurereport/core-api": "3.0.0-beta.27",
31
- "@allurereport/plugin-api": "3.0.0-beta.27",
30
+ "@allurereport/core-api": "3.0.1",
31
+ "@allurereport/plugin-api": "3.0.1",
32
32
  "d3-shape": "^3.2.0"
33
33
  },
34
34
  "devDependencies": {