@allurereport/web-awesome 3.0.0-beta.10

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.
Files changed (196) hide show
  1. package/.babelrc.js +46 -0
  2. package/.eslintrc.cjs +18 -0
  3. package/CONTRIBUTING.md +34 -0
  4. package/README.md +27 -0
  5. package/dist/multi/141.app-d01d0c66.js +1 -0
  6. package/dist/multi/222.app-d01d0c66.js +1 -0
  7. package/dist/multi/335.app-d01d0c66.js +1 -0
  8. package/dist/multi/34.app-d01d0c66.js +1 -0
  9. package/dist/multi/349.app-d01d0c66.js +1 -0
  10. package/dist/multi/378.app-d01d0c66.js +1 -0
  11. package/dist/multi/406.app-d01d0c66.js +1 -0
  12. package/dist/multi/476.app-d01d0c66.js +1 -0
  13. package/dist/multi/53.app-d01d0c66.js +1 -0
  14. package/dist/multi/584.app-d01d0c66.js +1 -0
  15. package/dist/multi/690.app-d01d0c66.js +1 -0
  16. package/dist/multi/747.app-d01d0c66.js +1 -0
  17. package/dist/multi/767.app-d01d0c66.js +1 -0
  18. package/dist/multi/816.app-d01d0c66.js +1 -0
  19. package/dist/multi/83.app-d01d0c66.js +1 -0
  20. package/dist/multi/873.app-d01d0c66.js +1 -0
  21. package/dist/multi/920.app-d01d0c66.js +1 -0
  22. package/dist/multi/991.app-d01d0c66.js +1 -0
  23. package/dist/multi/JetBrainsMono_vf-9e9649b6..woff2 +0 -0
  24. package/dist/multi/JetBrainsMono_vf-b9a9c326..woff +0 -0
  25. package/dist/multi/app-d01d0c66.js +2 -0
  26. package/dist/multi/app-d01d0c66.js.LICENSE.txt +16 -0
  27. package/dist/multi/manifest.json +26 -0
  28. package/dist/multi/pt-root-ui_vf-22fe60ca..woff +0 -0
  29. package/dist/multi/pt-root-ui_vf-9d251e8b..woff2 +0 -0
  30. package/dist/multi/styles-d01d0c66.css +39 -0
  31. package/dist/single/app-6596cb08.js +2 -0
  32. package/dist/single/app-6596cb08.js.LICENSE.txt +16 -0
  33. package/dist/single/manifest.json +3 -0
  34. package/package.json +107 -0
  35. package/postcss.config.js +5 -0
  36. package/src/assets/scss/_common.scss +143 -0
  37. package/src/assets/scss/day.scss +51 -0
  38. package/src/assets/scss/fonts.scss +3 -0
  39. package/src/assets/scss/index.scss +7 -0
  40. package/src/assets/scss/night.scss +61 -0
  41. package/src/assets/scss/palette.scss +393 -0
  42. package/src/assets/scss/theme.scss +119 -0
  43. package/src/assets/scss/vars.scss +9 -0
  44. package/src/assets/svg/line-alerts-alert-circle.svg +12 -0
  45. package/src/assets/svg/line-general-eye.svg +7 -0
  46. package/src/assets/svg/line-icon-bomb-2.svg +12 -0
  47. package/src/components/ArrowButton/index.tsx +36 -0
  48. package/src/components/ArrowButton/styles.scss +35 -0
  49. package/src/components/BaseLayout/index.tsx +43 -0
  50. package/src/components/BaseLayout/styles.scss +60 -0
  51. package/src/components/Footer/FooterLogo.tsx +16 -0
  52. package/src/components/Footer/FooterVersion.tsx +37 -0
  53. package/src/components/Footer/index.tsx +13 -0
  54. package/src/components/Footer/styles.scss +14 -0
  55. package/src/components/Header/index.tsx +28 -0
  56. package/src/components/Header/styles.scss +33 -0
  57. package/src/components/LanguagePicker/index.tsx +40 -0
  58. package/src/components/MainReport/index.tsx +21 -0
  59. package/src/components/MainReport/styles.scss +11 -0
  60. package/src/components/Metadata/index.tsx +121 -0
  61. package/src/components/Metadata/styles.scss +146 -0
  62. package/src/components/MetadataButton/index.tsx +32 -0
  63. package/src/components/MetadataButton/styles.scss +53 -0
  64. package/src/components/Modal/index.tsx +22 -0
  65. package/src/components/ReportBody/Filters.tsx +90 -0
  66. package/src/components/ReportBody/HeaderActions.tsx +21 -0
  67. package/src/components/ReportBody/SortBy.tsx +132 -0
  68. package/src/components/ReportBody/context.tsx +106 -0
  69. package/src/components/ReportBody/index.tsx +72 -0
  70. package/src/components/ReportBody/styles.scss +69 -0
  71. package/src/components/ReportHeader/ReportHeaderLabelList.tsx +12 -0
  72. package/src/components/ReportHeader/ReportHeaderLogo.tsx +10 -0
  73. package/src/components/ReportHeader/ReportHeaderPie.tsx +14 -0
  74. package/src/components/ReportHeader/index.tsx +33 -0
  75. package/src/components/ReportHeader/styles.scss +51 -0
  76. package/src/components/ReportLogo/index.tsx +16 -0
  77. package/src/components/ReportLogo/styles.scss +20 -0
  78. package/src/components/ReportLogoFull/index.tsx +20 -0
  79. package/src/components/ReportLogoFull/styles.scss +7 -0
  80. package/src/components/ReportMetadata/MetadataItem.tsx +45 -0
  81. package/src/components/ReportMetadata/MetadataSummary.tsx +81 -0
  82. package/src/components/ReportMetadata/MetadataTestType.tsx +16 -0
  83. package/src/components/ReportMetadata/MetadataWithIcon.tsx +21 -0
  84. package/src/components/ReportMetadata/index.tsx +46 -0
  85. package/src/components/ReportMetadata/styles.scss +99 -0
  86. package/src/components/SideBySide/index.tsx +52 -0
  87. package/src/components/SideBySide/styles.scss +65 -0
  88. package/src/components/SplitLayout/index.tsx +77 -0
  89. package/src/components/SplitLayout/styles.scss +85 -0
  90. package/src/components/Tabs/index.tsx +62 -0
  91. package/src/components/Tabs/styles.scss +56 -0
  92. package/src/components/TestResult/TestResultAttachmentsView/index.tsx +27 -0
  93. package/src/components/TestResult/TestResultAttachmentsView/styles.scss +12 -0
  94. package/src/components/TestResult/TestResultDescription/index.tsx +27 -0
  95. package/src/components/TestResult/TestResultDescription/styles.scss +12 -0
  96. package/src/components/TestResult/TestResultDropdown/index.tsx +26 -0
  97. package/src/components/TestResult/TestResultDropdown/styles.scss +34 -0
  98. package/src/components/TestResult/TestResultEmpty/index.tsx +34 -0
  99. package/src/components/TestResult/TestResultEmpty/styles.scss +25 -0
  100. package/src/components/TestResult/TestResultHeader/TestResultBreadcrumbs.tsx +44 -0
  101. package/src/components/TestResult/TestResultHeader/index.tsx +21 -0
  102. package/src/components/TestResult/TestResultHeader/styles.scss +48 -0
  103. package/src/components/TestResult/TestResultHistory/TestResultHistoryItem.tsx +66 -0
  104. package/src/components/TestResult/TestResultHistory/index.tsx +26 -0
  105. package/src/components/TestResult/TestResultHistory/styles.scss +63 -0
  106. package/src/components/TestResult/TestResultInfo/TestResultInfoStatuses.tsx +30 -0
  107. package/src/components/TestResult/TestResultInfo/index.tsx +81 -0
  108. package/src/components/TestResult/TestResultInfo/styles.scss +68 -0
  109. package/src/components/TestResult/TestResultLinks/index.tsx +56 -0
  110. package/src/components/TestResult/TestResultLinks/styles.scss +30 -0
  111. package/src/components/TestResult/TestResultMetadata/index.tsx +27 -0
  112. package/src/components/TestResult/TestResultMetadata/styles.scss +8 -0
  113. package/src/components/TestResult/TestResultNavigation/index.tsx +80 -0
  114. package/src/components/TestResult/TestResultNavigation/styles.scss +48 -0
  115. package/src/components/TestResult/TestResultOverview.tsx +43 -0
  116. package/src/components/TestResult/TestResultParameters/index.tsx +30 -0
  117. package/src/components/TestResult/TestResultParameters/styles.scss +8 -0
  118. package/src/components/TestResult/TestResultPrevStatuses/index.tsx +49 -0
  119. package/src/components/TestResult/TestResultPrevStatuses/styles.scss +57 -0
  120. package/src/components/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +51 -0
  121. package/src/components/TestResult/TestResultRetriesView/index.tsx +24 -0
  122. package/src/components/TestResult/TestResultRetriesView/styles.scss +69 -0
  123. package/src/components/TestResult/TestResultSetup/index.tsx +58 -0
  124. package/src/components/TestResult/TestResultSeverity/index.tsx +27 -0
  125. package/src/components/TestResult/TestResultSeverity/styles.scss +29 -0
  126. package/src/components/TestResult/TestResultStatus/index.tsx +25 -0
  127. package/src/components/TestResult/TestResultStatus/styles.scss +36 -0
  128. package/src/components/TestResult/TestResultSteps/index.tsx +58 -0
  129. package/src/components/TestResult/TestResultSteps/styles.scss +225 -0
  130. package/src/components/TestResult/TestResultSteps/testResultAttachment.tsx +76 -0
  131. package/src/components/TestResult/TestResultSteps/testResultAttachmentInfo.tsx +83 -0
  132. package/src/components/TestResult/TestResultSteps/testResultStep.tsx +84 -0
  133. package/src/components/TestResult/TestResultSteps/testResultStepInfo.tsx +30 -0
  134. package/src/components/TestResult/TestResultSteps/wrongAttachment.tsx +8 -0
  135. package/src/components/TestResult/TestResultTabs/index.tsx +68 -0
  136. package/src/components/TestResult/TestResultTabs/styles.scss +76 -0
  137. package/src/components/TestResult/TestResultTeardown/index.tsx +59 -0
  138. package/src/components/TestResult/TestStepsEmpty/index.tsx +23 -0
  139. package/src/components/TestResult/TestStepsEmpty/styles.scss +25 -0
  140. package/src/components/TestResult/TrError/TrDiff.tsx +124 -0
  141. package/src/components/TestResult/TrError/index.tsx +78 -0
  142. package/src/components/TestResult/TrError/styles.scss +133 -0
  143. package/src/components/TestResult/index.tsx +62 -0
  144. package/src/components/TestResult/styles.scss +11 -0
  145. package/src/components/ThemeButton/ThemeButton.tsx +20 -0
  146. package/src/components/ToggleLayout/index.tsx +17 -0
  147. package/src/components/Tree/index.tsx +75 -0
  148. package/src/components/Tree/styles.scss +189 -0
  149. package/src/i18n/constants.ts +124 -0
  150. package/src/i18n/locales/am.json +133 -0
  151. package/src/i18n/locales/az.json +133 -0
  152. package/src/i18n/locales/de.json +133 -0
  153. package/src/i18n/locales/en.json +134 -0
  154. package/src/i18n/locales/es.json +133 -0
  155. package/src/i18n/locales/fr.json +133 -0
  156. package/src/i18n/locales/he.json +133 -0
  157. package/src/i18n/locales/it.json +133 -0
  158. package/src/i18n/locales/ja.json +133 -0
  159. package/src/i18n/locales/ka.json +133 -0
  160. package/src/i18n/locales/kr.json +133 -0
  161. package/src/i18n/locales/nl.json +133 -0
  162. package/src/i18n/locales/pl.json +131 -0
  163. package/src/i18n/locales/pt.json +133 -0
  164. package/src/i18n/locales/ru.json +131 -0
  165. package/src/i18n/locales/sv.json +133 -0
  166. package/src/i18n/locales/tr.json +133 -0
  167. package/src/i18n/locales/zh.json +133 -0
  168. package/src/index.html +40 -0
  169. package/src/index.tsx +96 -0
  170. package/src/stores/chart.ts +32 -0
  171. package/src/stores/envInfo.ts +34 -0
  172. package/src/stores/index.ts +4 -0
  173. package/src/stores/layout.ts +36 -0
  174. package/src/stores/locale.ts +75 -0
  175. package/src/stores/modal.ts +22 -0
  176. package/src/stores/router.ts +48 -0
  177. package/src/stores/stats.ts +36 -0
  178. package/src/stores/testResults.ts +66 -0
  179. package/src/stores/theme.ts +32 -0
  180. package/src/stores/tree.ts +157 -0
  181. package/src/stores/types.ts +5 -0
  182. package/src/styles.scss +45 -0
  183. package/src/types/globals.d.ts +13 -0
  184. package/src/types/window.d.ts +8 -0
  185. package/src/utils/capitalize.ts +6 -0
  186. package/src/utils/copyToClipboard.ts +16 -0
  187. package/src/utils/isMac.ts +8 -0
  188. package/src/utils/loadFromLocalStorage.ts +8 -0
  189. package/src/utils/statuses.ts +55 -0
  190. package/src/utils/time.ts +17 -0
  191. package/src/utils/treeFilters.ts +147 -0
  192. package/test/utils/treeFilters.test.ts +448 -0
  193. package/tsconfig.json +27 -0
  194. package/types.d.ts +99 -0
  195. package/vitest.config.ts +18 -0
  196. package/webpack.config.js +112 -0
@@ -0,0 +1,58 @@
1
+ import { allureIcons } from "@allurereport/web-components";
2
+ import type { FunctionalComponent } from "preact";
3
+ import { useState } from "preact/hooks";
4
+ import type { AwesomeTestResult } from "types";
5
+ import { TestResultDropdown } from "@/components/TestResult/TestResultDropdown";
6
+ import * as styles from "@/components/TestResult/TestResultSteps/styles.scss";
7
+ import { TestResultAttachment } from "@/components/TestResult/TestResultSteps/testResultAttachment";
8
+ import { TestResultStep } from "@/components/TestResult/TestResultSteps/testResultStep";
9
+ import { useI18n } from "@/stores/locale";
10
+ import { collapsedTrees, toggleTree } from "@/stores/tree";
11
+
12
+ const typeMap = {
13
+ before: TestResultStep,
14
+ after: TestResultStep,
15
+ step: TestResultStep,
16
+ attachment: TestResultAttachment,
17
+ };
18
+
19
+ export type TestResultSetupProps = {
20
+ setup: AwesomeTestResult["setup"];
21
+ id?: string;
22
+ };
23
+
24
+ export const TestResultSetup: FunctionalComponent<TestResultSetupProps> = ({ setup, id }) => {
25
+ const teardownId = `${id}-setup`;
26
+ const isEarlyCollapsed = Boolean(!collapsedTrees.value.has(teardownId));
27
+ const [isOpened, setIsOpen] = useState<boolean>(isEarlyCollapsed);
28
+
29
+ const handleClick = () => {
30
+ setIsOpen(!isOpened);
31
+ toggleTree(teardownId);
32
+ };
33
+ const { t } = useI18n("execution");
34
+
35
+ return (
36
+ <div className={styles["test-result-steps"]}>
37
+ <TestResultDropdown
38
+ icon={allureIcons.lineTimeClockStopwatch}
39
+ isOpened={isOpened}
40
+ setIsOpen={handleClick}
41
+ counter={setup?.length}
42
+ title={t("setup")}
43
+ />
44
+ {isOpened && (
45
+ <div className={styles["test-result-steps-root"]}>
46
+ {setup?.map((item, key) => {
47
+ const StepComponent = typeMap[item.type];
48
+ return StepComponent ? (
49
+ // FIXME: use proper type in the StepComponent component
50
+ // @ts-ignore
51
+ <StepComponent item={item} stepIndex={key + 1} key={key} className={styles["test-result-step-root"]} />
52
+ ) : null;
53
+ })}
54
+ </div>
55
+ )}
56
+ </div>
57
+ );
58
+ };
@@ -0,0 +1,27 @@
1
+ import { SvgIcon, Text, allureIcons } from "@allurereport/web-components";
2
+ import clsx from "clsx";
3
+ import { useI18n } from "@/stores/locale";
4
+ import { capitalize } from "@/utils/capitalize";
5
+ import * as styles from "./styles.scss";
6
+
7
+ const icons: Record<string, string> = {
8
+ blocker: allureIcons.lineArrowsChevronUpDouble,
9
+ critical: allureIcons.lineArrowsChevronUp,
10
+ normal: allureIcons.lineGeneralEqual,
11
+ minor: allureIcons.lineArrowsChevronDown,
12
+ trivial: allureIcons.lineArrowsChevronDownDouble,
13
+ };
14
+
15
+ export const TestResultSeverity = ({ severity = "normal" }: { severity?: string }) => {
16
+ const { t } = useI18n("severity");
17
+ const statusClass = clsx(styles[`severity-${severity}`]);
18
+
19
+ return (
20
+ <div className={styles["test-result-severity"]}>
21
+ <SvgIcon className={statusClass} id={icons[severity]} />
22
+ <Text size={"s"} bold className={styles["test-result-severity-text"]}>
23
+ {capitalize(t(severity))}
24
+ </Text>
25
+ </div>
26
+ );
27
+ };
@@ -0,0 +1,29 @@
1
+ .test-result-severity {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 6px;
5
+ }
6
+
7
+ .test-result-severity-text {
8
+ color: var(--on-text-secondary);
9
+ }
10
+
11
+ .severity-blocker {
12
+ color: var(--on-support-capella);
13
+ }
14
+
15
+ .severity-critical {
16
+ color: var(--on-support-atlas);
17
+ }
18
+
19
+ .severity-normal {
20
+ color: var(--on-icon-secondary);
21
+ }
22
+
23
+ .severity-minor {
24
+ color: var(--on-support-aldebaran);
25
+ }
26
+
27
+ .severity-trivial {
28
+ color: var(--on-support-castor);
29
+ }
@@ -0,0 +1,25 @@
1
+ import type { TestStatus } from "@allurereport/core-api";
2
+ import { Text, TreeItemIcon } from "@allurereport/web-components";
3
+ import clsx from "clsx";
4
+ import { useI18n } from "@/stores";
5
+ import { capitalize } from "@/utils/capitalize";
6
+ import * as styles from "./styles.scss";
7
+
8
+ export const TestResultStatus = ({ status }: { status: TestStatus }) => {
9
+ const { t } = useI18n("statuses");
10
+ return (
11
+ <div
12
+ data-testid={`test-result-status-${status}`}
13
+ className={clsx(styles["test-result-status"], styles[`status-${status}`])}
14
+ >
15
+ <TreeItemIcon
16
+ status={status}
17
+ className={styles["test-result-status-icon"]}
18
+ classNameIcon={styles["test-result-status-icon"]}
19
+ />
20
+ <Text type={"ui"} size={"s"} bold className={styles["test-result-status-text"]}>
21
+ {capitalize(t(status) ?? status)}
22
+ </Text>
23
+ </div>
24
+ );
25
+ };
@@ -0,0 +1,36 @@
1
+ .test-result-status {
2
+ padding: 2px;
3
+ display: flex;
4
+ border-radius: 100px;
5
+ color: var(--constant-on-text-primary);
6
+ height: max-content;
7
+ }
8
+
9
+ .test-result-status-text {
10
+ padding: 0 4px;
11
+ }
12
+
13
+ .test-result-status-icon {
14
+ color: var(--constant-on-text-primary);
15
+ padding: 0;
16
+ }
17
+
18
+ .status-passed {
19
+ background-color: var(--bg-support-castor);
20
+ }
21
+
22
+ .status-failed {
23
+ background-color: var(--bg-support-capella);
24
+ }
25
+
26
+ .status-broken {
27
+ background-color: var(--bg-support-atlas);
28
+ }
29
+
30
+ .status-skipped {
31
+ background-color: var(--bg-support-rau);
32
+ }
33
+
34
+ .status-unknown {
35
+ background-color: var(--bg-support-skat);
36
+ }
@@ -0,0 +1,58 @@
1
+ import { allureIcons } from "@allurereport/web-components";
2
+ import type { FunctionalComponent } from "preact";
3
+ import { useState } from "preact/hooks";
4
+ import type { AwesomeTestResult, AwesomeTestStepResult } from "types";
5
+ import { TestResultDropdown } from "@/components/TestResult/TestResultDropdown";
6
+ import { TestResultAttachment } from "@/components/TestResult/TestResultSteps/testResultAttachment";
7
+ import { TestResultStep } from "@/components/TestResult/TestResultSteps/testResultStep";
8
+ import { useI18n } from "@/stores/locale";
9
+ import { collapsedTrees, toggleTree } from "@/stores/tree";
10
+ import * as styles from "./styles.scss";
11
+
12
+ const typeMap = {
13
+ step: TestResultStep,
14
+ attachment: TestResultAttachment,
15
+ } as const;
16
+
17
+ export type TestResultStepsProps = {
18
+ steps: AwesomeTestResult["steps"];
19
+ id?: string;
20
+ };
21
+
22
+ type StepComponentProps = FunctionalComponent<{
23
+ item?: AwesomeTestStepResult;
24
+ stepIndex?: number;
25
+ }>;
26
+
27
+ export const TestResultSteps: FunctionalComponent<TestResultStepsProps> = ({ steps, id }) => {
28
+ const stepsId = `${id}-steps`;
29
+ const isEarlyCollapsed = Boolean(!collapsedTrees.value.has(stepsId));
30
+ const [isOpened, setIsOpen] = useState<boolean>(isEarlyCollapsed);
31
+
32
+ const handleClick = () => {
33
+ setIsOpen(!isOpened);
34
+ toggleTree(stepsId);
35
+ };
36
+
37
+ const { t } = useI18n("execution");
38
+ return (
39
+ <div className={styles["test-result-steps"]}>
40
+ <TestResultDropdown
41
+ icon={allureIcons.lineHelpersPlayCircle}
42
+ isOpened={isOpened}
43
+ setIsOpen={handleClick}
44
+ counter={steps?.length}
45
+ title={t("body")}
46
+ />
47
+ {isOpened && (
48
+ <div className={styles["test-result-steps-root"]}>
49
+ {steps?.map((item: AwesomeTestStepResult, index) => {
50
+ const { type } = item;
51
+ const StepComponent: StepComponentProps = typeMap[type];
52
+ return StepComponent ? <StepComponent item={item} stepIndex={index + 1} key={index} /> : null;
53
+ })}
54
+ </div>
55
+ )}
56
+ </div>
57
+ );
58
+ };
@@ -0,0 +1,225 @@
1
+ .test-result-steps {
2
+ padding-right: 24px;
3
+
4
+ &:not(:first-child) {
5
+ border-top: 1px solid var(--on-border-muted);
6
+ }
7
+ }
8
+
9
+ .test-result-steps-root {
10
+ padding-left: 30px;
11
+ }
12
+
13
+ .test-result-step {
14
+ &:not(:first-child) {
15
+ border-top: 1px solid var(--on-border-muted);
16
+ }
17
+ }
18
+
19
+ .test-result-step-content {
20
+ padding-left: 24px;
21
+ margin-bottom: 12px;
22
+ border-top: 1px solid var(--on-border-muted);
23
+ }
24
+
25
+ .test-result-attachment-content {
26
+ max-height: 450px;
27
+ overflow-y: auto;
28
+ border-top: 1px solid var(--on-border-muted);
29
+ }
30
+
31
+ .test-result-attachment-content-wrapper {
32
+ padding-left: 16px;
33
+ margin-left: 11px;
34
+ max-height: 450px;
35
+ overflow-y: auto;
36
+ }
37
+
38
+ .test-result-step-root {
39
+ padding-left: 12px;
40
+ }
41
+
42
+ .test-result-step-header {
43
+ display: flex;
44
+ align-items: flex-start;
45
+ gap: 4px;
46
+ transition: background-color 300ms;
47
+ cursor: pointer;
48
+ padding: 4px 8px 4px 6px;
49
+ min-height: 32px;
50
+
51
+ &:hover {
52
+ background: var(--bg-control-flat-medium);
53
+ }
54
+ }
55
+
56
+ .test-result-header-text {
57
+ padding-left: 4px;
58
+ word-break: break-word;
59
+ }
60
+
61
+ .test-result-step-button {
62
+ padding: 2px;
63
+ box-sizing: border-box;
64
+ margin-right: 2px;
65
+ margin-left: 2px;
66
+ }
67
+
68
+ .test-result-step-number {
69
+ color: var(--on-text-hint);
70
+ min-width: 16px;
71
+ text-align: center;
72
+ box-sizing: content-box;
73
+ }
74
+
75
+ .item-time {
76
+ flex: none;
77
+ margin-left: auto;
78
+ color: var(--on-text-hint);
79
+ line-height: 20px;
80
+ min-width: 56px;
81
+ text-align: right;
82
+ }
83
+
84
+ .item-info {
85
+ margin-left: auto;
86
+ display: flex;
87
+ gap: 8px;
88
+ color: var(--on-text-secondary);
89
+ align-items: center;
90
+ flex: 0 0 auto;
91
+ }
92
+
93
+ .item-buttons {
94
+ display: flex;
95
+ align-items: center;
96
+ gap: 4px;
97
+ color: var(--on-icon-secondary);
98
+ min-width: 52px;
99
+ justify-content: flex-end;
100
+ }
101
+
102
+ .item-info-step {
103
+ display: flex;
104
+ gap: 4px;
105
+ align-items: center;
106
+ }
107
+
108
+ .item-info-step-icon {
109
+ color: var(--on-icon-secondary);
110
+ }
111
+
112
+ .test-result-step-chevron {
113
+ width: 12px;
114
+ height: 12px;
115
+ transform: rotate(-90deg);
116
+ transition: transform 200ms;
117
+ }
118
+
119
+ .test-result-step-chevron-open {
120
+ transform: rotate(0deg);
121
+ }
122
+
123
+ .test-result-attachment-header {
124
+ display: flex;
125
+ align-items: center;
126
+ gap: 4px;
127
+ transition: background-color 300ms;
128
+ cursor: pointer;
129
+ padding: 4px 8px 4px 6px;
130
+
131
+ &:hover {
132
+ background: var(--bg-control-flat-medium);
133
+ }
134
+ }
135
+
136
+ .test-result-attachment-arrow {
137
+ transform: rotate(-90deg);
138
+ transition: transform 200ms;
139
+ }
140
+
141
+ .test-result-attachment-arrow-opened {
142
+ transform: rotate(0);
143
+ }
144
+
145
+ .test-result-attachment-icon {
146
+ color: var(--on-icon-secondary);
147
+ padding: 2px 4px;
148
+ height: max-content;
149
+ }
150
+
151
+ .test-result-attachment-text {
152
+ padding-left: 4px;
153
+ word-break: break-word;
154
+ }
155
+
156
+ .test-result-attachment-image {
157
+ overflow: hidden;
158
+ cursor: pointer;
159
+ padding: 4px 0;
160
+ position: relative;
161
+ width: 100%;
162
+ height: 100%;
163
+
164
+ img {
165
+ width: 100%;
166
+ height: 100%;
167
+ object-fit: scale-down;
168
+ }
169
+ }
170
+
171
+ .test-result-parameters {
172
+ padding-left: 62px;
173
+ }
174
+
175
+ .attachment-background {
176
+ filter: blur(40px) brightness(0.4);
177
+ background-position: 50%;
178
+ background-size: cover;
179
+ position: absolute;
180
+ inset: -100px;
181
+ z-index: -1;
182
+ }
183
+
184
+ .test-result-attachment-error {
185
+ display: flex;
186
+ align-items: center;
187
+ justify-content: center;
188
+ }
189
+
190
+ .test-result-visibility-hidden {
191
+ visibility: hidden;
192
+ }
193
+
194
+ .item-button {
195
+ color: var(--bg-control-flat);
196
+ }
197
+
198
+ .wrong-attachment-sign {
199
+ display: flex;
200
+ justify-content: center;
201
+ align-items: center;
202
+ }
203
+
204
+ .test-result-attachment-missed {
205
+ color: var(--on-text-secondary);
206
+ line-height: 20px;
207
+ margin-right: auto;
208
+ padding-top: 2px;
209
+ }
210
+
211
+ .test-result-spinner {
212
+ display: flex;
213
+ align-items: center;
214
+ justify-content: center;
215
+ width: 100%;
216
+ min-height: 32px;
217
+ }
218
+
219
+ .test-result-strut {
220
+ width: 24px;
221
+ }
222
+
223
+ .html-attachment-preview {
224
+ padding: 0 16px;
225
+ }
@@ -0,0 +1,76 @@
1
+ import type { AttachmentTestStepResult } from "@allurereport/core-api";
2
+ import { attachmentType } from "@allurereport/web-commons";
3
+ import { Attachment, Code, SvgIcon, Text, allureIcons } from "@allurereport/web-components";
4
+ import type { FunctionComponent } from "preact";
5
+ import { useState } from "preact/hooks";
6
+ import { ArrowButton } from "@/components/ArrowButton";
7
+ import * as styles from "@/components/TestResult/TestResultSteps/styles.scss";
8
+ import { TestResultAttachmentInfo } from "@/components/TestResult/TestResultSteps/testResultAttachmentInfo";
9
+
10
+ const { lineImagesImage, lineFilesFileAttachment2 } = allureIcons;
11
+
12
+ const iconMap: Record<string, string> = {
13
+ "text/plain": lineFilesFileAttachment2,
14
+ "application/xml": lineFilesFileAttachment2,
15
+ "text/html": lineFilesFileAttachment2,
16
+ "text/csv": lineFilesFileAttachment2,
17
+ "text/tab-separated-values": lineFilesFileAttachment2,
18
+ "text/css": lineFilesFileAttachment2,
19
+ "text/uri-list": lineFilesFileAttachment2,
20
+ "image/svg+xml": lineImagesImage,
21
+ "image/png": lineImagesImage,
22
+ "application/json": lineFilesFileAttachment2,
23
+ "application/zip": lineFilesFileAttachment2,
24
+ "video/webm": lineImagesImage,
25
+ "image/jpeg": lineImagesImage,
26
+ "video/mp4": lineImagesImage,
27
+ "application/vnd.allure.image.diff": lineImagesImage,
28
+ };
29
+
30
+ export const TestResultAttachment: FunctionComponent<{
31
+ item: AttachmentTestStepResult;
32
+ stepIndex?: number;
33
+ className?: string;
34
+ }> = ({ item, stepIndex }) => {
35
+ const [isOpened, setIsOpen] = useState(false);
36
+ const { link } = item;
37
+ const { missed } = link;
38
+ const componentType = attachmentType(link.contentType);
39
+ const isValidComponentType = !["archive", null].includes(componentType.type as string);
40
+
41
+ return (
42
+ <div className={styles["test-result-step"]}>
43
+ <div
44
+ className={styles["test-result-attachment-header"]}
45
+ onClick={(e) => {
46
+ e.stopPropagation();
47
+ setIsOpen((prev) => !prev);
48
+ }}
49
+ >
50
+ <ArrowButton isOpened={isOpened} />
51
+ <div className={styles["test-result-attachment-icon"]}>
52
+ <SvgIcon size="s" id={iconMap[link.contentType] ?? lineFilesFileAttachment2} />
53
+ </div>
54
+
55
+ <Code size="s" className={styles["test-result-step-number"]}>
56
+ {stepIndex}
57
+ </Code>
58
+
59
+ <Text className={styles["test-result-attachment-text"]}>{link.name || link.originalFileName}</Text>
60
+ {missed && (
61
+ <Text size={"s"} className={styles["test-result-attachment-missed"]}>
62
+ missed
63
+ </Text>
64
+ )}
65
+ <TestResultAttachmentInfo item={item} shouldExpand={isValidComponentType} />
66
+ </div>
67
+ {isOpened && isValidComponentType && (
68
+ <div className={styles["test-result-attachment-content-wrapper"]}>
69
+ <div className={styles["test-result-attachment-content"]}>
70
+ <Attachment item={item} />
71
+ </div>
72
+ </div>
73
+ )}
74
+ </div>
75
+ );
76
+ };
@@ -0,0 +1,83 @@
1
+ import type { AttachmentTestStepResult } from "@allurereport/core-api";
2
+ import { downloadAttachment } from "@allurereport/web-commons";
3
+ import { Attachment, IconButton, Text, TooltipWrapper, allureIcons } from "@allurereport/web-components";
4
+ import { filesize } from "filesize";
5
+ import type { FunctionalComponent } from "preact";
6
+ import { useEffect } from "preact/hooks";
7
+ import * as styles from "@/components/TestResult/TestResultSteps/styles.scss";
8
+ import { useI18n } from "@/stores";
9
+ import { isModalOpen, modalData, openModal } from "@/stores/modal";
10
+
11
+ interface TestResultAttachmentInfoProps {
12
+ item?: AttachmentTestStepResult;
13
+ shouldExpand?: boolean;
14
+ }
15
+
16
+ export const TestResultAttachmentInfo: FunctionalComponent<TestResultAttachmentInfoProps> = ({
17
+ item,
18
+ shouldExpand,
19
+ }) => {
20
+ const { id, ext, contentType } = item.link;
21
+ const { t: tooltip } = useI18n("controls");
22
+ const contentLength = item.link.missed === false ? item.link.contentLength : undefined;
23
+ const contentSize = contentLength
24
+ ? filesize(contentLength, {
25
+ base: 2,
26
+ round: 1,
27
+ })
28
+ : "-";
29
+
30
+ const expandAttachment = (event: Event) => {
31
+ event.stopPropagation();
32
+ openModal({
33
+ data: item,
34
+ component: <Attachment item={item} previewable={true} />,
35
+ });
36
+ };
37
+
38
+ useEffect(() => {
39
+ if (isModalOpen.value) {
40
+ openModal({
41
+ isModalOpen: true,
42
+ data: item,
43
+ component: <Attachment item={item} />,
44
+ });
45
+ }
46
+ }, [item]);
47
+
48
+ const downloadData = async (e: MouseEvent) => {
49
+ e.stopPropagation();
50
+ await downloadAttachment(id, ext, contentType);
51
+ };
52
+
53
+ return (
54
+ <div className={styles["item-info"]}>
55
+ {Boolean(contentType) && <Text size={"s"}>{contentType}</Text>}
56
+ {Boolean(contentSize) && <Text size={"s"}>{contentSize}</Text>}
57
+ <div className={styles["item-buttons"]}>
58
+ {shouldExpand && (
59
+ <TooltipWrapper tooltipText={tooltip("expand")}>
60
+ <IconButton
61
+ className={styles["item-button"]}
62
+ style={"ghost"}
63
+ size={"s"}
64
+ iconSize={"s"}
65
+ icon={allureIcons.lineArrowsExpand3}
66
+ onClick={expandAttachment}
67
+ />
68
+ </TooltipWrapper>
69
+ )}
70
+ <TooltipWrapper tooltipText={tooltip("downloadAttachment")}>
71
+ <IconButton
72
+ style={"ghost"}
73
+ size={"s"}
74
+ iconSize={"s"}
75
+ className={styles["item-button"]}
76
+ icon={allureIcons.lineGeneralDownloadCloud}
77
+ onClick={(e: MouseEvent) => downloadData(e)}
78
+ />
79
+ </TooltipWrapper>
80
+ </div>
81
+ </div>
82
+ );
83
+ };