@allurereport/web-awesome 3.0.0-beta.3

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 (263) hide show
  1. package/.babelrc.js +46 -0
  2. package/.eslintrc.cjs +15 -0
  3. package/README.md +27 -0
  4. package/dist/multi/141.app-b6362ca0.js +1 -0
  5. package/dist/multi/222.app-b6362ca0.js +1 -0
  6. package/dist/multi/335.app-b6362ca0.js +1 -0
  7. package/dist/multi/34.app-b6362ca0.js +1 -0
  8. package/dist/multi/349.app-b6362ca0.js +1 -0
  9. package/dist/multi/378.app-b6362ca0.js +1 -0
  10. package/dist/multi/406.app-b6362ca0.js +1 -0
  11. package/dist/multi/476.app-b6362ca0.js +1 -0
  12. package/dist/multi/53.app-b6362ca0.js +1 -0
  13. package/dist/multi/584.app-b6362ca0.js +1 -0
  14. package/dist/multi/690.app-b6362ca0.js +1 -0
  15. package/dist/multi/747.app-b6362ca0.js +1 -0
  16. package/dist/multi/767.app-b6362ca0.js +1 -0
  17. package/dist/multi/816.app-b6362ca0.js +1 -0
  18. package/dist/multi/83.app-b6362ca0.js +1 -0
  19. package/dist/multi/873.app-b6362ca0.js +1 -0
  20. package/dist/multi/920.app-b6362ca0.js +1 -0
  21. package/dist/multi/991.app-b6362ca0.js +1 -0
  22. package/dist/multi/JetBrainsMono_vf-9e9649b6..woff2 +0 -0
  23. package/dist/multi/JetBrainsMono_vf-b9a9c326..woff +0 -0
  24. package/dist/multi/app-b6362ca0.js +2 -0
  25. package/dist/multi/app-b6362ca0.js.LICENSE.txt +16 -0
  26. package/dist/multi/manifest.json +26 -0
  27. package/dist/multi/pt-root-ui_vf-22fe60ca..woff +0 -0
  28. package/dist/multi/pt-root-ui_vf-9d251e8b..woff2 +0 -0
  29. package/dist/multi/styles-b6362ca0.css +363 -0
  30. package/dist/single/app-57ae0a60.js +2 -0
  31. package/dist/single/app-57ae0a60.js.LICENSE.txt +16 -0
  32. package/dist/single/manifest.json +3 -0
  33. package/package.json +93 -0
  34. package/postcss.config.js +5 -0
  35. package/src/assets/fonts/JetBrainsMono_vf.woff +0 -0
  36. package/src/assets/fonts/JetBrainsMono_vf.woff2 +0 -0
  37. package/src/assets/fonts/pt-root-ui_vf.woff +0 -0
  38. package/src/assets/fonts/pt-root-ui_vf.woff2 +0 -0
  39. package/src/assets/scss/_common.scss +134 -0
  40. package/src/assets/scss/code.css +71 -0
  41. package/src/assets/scss/day.scss +51 -0
  42. package/src/assets/scss/fonts.scss +21 -0
  43. package/src/assets/scss/index.scss +9 -0
  44. package/src/assets/scss/mixins.scss +26 -0
  45. package/src/assets/scss/night.scss +61 -0
  46. package/src/assets/scss/palette.scss +393 -0
  47. package/src/assets/scss/theme.scss +117 -0
  48. package/src/assets/scss/typography.scss +218 -0
  49. package/src/assets/scss/vars.scss +8 -0
  50. package/src/assets/svg/arrows-chevron-down.svg +5 -0
  51. package/src/assets/svg/github.svg +5 -0
  52. package/src/assets/svg/line-alerts-notification-box.svg +3 -0
  53. package/src/assets/svg/line-arrows-chevron-down-double.svg +3 -0
  54. package/src/assets/svg/line-arrows-chevron-down.svg +3 -0
  55. package/src/assets/svg/line-arrows-chevron-right.svg +3 -0
  56. package/src/assets/svg/line-arrows-chevron-up-double.svg +3 -0
  57. package/src/assets/svg/line-arrows-chevron-up.svg +3 -0
  58. package/src/assets/svg/line-arrows-corner-down-right.svg +3 -0
  59. package/src/assets/svg/line-arrows-expand-3.svg +3 -0
  60. package/src/assets/svg/line-arrows-refresh-ccw-1.svg +3 -0
  61. package/src/assets/svg/line-arrows-sort-line-asc.svg +3 -0
  62. package/src/assets/svg/line-arrows-sort-line-desc.svg +3 -0
  63. package/src/assets/svg/line-arrows-switch-vertical-1.svg +3 -0
  64. package/src/assets/svg/line-dev-bug-2.svg +3 -0
  65. package/src/assets/svg/line-dev-code-square.svg +3 -0
  66. package/src/assets/svg/line-files-file-attachment-2.svg +3 -0
  67. package/src/assets/svg/line-general-check.svg +3 -0
  68. package/src/assets/svg/line-general-checklist3.svg +3 -0
  69. package/src/assets/svg/line-general-copy-3.svg +3 -0
  70. package/src/assets/svg/line-general-download-cloud.svg +3 -0
  71. package/src/assets/svg/line-general-equal.svg +3 -0
  72. package/src/assets/svg/line-general-home-line.svg +3 -0
  73. package/src/assets/svg/line-general-link-1.svg +3 -0
  74. package/src/assets/svg/line-general-link-external.svg +3 -0
  75. package/src/assets/svg/line-general-search-md.svg +3 -0
  76. package/src/assets/svg/line-general-settings-1.svg +3 -0
  77. package/src/assets/svg/line-general-x-close.svg +3 -0
  78. package/src/assets/svg/line-general-zap.svg +3 -0
  79. package/src/assets/svg/line-helpers-flag.svg +4 -0
  80. package/src/assets/svg/line-helpers-play-circle.svg +4 -0
  81. package/src/assets/svg/line-images-image.svg +3 -0
  82. package/src/assets/svg/line-security-key.svg +3 -0
  83. package/src/assets/svg/line-shapes-dot-circle.svg +3 -0
  84. package/src/assets/svg/line-shapes-moon.svg +3 -0
  85. package/src/assets/svg/line-shapes-sun.svg +3 -0
  86. package/src/assets/svg/line-time-clock-stopwatch.svg +3 -0
  87. package/src/assets/svg/report-logo.svg +64 -0
  88. package/src/assets/svg/solid-alert-circle.svg +3 -0
  89. package/src/assets/svg/solid-check-circle.svg +3 -0
  90. package/src/assets/svg/solid-help-circle.svg +3 -0
  91. package/src/assets/svg/solid-minus-circle.svg +3 -0
  92. package/src/assets/svg/solid-x-circle.svg +3 -0
  93. package/src/assets/svg/spinner.svg +18 -0
  94. package/src/assets/svg/view-off.svg +12 -0
  95. package/src/assets/svg/view.svg +11 -0
  96. package/src/components/app/ArrowButton/index.tsx +36 -0
  97. package/src/components/app/ArrowButton/styles.scss +32 -0
  98. package/src/components/app/BaseLayout/index.tsx +60 -0
  99. package/src/components/app/BaseLayout/styles.scss +60 -0
  100. package/src/components/app/Footer/FooterLogo.tsx +16 -0
  101. package/src/components/app/Footer/FooterVersion.tsx +27 -0
  102. package/src/components/app/Footer/index.tsx +13 -0
  103. package/src/components/app/Footer/styles.scss +14 -0
  104. package/src/components/app/Header/index.tsx +17 -0
  105. package/src/components/app/Header/styles.scss +26 -0
  106. package/src/components/app/LanguagePicker/index.tsx +41 -0
  107. package/src/components/app/MainReport/index.tsx +19 -0
  108. package/src/components/app/Metadata/index.tsx +114 -0
  109. package/src/components/app/Metadata/styles.scss +146 -0
  110. package/src/components/app/MetadataButton/index.tsx +33 -0
  111. package/src/components/app/MetadataButton/styles.scss +53 -0
  112. package/src/components/app/Modal/index.tsx +184 -0
  113. package/src/components/app/Modal/styles.scss +126 -0
  114. package/src/components/app/ReportBody/Filters.tsx +94 -0
  115. package/src/components/app/ReportBody/HeaderActions.tsx +21 -0
  116. package/src/components/app/ReportBody/SortBy.tsx +134 -0
  117. package/src/components/app/ReportBody/context.tsx +107 -0
  118. package/src/components/app/ReportBody/index.tsx +71 -0
  119. package/src/components/app/ReportBody/styles.scss +64 -0
  120. package/src/components/app/ReportHeader/ReportHeaderLabelList.tsx +12 -0
  121. package/src/components/app/ReportHeader/ReportHeaderLogo.tsx +10 -0
  122. package/src/components/app/ReportHeader/ReportHeaderPie.tsx +14 -0
  123. package/src/components/app/ReportHeader/index.tsx +33 -0
  124. package/src/components/app/ReportHeader/styles.scss +49 -0
  125. package/src/components/app/ReportLogo/index.tsx +17 -0
  126. package/src/components/app/ReportLogo/styles.scss +20 -0
  127. package/src/components/app/ReportLogoFull/index.tsx +21 -0
  128. package/src/components/app/ReportLogoFull/styles.scss +7 -0
  129. package/src/components/app/ReportMetadata/MetadataItem.tsx +45 -0
  130. package/src/components/app/ReportMetadata/MetadataSummary.tsx +79 -0
  131. package/src/components/app/ReportMetadata/MetadataTestType.tsx +16 -0
  132. package/src/components/app/ReportMetadata/MetadataWithIcon.tsx +25 -0
  133. package/src/components/app/ReportMetadata/index.tsx +46 -0
  134. package/src/components/app/ReportMetadata/styles.scss +99 -0
  135. package/src/components/app/Tabs/index.tsx +58 -0
  136. package/src/components/app/Tabs/styles.scss +56 -0
  137. package/src/components/app/TestResult/TestResultAttachmentsView/index.tsx +27 -0
  138. package/src/components/app/TestResult/TestResultAttachmentsView/styles.scss +12 -0
  139. package/src/components/app/TestResult/TestResultDescription/index.tsx +27 -0
  140. package/src/components/app/TestResult/TestResultDescription/styles.scss +12 -0
  141. package/src/components/app/TestResult/TestResultDropdown/index.tsx +19 -0
  142. package/src/components/app/TestResult/TestResultDropdown/styles.scss +34 -0
  143. package/src/components/app/TestResult/TestResultEmpty/index.tsx +34 -0
  144. package/src/components/app/TestResult/TestResultEmpty/styles.scss +25 -0
  145. package/src/components/app/TestResult/TestResultError/index.tsx +51 -0
  146. package/src/components/app/TestResult/TestResultError/styles.scss +40 -0
  147. package/src/components/app/TestResult/TestResultHeader/index.tsx +55 -0
  148. package/src/components/app/TestResult/TestResultHeader/styles.scss +43 -0
  149. package/src/components/app/TestResult/TestResultHistory/TestResultHistoryItem.tsx +57 -0
  150. package/src/components/app/TestResult/TestResultHistory/index.tsx +26 -0
  151. package/src/components/app/TestResult/TestResultHistory/styles.scss +63 -0
  152. package/src/components/app/TestResult/TestResultInfo/index.tsx +79 -0
  153. package/src/components/app/TestResult/TestResultInfo/styles.scss +33 -0
  154. package/src/components/app/TestResult/TestResultLinks/index.tsx +60 -0
  155. package/src/components/app/TestResult/TestResultLinks/styles.scss +30 -0
  156. package/src/components/app/TestResult/TestResultMetadata/index.tsx +27 -0
  157. package/src/components/app/TestResult/TestResultMetadata/styles.scss +8 -0
  158. package/src/components/app/TestResult/TestResultNavigation/index.tsx +89 -0
  159. package/src/components/app/TestResult/TestResultNavigation/styles.scss +48 -0
  160. package/src/components/app/TestResult/TestResultOverview.tsx +40 -0
  161. package/src/components/app/TestResult/TestResultParameters/index.tsx +30 -0
  162. package/src/components/app/TestResult/TestResultParameters/styles.scss +8 -0
  163. package/src/components/app/TestResult/TestResultPrevStatuses/index.tsx +52 -0
  164. package/src/components/app/TestResult/TestResultPrevStatuses/styles.scss +57 -0
  165. package/src/components/app/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +50 -0
  166. package/src/components/app/TestResult/TestResultRetriesView/index.tsx +24 -0
  167. package/src/components/app/TestResult/TestResultRetriesView/styles.scss +69 -0
  168. package/src/components/app/TestResult/TestResultSetup/index.tsx +50 -0
  169. package/src/components/app/TestResult/TestResultSeverity/index.tsx +34 -0
  170. package/src/components/app/TestResult/TestResultSeverity/styles.scss +29 -0
  171. package/src/components/app/TestResult/TestResultStatus/index.tsx +26 -0
  172. package/src/components/app/TestResult/TestResultStatus/styles.scss +36 -0
  173. package/src/components/app/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx +12 -0
  174. package/src/components/app/TestResult/TestResultSteps/attachment.tsx +70 -0
  175. package/src/components/app/TestResult/TestResultSteps/attachmentCode.tsx +15 -0
  176. package/src/components/app/TestResult/TestResultSteps/attachmentImage.tsx +29 -0
  177. package/src/components/app/TestResult/TestResultSteps/attachmentVideo.tsx +12 -0
  178. package/src/components/app/TestResult/TestResultSteps/index.tsx +49 -0
  179. package/src/components/app/TestResult/TestResultSteps/styles.scss +225 -0
  180. package/src/components/app/TestResult/TestResultSteps/testResultAttachment.tsx +79 -0
  181. package/src/components/app/TestResult/TestResultSteps/testResultAttachmentInfo.tsx +87 -0
  182. package/src/components/app/TestResult/TestResultSteps/testResultStep.tsx +71 -0
  183. package/src/components/app/TestResult/TestResultSteps/testResultStepInfo.tsx +33 -0
  184. package/src/components/app/TestResult/TestResultSteps/wrongAttachment.tsx +8 -0
  185. package/src/components/app/TestResult/TestResultTabs/index.tsx +59 -0
  186. package/src/components/app/TestResult/TestResultTabs/styles.scss +76 -0
  187. package/src/components/app/TestResult/TestResultTeardown/index.tsx +49 -0
  188. package/src/components/app/TestResult/index.tsx +56 -0
  189. package/src/components/app/ThemeButton/ThemeButton.tsx +22 -0
  190. package/src/components/app/Tree/Tree.tsx +122 -0
  191. package/src/components/app/Tree/TreeHeader.tsx +81 -0
  192. package/src/components/app/Tree/TreeItem.tsx +31 -0
  193. package/src/components/app/Tree/TreeItemIcon.tsx +35 -0
  194. package/src/components/app/Tree/index.tsx +40 -0
  195. package/src/components/app/Tree/styles.scss +170 -0
  196. package/src/components/commons/Button/index.tsx +176 -0
  197. package/src/components/commons/Button/styles.scss +558 -0
  198. package/src/components/commons/Counter/index.tsx +29 -0
  199. package/src/components/commons/Counter/styles.scss +21 -0
  200. package/src/components/commons/Label/index.tsx +11 -0
  201. package/src/components/commons/Label/styles.scss +7 -0
  202. package/src/components/commons/Link/index.tsx +20 -0
  203. package/src/components/commons/Link/styles.scss +46 -0
  204. package/src/components/commons/Loadable/index.tsx +32 -0
  205. package/src/components/commons/Menu/index.tsx +173 -0
  206. package/src/components/commons/Menu/styles.scss +94 -0
  207. package/src/components/commons/PageLoader/index.tsx +10 -0
  208. package/src/components/commons/PageLoader/styles.scss +29 -0
  209. package/src/components/commons/SearchBox/index.tsx +61 -0
  210. package/src/components/commons/SearchBox/styles.scss +58 -0
  211. package/src/components/commons/Spinner/index.tsx +8 -0
  212. package/src/components/commons/SuccessRatePieChart/index.tsx +52 -0
  213. package/src/components/commons/SuccessRatePieChart/styles.scss +12 -0
  214. package/src/components/commons/SvgIcon/index.tsx +46 -0
  215. package/src/components/commons/SvgIcon/styles.scss +26 -0
  216. package/src/components/commons/Toggle/index.tsx +29 -0
  217. package/src/components/commons/Toggle/styles.scss +48 -0
  218. package/src/components/commons/Tooltip/index.tsx +123 -0
  219. package/src/components/commons/Tooltip/styles.scss +38 -0
  220. package/src/components/commons/Typography/index.tsx +99 -0
  221. package/src/hooks/useDebouncedCallback.ts +31 -0
  222. package/src/i18n/constants.ts +105 -0
  223. package/src/i18n/locales/am.json +115 -0
  224. package/src/i18n/locales/az.json +115 -0
  225. package/src/i18n/locales/de.json +115 -0
  226. package/src/i18n/locales/en.json +115 -0
  227. package/src/i18n/locales/es.json +114 -0
  228. package/src/i18n/locales/fr.json +115 -0
  229. package/src/i18n/locales/he.json +115 -0
  230. package/src/i18n/locales/it.json +115 -0
  231. package/src/i18n/locales/ja.json +115 -0
  232. package/src/i18n/locales/ka.json +115 -0
  233. package/src/i18n/locales/kr.json +115 -0
  234. package/src/i18n/locales/nl.json +115 -0
  235. package/src/i18n/locales/pl.json +113 -0
  236. package/src/i18n/locales/pt.json +115 -0
  237. package/src/i18n/locales/ru.json +113 -0
  238. package/src/i18n/locales/sv.json +115 -0
  239. package/src/i18n/locales/tr.json +115 -0
  240. package/src/i18n/locales/zh.json +115 -0
  241. package/src/index.html +35 -0
  242. package/src/index.tsx +48 -0
  243. package/src/stores/chart.ts +32 -0
  244. package/src/stores/envInfo.ts +34 -0
  245. package/src/stores/index.ts +4 -0
  246. package/src/stores/locale.ts +79 -0
  247. package/src/stores/stats.ts +36 -0
  248. package/src/stores/testResults.ts +40 -0
  249. package/src/stores/theme.ts +33 -0
  250. package/src/stores/tree.ts +33 -0
  251. package/src/stores/types.ts +5 -0
  252. package/src/types/globals.d.ts +8 -0
  253. package/src/types/window.d.ts +8 -0
  254. package/src/utils/attachments.ts +156 -0
  255. package/src/utils/capitalize.ts +4 -0
  256. package/src/utils/copyToClipboard.ts +3 -0
  257. package/src/utils/isMac.ts +7 -0
  258. package/src/utils/statuses.ts +55 -0
  259. package/src/utils/time.ts +17 -0
  260. package/src/utils/treeFilters.ts +150 -0
  261. package/tsconfig.json +25 -0
  262. package/types.d.ts +53 -0
  263. package/webpack.config.js +108 -0
@@ -0,0 +1,56 @@
1
+ import { FunctionComponent, FunctionalComponent } from "preact";
2
+ import { AllureAwesomeTestResult } from "types";
3
+ import * as styles from "@/components/app/BaseLayout/styles.scss";
4
+ import { TestResultAttachmentView } from "@/components/app/TestResult/TestResultAttachmentsView";
5
+ import TestResultEmpty from "@/components/app/TestResult/TestResultEmpty";
6
+ import { TestResultHeader } from "@/components/app/TestResult/TestResultHeader";
7
+ import TestResultHistoryView from "@/components/app/TestResult/TestResultHistory";
8
+ import { TestResultInfo } from "@/components/app/TestResult/TestResultInfo";
9
+ import { TestResultOverview } from "@/components/app/TestResult/TestResultOverview";
10
+ import { TestResultRetriesView } from "@/components/app/TestResult/TestResultRetriesView";
11
+ import { TestResultTabs, useTestResultTabsContext } from "@/components/app/TestResult/TestResultTabs";
12
+
13
+ export type TestResultViewProps = {
14
+ testResult?: AllureAwesomeTestResult;
15
+ };
16
+
17
+ const TestResultView: FunctionalComponent<TestResultViewProps> = ({ testResult }) => {
18
+ const { currentTab } = useTestResultTabsContext();
19
+ const viewMap = {
20
+ overview: TestResultOverview,
21
+ history: TestResultHistoryView,
22
+ attachments: TestResultAttachmentView,
23
+ retries: TestResultRetriesView,
24
+ };
25
+ const ViewComponent = viewMap[currentTab];
26
+
27
+ return <ViewComponent testResult={testResult} />;
28
+ };
29
+
30
+ export type TestResultContentProps = {
31
+ testResult?: AllureAwesomeTestResult;
32
+ };
33
+
34
+ const TestResultContent: FunctionalComponent<TestResultContentProps> = ({ testResult }) => {
35
+ return (
36
+ <TestResultTabs initialTab="overview">
37
+ <TestResultInfo testResult={testResult} />
38
+ <TestResultView testResult={testResult} />
39
+ </TestResultTabs>
40
+ );
41
+ };
42
+
43
+ export type TestResultProps = {
44
+ testResult?: AllureAwesomeTestResult;
45
+ };
46
+
47
+ const TestResult: FunctionComponent<TestResultProps> = ({ testResult }) => (
48
+ <>
49
+ <TestResultHeader testResult={testResult} />
50
+ <div className={styles.content}>
51
+ {testResult ? <TestResultContent testResult={testResult} /> : <TestResultEmpty />}
52
+ </div>
53
+ </>
54
+ );
55
+
56
+ export default TestResult;
@@ -0,0 +1,22 @@
1
+ import { useEffect } from "preact/hooks";
2
+ import lineShapesMoonIcon from "@/assets/svg/line-shapes-moon.svg";
3
+ import lineShapesSunIcon from "@/assets/svg/line-shapes-sun.svg";
4
+ import { IconButton } from "@/components/commons/Button";
5
+ import { getTheme, themeStore, toggleTheme } from "@/stores/theme";
6
+
7
+ export const ThemeButton = () => {
8
+ const theme = themeStore.value;
9
+
10
+ useEffect(() => {
11
+ getTheme();
12
+ }, []);
13
+
14
+ return (
15
+ <IconButton
16
+ onClick={toggleTheme}
17
+ style="ghost"
18
+ icon={theme === "light" ? lineShapesMoonIcon.id : lineShapesSunIcon.id}
19
+ size="s"
20
+ />
21
+ );
22
+ };
@@ -0,0 +1,122 @@
1
+ import type { Statistic, TestStatus, WithChildren } from "@allurereport/core-api";
2
+ import cx from "clsx";
3
+ import type { FunctionComponent } from "preact";
4
+ import { useState } from "preact/hooks";
5
+ import { useReportContentContext } from "@/components/app/ReportBody/context";
6
+ import TreeItem from "@/components/app/Tree/TreeItem";
7
+ import { Loadable } from "@/components/commons/Loadable";
8
+ import { PageLoader } from "@/components/commons/PageLoader";
9
+ import { Text } from "@/components/commons/Typography";
10
+ import { useI18n } from "@/stores";
11
+ import { treeStore } from "@/stores/tree";
12
+ import { filterGroups, filterLeaves } from "@/utils/treeFilters";
13
+ import TreeHeader from "./TreeHeader";
14
+ import * as styles from "./styles.scss";
15
+
16
+ interface TreeProps {
17
+ statistic?: Statistic;
18
+ leaves?: WithChildren["leaves"];
19
+ groups?: WithChildren["groups"];
20
+ name?: string;
21
+ root?: boolean;
22
+ statusFilter?: TestStatus;
23
+ }
24
+
25
+ const Tree: FunctionComponent<TreeProps> = ({ statusFilter, root, name, leaves = [], groups = [], statistic }) => {
26
+ const [isOpened, setIsOpen] = useState(statistic === undefined || !!statistic.failed || !!statistic.broken);
27
+ const { t } = useI18n("empty");
28
+
29
+ return (
30
+ <Loadable
31
+ source={treeStore}
32
+ renderLoader={() => <PageLoader />}
33
+ renderData={(treeData) => {
34
+ const reportContext = useReportContentContext();
35
+ const toggleTree = () => {
36
+ setIsOpen(!isOpened);
37
+ };
38
+ const leavesToRender = filterLeaves(leaves, treeData?.leavesById, statusFilter, reportContext);
39
+ const groupsToRender = filterGroups(
40
+ groups,
41
+ treeData?.groupsById,
42
+ treeData?.leavesById,
43
+ statusFilter,
44
+ reportContext,
45
+ );
46
+ if (!groupsToRender.length && !leavesToRender.length) {
47
+ return (
48
+ <div className={styles["tree-list"]}>
49
+ <div className={styles["tree-empty-results"]}>
50
+ <Text className={styles["tree-empty-results-title"]}>{t("no-results")}</Text>
51
+ </div>
52
+ </div>
53
+ );
54
+ }
55
+
56
+ const treeContent = isOpened && (
57
+ <div
58
+ className={cx({
59
+ [styles["tree-content"]]: true,
60
+ [styles.root]: root,
61
+ })}
62
+ >
63
+ {groupsToRender.map((groupId) => {
64
+ const group = treeData?.groupsById?.[groupId];
65
+
66
+ if (!group) {
67
+ return null;
68
+ }
69
+
70
+ return (
71
+ <Tree
72
+ key={group.nodeId}
73
+ name={group.name}
74
+ leaves={group.leaves}
75
+ groups={group.groups}
76
+ statistic={group.statistic}
77
+ statusFilter={statusFilter}
78
+ />
79
+ );
80
+ })}
81
+ {leavesToRender.map((leafId) => {
82
+ const leaf = treeData?.leavesById?.[leafId];
83
+
84
+ if (!leaf) {
85
+ return null;
86
+ }
87
+
88
+ return (
89
+ <TreeItem
90
+ data-testid="tree-leaf"
91
+ key={leaf.nodeId}
92
+ id={leaf.nodeId}
93
+ name={leaf.name}
94
+ status={leaf.status}
95
+ duration={leaf.duration}
96
+ />
97
+ );
98
+ })}
99
+ </div>
100
+ );
101
+
102
+ return (
103
+ <div className={styles.tree}>
104
+ {name && (
105
+ <TreeHeader
106
+ categoryTitle={name}
107
+ isOpened={isOpened}
108
+ toggleTree={toggleTree}
109
+ statusFilter={statusFilter}
110
+ statistic={statistic}
111
+ data-testid="tree-group-header"
112
+ />
113
+ )}
114
+ {treeContent}
115
+ </div>
116
+ );
117
+ }}
118
+ />
119
+ );
120
+ };
121
+
122
+ export default Tree;
@@ -0,0 +1,81 @@
1
+ import { Statistic, statusesList } from "@allurereport/core-api";
2
+ import { clsx } from "clsx";
3
+ import { FunctionComponent } from "preact";
4
+ import { ArrowButton } from "@/components/app/ArrowButton";
5
+ import { Loadable } from "@/components/commons/Loadable";
6
+ import { Text } from "@/components/commons/Typography";
7
+ import { statsStore } from "@/stores";
8
+ import * as styles from "./styles.scss";
9
+
10
+ interface TreeHeaderProps {
11
+ statistic?: Statistic;
12
+ categoryTitle: string;
13
+ isOpened: boolean;
14
+ toggleTree: () => void;
15
+ statusFilter?: string;
16
+ }
17
+
18
+ const maxWidthTab: number = 140;
19
+ const minWidthTab: number = 46;
20
+ // to make the progress bar more visually responsive for smaller values,
21
+ // we can adjust the formula by adding an offset to stretch the lower part
22
+ // of the logarithmic scale
23
+ const offset: number = 10;
24
+
25
+ const progress = (current: number, total: number) => {
26
+ const logOffset = Math.log(offset);
27
+ return (Math.log(current + offset) - logOffset) / (Math.log(total + offset) - logOffset);
28
+ };
29
+
30
+ const TreeHeader: FunctionComponent<TreeHeaderProps> = ({
31
+ categoryTitle,
32
+ isOpened,
33
+ toggleTree,
34
+ statusFilter = "total",
35
+ statistic,
36
+ ...rest
37
+ }) => {
38
+ return (
39
+ <Loadable
40
+ source={statsStore}
41
+ renderData={(stats) => {
42
+ const width = Math.floor(progress(statistic.total, stats.total) * (maxWidthTab - minWidthTab) + minWidthTab);
43
+
44
+ const treeHeaderBar = statistic
45
+ ? statusesList
46
+ .map((status) => ({ status, value: statistic[status] }))
47
+ .filter(
48
+ ({ status, value }) =>
49
+ value !== undefined && (statusFilter === "total" || (statusFilter === status && value > 0)),
50
+ )
51
+ .map(({ status, value }) => {
52
+ const className = clsx(styles[`tree-header-bar-item`], styles[status]);
53
+ const style = { flexGrow: `${value}` };
54
+
55
+ return (
56
+ <div key={status} className={className} style={style}>
57
+ {value}
58
+ </div>
59
+ );
60
+ })
61
+ : null;
62
+
63
+ return (
64
+ <div {...rest} className={styles["tree-header"]} onClick={toggleTree}>
65
+ <ArrowButton isOpened={isOpened} />
66
+ <Text size="m" bold className={styles["tree-header-title"]}>
67
+ {categoryTitle}
68
+ </Text>
69
+ {treeHeaderBar && (
70
+ <div className={styles["tree-header-bar"]} style={{ width: `${width}px` }}>
71
+ {treeHeaderBar}
72
+ </div>
73
+ )}
74
+ </div>
75
+ );
76
+ }}
77
+ />
78
+ );
79
+ };
80
+
81
+ export default TreeHeader;
@@ -0,0 +1,31 @@
1
+ import { type TestStatus, formatDuration } from "@allurereport/core-api";
2
+ import type { FunctionComponent } from "preact";
3
+ import TreeItemIcon from "@/components/app/Tree/TreeItemIcon";
4
+ import { Text } from "@/components/commons/Typography";
5
+ import { navigateTo } from "@/index";
6
+ import * as styles from "./styles.scss";
7
+
8
+ interface TreeItemProps {
9
+ name: string;
10
+ status: TestStatus;
11
+ duration?: number;
12
+ id: string;
13
+ }
14
+
15
+ export const TreeItem: FunctionComponent<TreeItemProps> = ({ name, status, duration, id, ...rest }) => {
16
+ const formattedDuration = formatDuration(duration);
17
+
18
+ return (
19
+ <div {...rest} className={styles["tree-item"]} onClick={() => navigateTo(id)}>
20
+ <TreeItemIcon status={status} />
21
+ <Text data-testid="tree-leaf-title" className={styles["item-title"]}>
22
+ {name}
23
+ </Text>
24
+ <Text data-testid="tree-leaf-duration" type="ui" size={"m"} className={styles["item-time"]}>
25
+ {formattedDuration}
26
+ </Text>
27
+ </div>
28
+ );
29
+ };
30
+
31
+ export default TreeItem;
@@ -0,0 +1,35 @@
1
+ import { clsx } from "clsx";
2
+ import { FunctionalComponent } from "preact";
3
+ import AlertCircle from "@/assets/svg/solid-alert-circle.svg";
4
+ import CheckCircle from "@/assets/svg/solid-check-circle.svg";
5
+ import HelpCircle from "@/assets/svg/solid-help-circle.svg";
6
+ import MinusCircle from "@/assets/svg/solid-minus-circle.svg";
7
+ import XCircle from "@/assets/svg/solid-x-circle.svg";
8
+ import { SvgIcon } from "@/components/commons/SvgIcon";
9
+ import * as styles from "./styles.scss";
10
+
11
+ interface TestStatusIconProps {
12
+ status?: "failed" | "broken" | "passed" | "skipped" | "unknown";
13
+ className?: string;
14
+ classNameIcon?: string;
15
+ }
16
+
17
+ const icons = {
18
+ failed: XCircle.id,
19
+ broken: AlertCircle.id,
20
+ passed: CheckCircle.id,
21
+ skipped: MinusCircle.id,
22
+ unknown: HelpCircle.id,
23
+ };
24
+
25
+ const TreeItemIcon: FunctionalComponent<TestStatusIconProps> = ({ status = "unknown", className, classNameIcon }) => {
26
+ const statusClass = clsx(styles[`status-${status}`], classNameIcon);
27
+
28
+ return (
29
+ <div data-testid={`tree-leaf-status-${status}`} className={clsx(styles["tree-item-icon"], className)}>
30
+ <SvgIcon className={statusClass} id={icons[status]}></SvgIcon>
31
+ </div>
32
+ );
33
+ };
34
+
35
+ export default TreeItemIcon;
@@ -0,0 +1,40 @@
1
+ import type { TestStatus } from "@allurereport/core-api";
2
+ import { useTabsContext } from "@/components/app/Tabs";
3
+ import Tree from "@/components/app/Tree/Tree";
4
+ import { Loadable } from "@/components/commons/Loadable";
5
+ import { PageLoader } from "@/components/commons/PageLoader";
6
+ import { Text } from "@/components/commons/Typography";
7
+ import { useI18n } from "@/stores/locale";
8
+ import { treeStore } from "@/stores/tree";
9
+ import * as styles from "./styles.scss";
10
+
11
+ export const TreeList = () => {
12
+ const { t } = useI18n("empty");
13
+ const { currentTab } = useTabsContext();
14
+
15
+ return (
16
+ <Loadable
17
+ source={treeStore}
18
+ renderLoader={() => <PageLoader />}
19
+ renderData={(treeData) => {
20
+ const { groups, leaves } = treeData?.root ?? {};
21
+
22
+ if (!groups && !leaves) {
23
+ return (
24
+ <div className={styles["tree-list"]}>
25
+ <div className={styles["tree-empty-results"]}>
26
+ <Text className={styles["tree-empty-results-title"]}>{t("no-results")}</Text>
27
+ </div>
28
+ </div>
29
+ );
30
+ }
31
+
32
+ return (
33
+ <div className={styles["tree-list"]}>
34
+ <Tree groups={groups} leaves={leaves} statusFilter={currentTab as TestStatus} root />
35
+ </div>
36
+ );
37
+ }}
38
+ />
39
+ );
40
+ };
@@ -0,0 +1,170 @@
1
+ .tree {
2
+ position: relative;
3
+
4
+ &:not(:first-child) {
5
+ border-top: 1px solid var(--on-border-muted);
6
+ }
7
+ }
8
+
9
+ .tree-list {
10
+ min-height: 128px;
11
+ }
12
+
13
+ .tree-header {
14
+ display: flex;
15
+ align-items: center;
16
+ gap: 4px;
17
+ transition: background-color 300ms;
18
+ cursor: pointer;
19
+ padding: 4px 8px 4px 6px;
20
+
21
+ &:hover {
22
+ background: var(--bg-control-flat-medium);
23
+ }
24
+ }
25
+
26
+ .tree-header-arrow {
27
+ transform: rotate(-90deg);
28
+ transition: transform 200ms;
29
+ }
30
+
31
+ .tree-header-arrow-opened {
32
+ transform: rotate(0);
33
+ }
34
+
35
+ .tree-header-title {
36
+ white-space: nowrap;
37
+ overflow: hidden;
38
+ text-overflow: ellipsis;
39
+ margin-right: 24px;
40
+ }
41
+
42
+ .tree-count {
43
+ display: flex;
44
+ }
45
+
46
+ .tree-item {
47
+ display: flex;
48
+ justify-content: space-between;
49
+ padding: 6px 8px 6px 6px;
50
+ transition: background-color 300ms;
51
+ gap: 4px;
52
+ align-items: center;
53
+ cursor: pointer;
54
+ position: relative;
55
+
56
+ &:hover {
57
+ background: var(--bg-control-flat-medium);
58
+ }
59
+
60
+ &:not(:first-child) {
61
+ border-top: 1px solid var(--on-border-muted);
62
+ }
63
+ }
64
+
65
+ .item-title {
66
+ display: flex;
67
+ }
68
+
69
+ .item-time {
70
+ flex: none;
71
+ margin-left: auto;
72
+ color: var(--on-text-hint);
73
+ }
74
+
75
+ .test-count {
76
+ display: flex;
77
+ margin-left: auto;
78
+ }
79
+
80
+ .tree-content:not(.root) {
81
+ display: block;
82
+ padding-left: 24px;
83
+ margin-bottom: 12px;
84
+ border-top: 1px solid var(--on-border-muted);
85
+ }
86
+
87
+ .tree-item-icon {
88
+ padding: 2px 4px;
89
+ height: max-content;
90
+ }
91
+
92
+ .status-passed {
93
+ color: var(--bg-support-castor);
94
+ }
95
+
96
+ .status-failed {
97
+ color: var(--bg-support-capella);
98
+ }
99
+
100
+ .status-broken {
101
+ color: var(--bg-support-atlas);
102
+ }
103
+
104
+ .status-skipped {
105
+ color: var(--bg-support-rau);
106
+ }
107
+
108
+ .status-unknown {
109
+ color: var(--bg-support-skat);
110
+ }
111
+
112
+ .tree-header-bar {
113
+ display: inline-flex;
114
+ font-family: var(--font-family);
115
+ max-width: 140px;
116
+ min-width: 46px;
117
+ border-radius: 4px;
118
+ height: 12px;
119
+ background: var(--on-text-hint);
120
+ margin-left: auto;
121
+ font-size: 10px;
122
+ font-weight: var(--font-weight-extra-bold);
123
+ line-height: 12px;
124
+ overflow: hidden;
125
+ }
126
+
127
+ .tree-header-bar-item {
128
+ display: flex;
129
+ min-width: 16px;
130
+ justify-content: center;
131
+ text-align: center;
132
+ padding: 0 6px;
133
+ flex-grow: 1;
134
+
135
+ &.passed {
136
+ background-color: var(--bg-support-castor);
137
+ color: var(--constant-on-text-primary);
138
+ }
139
+
140
+ &.failed {
141
+ background-color: var(--bg-support-capella);
142
+ color: var(--constant-on-text-primary);
143
+ }
144
+
145
+ &.broken {
146
+ background-color: var(--bg-support-atlas);
147
+ color: var(--constant-on-text-primary);
148
+ }
149
+
150
+ &.skipped {
151
+ background-color: var(--bg-support-rau);
152
+ color: var(--constant-on-text-primary);
153
+ }
154
+
155
+ &.unknown {
156
+ background-color: var(--bg-support-skat);
157
+ color: var(--constant-on-text-primary);
158
+ }
159
+ }
160
+
161
+ .tree-empty-results {
162
+ display: flex;
163
+ padding: 44px 24px;
164
+ align-items: center;
165
+ justify-content: center;
166
+ }
167
+
168
+ .tree-empty-results-title {
169
+ color: var(--on-text-secondary);
170
+ }