@allurereport/web-summary 3.0.0-beta.13 → 3.0.0-beta.15
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/app-0ae3d8a1.js +2 -0
- package/dist/manifest.json +1 -1
- package/package.json +4 -4
- package/src/components/MetadataRow/MetadataItem.tsx +56 -0
- package/src/components/MetadataRow/index.tsx +14 -8
- package/src/components/MetadataRow/styles.scss +113 -2
- package/src/components/ReportCard/index.tsx +62 -25
- package/src/components/ReportCard/styles.scss +21 -13
- package/src/index.tsx +1 -7
- package/src/styles.scss +2 -5
- package/dist/app-b6231977.js +0 -2
- /package/dist/{app-b6231977.js.LICENSE.txt → app-0ae3d8a1.js.LICENSE.txt} +0 -0
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/web-summary",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.15",
|
|
4
4
|
"description": "The static files for Allure Report Summary",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"IE 11"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
31
|
-
"@allurereport/web-commons": "3.0.0-beta.
|
|
32
|
-
"@allurereport/web-components": "3.0.0-beta.
|
|
30
|
+
"@allurereport/core-api": "3.0.0-beta.15",
|
|
31
|
+
"@allurereport/web-commons": "3.0.0-beta.15",
|
|
32
|
+
"@allurereport/web-components": "3.0.0-beta.15",
|
|
33
33
|
"@preact/signals": "^1.3.0",
|
|
34
34
|
"clsx": "^2.1.1",
|
|
35
35
|
"i18next": "^24.0.2",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Text } from "@allurereport/web-components";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import type { FunctionalComponent } from "preact";
|
|
4
|
+
import * as styles from "./styles.scss";
|
|
5
|
+
|
|
6
|
+
export type MetadataProps = {
|
|
7
|
+
count?: number;
|
|
8
|
+
title?: string;
|
|
9
|
+
type?: string;
|
|
10
|
+
status?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const MetadataValue: FunctionalComponent<MetadataProps> = ({ count }) => {
|
|
14
|
+
return (
|
|
15
|
+
<Text data-testid="metadata-value" type={"ui"} size={"m"} tag={"div"} className={styles["metadata-item-value"]}>
|
|
16
|
+
{count}
|
|
17
|
+
</Text>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
interface ReportMetadataItemProps {
|
|
22
|
+
className?: string;
|
|
23
|
+
renderComponent?: FunctionalComponent<MetadataProps>;
|
|
24
|
+
props?: MetadataProps;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const MetadataTestType: FunctionalComponent<MetadataProps> = ({ status, count }) => {
|
|
28
|
+
return (
|
|
29
|
+
<div data-testid="metadata-value" className={styles["metadata-test-type"]}>
|
|
30
|
+
<div className={clsx(styles["metadata-color-badge"], styles?.[`status-${status}`])} />
|
|
31
|
+
<Text type={"ui"} size={"s"}>
|
|
32
|
+
{count}
|
|
33
|
+
</Text>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const MetadataItem: FunctionalComponent<ReportMetadataItemProps> = ({
|
|
39
|
+
className,
|
|
40
|
+
renderComponent: RenderComponent = MetadataValue,
|
|
41
|
+
props,
|
|
42
|
+
...rest
|
|
43
|
+
}) => {
|
|
44
|
+
const { title } = props || {};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div {...rest} className={clsx("metadata-item", className)}>
|
|
48
|
+
<Text type={"ui"} size={"s"} tag={"div"} className={styles["metadata-item-title"]}>
|
|
49
|
+
{title}
|
|
50
|
+
</Text>
|
|
51
|
+
{RenderComponent ? <RenderComponent {...props} /> : <MetadataValue {...props} />}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default MetadataItem;
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { Text } from "@allurereport/web-components";
|
|
1
|
+
import { Text, TooltipWrapper } from "@allurereport/web-components";
|
|
2
|
+
import clsx from "clsx";
|
|
2
3
|
import type { FunctionalComponent } from "preact";
|
|
3
4
|
import * as styles from "./styles.scss";
|
|
4
5
|
|
|
5
6
|
export type MetadataRowProps = {
|
|
6
7
|
label: string;
|
|
8
|
+
status: string;
|
|
7
9
|
};
|
|
8
10
|
|
|
9
|
-
export const MetadataRow: FunctionalComponent<MetadataRowProps> = ({ label, children }) => {
|
|
11
|
+
export const MetadataRow: FunctionalComponent<MetadataRowProps> = ({ status, label, children }) => {
|
|
10
12
|
return (
|
|
11
13
|
<div className={styles["metadata-row"]}>
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
<TooltipWrapper tooltipText={label}>
|
|
15
|
+
<Text
|
|
16
|
+
className={clsx(styles["metadata-row-number"], styles[`status-${status.toLowerCase()}`])}
|
|
17
|
+
type={"ui"}
|
|
18
|
+
size={"s"}
|
|
19
|
+
tag={"div"}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</Text>
|
|
23
|
+
</TooltipWrapper>
|
|
18
24
|
</div>
|
|
19
25
|
);
|
|
20
26
|
};
|
|
@@ -1,9 +1,120 @@
|
|
|
1
|
+
@import "~@allurereport/web-components/mixins.scss";
|
|
2
|
+
|
|
1
3
|
.metadata-row {
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: 12px;
|
|
6
|
+
color: var(--on-text-secondary);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.metadata-row-number {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
padding: 0 8px;
|
|
14
|
+
color: var(--constant-on-text-primary);
|
|
15
|
+
border-radius: 12px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.status-total {
|
|
19
|
+
color: var(--on-text-primary);
|
|
20
|
+
background: var(--bg-control-secondary);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.report-metadata {
|
|
24
|
+
padding-top: 20px;
|
|
25
|
+
padding-bottom: 20px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.report-metadata-wrapper {
|
|
29
|
+
padding: 0 24px;
|
|
30
|
+
align-items: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.report-metadata-separator {
|
|
34
|
+
border-left: 1px solid var(--on-border-primary);
|
|
35
|
+
height: 24px;
|
|
36
|
+
margin: 11px 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.report-metadata-status {
|
|
40
|
+
display: flex;
|
|
41
|
+
gap: 24px;
|
|
42
|
+
align-items: center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.report-metadata-summary {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: space-between;
|
|
48
|
+
align-items: baseline;
|
|
49
|
+
padding: 16px 0;
|
|
50
|
+
border-top: 1px solid var(--on-border-primary);
|
|
51
|
+
border-bottom: 1px solid var(--on-border-primary);
|
|
52
|
+
width: 100%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.report-metadata-all-tests {
|
|
56
|
+
display: flex;
|
|
57
|
+
gap: 24px;
|
|
58
|
+
margin-right: 8px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.metadata-item-title {
|
|
62
|
+
color: var(--on-text-secondary);
|
|
63
|
+
margin-bottom: 6px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.metadata-item-value {
|
|
67
|
+
font-weight: bold;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.report-metadata {
|
|
71
|
+
border-bottom: 1px solid var(--on-border-primary);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.report-metadata-keyvalue {
|
|
2
75
|
display: grid;
|
|
3
76
|
grid-template-columns: 1fr 1fr;
|
|
77
|
+
gap: 8px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.report-metadata-keyvalue-title {
|
|
81
|
+
padding: 8px 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.report-metadata-keyvalue-value {
|
|
85
|
+
padding: 8px 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.report-metadata-list {
|
|
89
|
+
display: grid;
|
|
90
|
+
column-gap: 48px;
|
|
91
|
+
grid-template-columns: repeat(2, 1fr);
|
|
92
|
+
grid-template-rows: repeat(5, auto);
|
|
93
|
+
grid-auto-flow: column;
|
|
94
|
+
padding-top: 16px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.metadata-test-type {
|
|
98
|
+
display: flex;
|
|
4
99
|
color: var(--on-text-secondary);
|
|
5
100
|
}
|
|
6
101
|
|
|
7
|
-
.
|
|
8
|
-
|
|
102
|
+
.metadata-color-badge {
|
|
103
|
+
width: 4px;
|
|
104
|
+
height: 12px;
|
|
105
|
+
border-radius: 2px;
|
|
106
|
+
background: var(--on-text-secondary);
|
|
107
|
+
margin-right: 8px;
|
|
108
|
+
align-self: center;
|
|
109
|
+
@include status-bg-and-text();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.metadata-with-icon {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.metadata-icon {
|
|
118
|
+
margin-right: 8px;
|
|
119
|
+
color: var(--on-icon-secondary);
|
|
9
120
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type Statistic, type TestStatus, formatDuration } from "@allurereport/core-api";
|
|
2
|
+
import { capitalize } from "@allurereport/web-commons";
|
|
2
3
|
import { Heading, StatusLabel, SuccessRatePieChart, Text, getChartData } from "@allurereport/web-components";
|
|
3
4
|
import type { FunctionalComponent } from "preact";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import type { MetadataProps } from "@/components/MetadataRow/MetadataItem";
|
|
6
|
+
import MetadataItem, { MetadataTestType } from "@/components/MetadataRow/MetadataItem";
|
|
7
|
+
import { currentLocaleIso, useI18n } from "@/stores";
|
|
6
8
|
import * as styles from "./styles.scss";
|
|
7
9
|
|
|
8
10
|
export type ReportCardProps = {
|
|
@@ -11,12 +13,30 @@ export type ReportCardProps = {
|
|
|
11
13
|
status: TestStatus;
|
|
12
14
|
stats: Statistic;
|
|
13
15
|
duration: number;
|
|
16
|
+
plugin?: string;
|
|
17
|
+
createdAt?: number;
|
|
14
18
|
};
|
|
15
19
|
|
|
16
|
-
export const ReportCard: FunctionalComponent<ReportCardProps> = ({
|
|
20
|
+
export const ReportCard: FunctionalComponent<ReportCardProps> = ({
|
|
21
|
+
href,
|
|
22
|
+
status,
|
|
23
|
+
stats,
|
|
24
|
+
name,
|
|
25
|
+
duration,
|
|
26
|
+
plugin,
|
|
27
|
+
createdAt,
|
|
28
|
+
}) => {
|
|
17
29
|
const { t } = useI18n("summary");
|
|
18
30
|
const { percentage, slices } = getChartData(stats);
|
|
19
31
|
const formattedDuration = formatDuration(duration);
|
|
32
|
+
const formattedCreatedAt = new Date(createdAt as number).toLocaleDateString(currentLocaleIso.value as string, {
|
|
33
|
+
month: "long",
|
|
34
|
+
day: "numeric",
|
|
35
|
+
year: "numeric",
|
|
36
|
+
hour: "numeric",
|
|
37
|
+
minute: "numeric",
|
|
38
|
+
second: "numeric",
|
|
39
|
+
});
|
|
20
40
|
|
|
21
41
|
return (
|
|
22
42
|
<a
|
|
@@ -26,15 +46,22 @@ export const ReportCard: FunctionalComponent<ReportCardProps> = ({ href, status,
|
|
|
26
46
|
target={"_blank"}
|
|
27
47
|
rel="noreferrer"
|
|
28
48
|
>
|
|
29
|
-
<div className={styles["report-card-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
<div className={styles["report-card-content"]}>
|
|
50
|
+
{plugin && (
|
|
51
|
+
<Text type={"ui"} tag={"div"} size={"s"} className={styles["report-card-plugin"]}>
|
|
52
|
+
{plugin}
|
|
53
|
+
</Text>
|
|
54
|
+
)}
|
|
33
55
|
<div className={styles["report-card-title"]}>
|
|
34
56
|
<Heading tag={"h2"} size={"s"}>
|
|
35
57
|
{name}
|
|
36
58
|
</Heading>
|
|
37
59
|
</div>
|
|
60
|
+
{formattedCreatedAt && (
|
|
61
|
+
<Text tag={"div"} size={"s"} className={styles["report-card-created-at"]}>
|
|
62
|
+
{formattedCreatedAt}
|
|
63
|
+
</Text>
|
|
64
|
+
)}
|
|
38
65
|
<div className={styles["report-card-status"]}>
|
|
39
66
|
<StatusLabel status={status}>{t(status)}</StatusLabel>
|
|
40
67
|
<Text type={"ui"} size={"s"}>
|
|
@@ -45,26 +72,36 @@ export const ReportCard: FunctionalComponent<ReportCardProps> = ({ href, status,
|
|
|
45
72
|
</Text>
|
|
46
73
|
</div>
|
|
47
74
|
<div className={styles["report-card-metadata"]}>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
{[
|
|
76
|
+
{ label: "total", value: stats?.total },
|
|
77
|
+
{ label: "failed", value: stats?.failed },
|
|
78
|
+
{ label: "broken", value: stats?.broken },
|
|
79
|
+
{ label: "passed", value: stats?.passed },
|
|
80
|
+
{ label: "skipped", value: stats?.skipped },
|
|
81
|
+
{ label: "unknown", value: stats?.unknown },
|
|
82
|
+
]
|
|
83
|
+
.filter((item) => item.value)
|
|
84
|
+
.map(({ label, value }) => {
|
|
85
|
+
const props = {
|
|
86
|
+
title: capitalize(t(label)),
|
|
87
|
+
count: value,
|
|
88
|
+
status: label,
|
|
89
|
+
} as MetadataProps;
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<MetadataItem
|
|
93
|
+
data-testid={`metadata-item-${label}`}
|
|
94
|
+
key={label}
|
|
95
|
+
props={props}
|
|
96
|
+
renderComponent={MetadataTestType}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
})}
|
|
66
100
|
</div>
|
|
67
101
|
</div>
|
|
102
|
+
<div className={styles["report-card-chart-wrapper"]}>
|
|
103
|
+
<SuccessRatePieChart className={styles["report-card-chart"]} slices={slices} percentage={percentage} />
|
|
104
|
+
</div>
|
|
68
105
|
</a>
|
|
69
106
|
);
|
|
70
107
|
};
|
|
@@ -1,49 +1,57 @@
|
|
|
1
1
|
.report-card {
|
|
2
2
|
display: grid;
|
|
3
|
-
grid-template-columns: 1fr
|
|
3
|
+
grid-template-columns: 2fr 1fr;
|
|
4
4
|
gap: 0 16px;
|
|
5
5
|
padding: 16px;
|
|
6
6
|
height: 100%;
|
|
7
7
|
text-decoration: none;
|
|
8
|
-
box-shadow: var(--shadow-small);
|
|
9
8
|
background: var(--bg-base-primary);
|
|
9
|
+
border: 1px solid var(--bg-base-secondary);
|
|
10
10
|
border-radius: 12px;
|
|
11
11
|
cursor: pointer;
|
|
12
12
|
|
|
13
13
|
&:hover {
|
|
14
|
-
box-shadow: none;
|
|
15
14
|
transition: box-shadow 0.2s;
|
|
15
|
+
box-shadow: var(--shadow-small);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
.report-card-plugin {
|
|
20
|
+
color: var(--on-text-secondary);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.report-card-created-at {
|
|
24
|
+
margin-bottom: 8px;
|
|
25
|
+
color: var(--on-text-secondary);
|
|
26
|
+
}
|
|
27
|
+
|
|
19
28
|
.report-card-chart {
|
|
20
|
-
position: absolute;
|
|
21
29
|
top: 0;
|
|
22
30
|
left: 0;
|
|
23
31
|
width: 100%;
|
|
32
|
+
max-width: 88px;
|
|
33
|
+
max-height: 88px;
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
.report-card-chart-wrapper {
|
|
27
|
-
|
|
37
|
+
display: flex;
|
|
38
|
+
justify-content: flex-end;
|
|
39
|
+
align-items: center;
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
.report-card-title {
|
|
31
|
-
|
|
32
|
-
color: var(--on-text-secondary);
|
|
43
|
+
color: var(--on-text-primary);
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
.report-card-status {
|
|
36
47
|
display: flex;
|
|
37
48
|
align-items: center;
|
|
38
49
|
gap: 0 4px;
|
|
39
|
-
margin-bottom:
|
|
50
|
+
margin-bottom: 16px;
|
|
40
51
|
color: var(--on-text-secondary);
|
|
41
52
|
}
|
|
42
53
|
|
|
43
54
|
.report-card-metadata {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
margin-bottom: 2px;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
55
|
+
display: flex;
|
|
56
|
+
gap: 12px;
|
|
49
57
|
}
|
package/src/index.tsx
CHANGED
|
@@ -36,13 +36,7 @@ const App = () => {
|
|
|
36
36
|
{summaries.map((summary: any) => {
|
|
37
37
|
return (
|
|
38
38
|
<li key={summary.output}>
|
|
39
|
-
<ReportCard
|
|
40
|
-
href={summary.href}
|
|
41
|
-
name={summary.name}
|
|
42
|
-
status={summary.status}
|
|
43
|
-
stats={summary.stats}
|
|
44
|
-
duration={summary.duration}
|
|
45
|
-
/>
|
|
39
|
+
<ReportCard {...summary} />
|
|
46
40
|
</li>
|
|
47
41
|
);
|
|
48
42
|
})}
|
package/src/styles.scss
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
8
|
gap: 16px;
|
|
9
|
-
padding: 16px
|
|
9
|
+
padding: 16px 16px 24px 16px;
|
|
10
10
|
max-width: var(--showcase-width);
|
|
11
11
|
margin: 0 auto;
|
|
12
12
|
min-height: 100vh;
|
|
@@ -14,12 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
.summary-showcase {
|
|
16
16
|
display: grid;
|
|
17
|
-
grid-template-columns: repeat(
|
|
17
|
+
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
|
|
18
18
|
gap: 8px;
|
|
19
19
|
margin-bottom: 40px;
|
|
20
|
-
//max-width: var(--showcase-width);
|
|
21
|
-
//margin: 0 auto;
|
|
22
|
-
//padding: 40px;
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
.summary-card {
|