@allurereport/web-classic 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 (241) hide show
  1. package/.babelrc--old.cjs +18 -0
  2. package/.babelrc.js +46 -0
  3. package/.eslintrc--old.cjs +125 -0
  4. package/.eslintrc.cjs +22 -0
  5. package/README.md +27 -0
  6. package/dist/multi/10.app-970f027d.js +1 -0
  7. package/dist/multi/222.app-970f027d.js +1 -0
  8. package/dist/multi/26.app-970f027d.js +1 -0
  9. package/dist/multi/302.app-970f027d.js +1 -0
  10. package/dist/multi/304.app-970f027d.js +1 -0
  11. package/dist/multi/369.app-970f027d.js +1 -0
  12. package/dist/multi/389.app-970f027d.js +1 -0
  13. package/dist/multi/498.app-970f027d.js +1 -0
  14. package/dist/multi/60.app-970f027d.js +1 -0
  15. package/dist/multi/643.app-970f027d.js +1 -0
  16. package/dist/multi/671.app-970f027d.js +1 -0
  17. package/dist/multi/725.app-970f027d.js +1 -0
  18. package/dist/multi/770.app-970f027d.js +1 -0
  19. package/dist/multi/848.app-970f027d.js +1 -0
  20. package/dist/multi/853.app-970f027d.js +1 -0
  21. package/dist/multi/872.app-970f027d.js +1 -0
  22. package/dist/multi/895.app-970f027d.js +1 -0
  23. package/dist/multi/920.app-970f027d.js +1 -0
  24. package/dist/multi/979.app-970f027d.js +1 -0
  25. package/dist/multi/991.app-970f027d.js +1 -0
  26. package/dist/multi/JetBrainsMono_vf-9e9649b6..woff2 +0 -0
  27. package/dist/multi/JetBrainsMono_vf-b9a9c326..woff +0 -0
  28. package/dist/multi/app-970f027d.js +2 -0
  29. package/dist/multi/app-970f027d.js.LICENSE.txt +25 -0
  30. package/dist/multi/manifest.json +28 -0
  31. package/dist/multi/pt-root-ui_vf-22fe60ca..woff +0 -0
  32. package/dist/multi/pt-root-ui_vf-9d251e8b..woff2 +0 -0
  33. package/dist/multi/styles-970f027d.css +283 -0
  34. package/dist/single/app-2babff54.js +2 -0
  35. package/dist/single/app-2babff54.js.LICENSE.txt +25 -0
  36. package/dist/single/manifest.json +3 -0
  37. package/package--old.json +106 -0
  38. package/package.json +107 -0
  39. package/postcss.config.js +5 -0
  40. package/src/assets/scss/_common.scss +142 -0
  41. package/src/assets/scss/code.scss +71 -0
  42. package/src/assets/scss/day.scss +51 -0
  43. package/src/assets/scss/fonts.scss +3 -0
  44. package/src/assets/scss/index.scss +9 -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/components/ArrowButton/index.tsx +36 -0
  51. package/src/components/ArrowButton/styles.scss +35 -0
  52. package/src/components/BaseLayout/index.tsx +23 -0
  53. package/src/components/BaseLayout/styles.scss +63 -0
  54. package/src/components/Behaviors/BehaviorsList.tsx +67 -0
  55. package/src/components/Behaviors/index.tsx +60 -0
  56. package/src/components/Behaviors/styles.scss +196 -0
  57. package/src/components/Categories/CategoriesList.tsx +67 -0
  58. package/src/components/Categories/index.tsx +60 -0
  59. package/src/components/Categories/styles.scss +196 -0
  60. package/src/components/Footer/FooterLogo.tsx +16 -0
  61. package/src/components/Footer/FooterVersion.tsx +33 -0
  62. package/src/components/Footer/index.tsx +13 -0
  63. package/src/components/Footer/styles.scss +14 -0
  64. package/src/components/Graphs/index.tsx +2 -0
  65. package/src/components/Header/index.tsx +14 -0
  66. package/src/components/Header/styles.scss +26 -0
  67. package/src/components/HeaderActions/Filters.tsx +90 -0
  68. package/src/components/HeaderActions/HeaderActions.tsx +59 -0
  69. package/src/components/HeaderActions/SortBy.tsx +128 -0
  70. package/src/components/HeaderActions/styles.scss +82 -0
  71. package/src/components/LanguagePicker/index.tsx +41 -0
  72. package/src/components/LanguagePicker/styles.scss +3 -0
  73. package/src/components/MainReport/index.tsx +19 -0
  74. package/src/components/Metadata/index.tsx +121 -0
  75. package/src/components/Metadata/styles.scss +146 -0
  76. package/src/components/MetadataButton/index.tsx +32 -0
  77. package/src/components/MetadataButton/styles.scss +53 -0
  78. package/src/components/Modal/ModalView.hbs +13 -0
  79. package/src/components/Modal/ModalView.js +43 -0
  80. package/src/components/Modal/index.tsx +174 -0
  81. package/src/components/Modal/styles.scss +126 -0
  82. package/src/components/Overview/index.tsx +9 -0
  83. package/src/components/Packages/PackagesList.tsx +67 -0
  84. package/src/components/Packages/index.tsx +59 -0
  85. package/src/components/Packages/styles.scss +196 -0
  86. package/src/components/ReportBody/Filters.tsx +92 -0
  87. package/src/components/ReportBody/HeaderActions.tsx +21 -0
  88. package/src/components/ReportBody/SortBy.tsx +132 -0
  89. package/src/components/ReportBody/context.tsx +106 -0
  90. package/src/components/ReportBody/index.tsx +71 -0
  91. package/src/components/ReportBody/styles.scss +64 -0
  92. package/src/components/ReportHeader/ReportHeaderLabelList.tsx +12 -0
  93. package/src/components/ReportHeader/ReportHeaderLogo.tsx +10 -0
  94. package/src/components/ReportHeader/ReportHeaderPie.tsx +14 -0
  95. package/src/components/ReportHeader/index.tsx +33 -0
  96. package/src/components/ReportHeader/styles.scss +49 -0
  97. package/src/components/ReportLogo/index.tsx +16 -0
  98. package/src/components/ReportLogo/styles.scss +20 -0
  99. package/src/components/ReportLogoFull/index.tsx +20 -0
  100. package/src/components/ReportLogoFull/styles.scss +7 -0
  101. package/src/components/ReportMetadata/MetadataItem.tsx +45 -0
  102. package/src/components/ReportMetadata/MetadataSummary.tsx +81 -0
  103. package/src/components/ReportMetadata/MetadataTestType.tsx +16 -0
  104. package/src/components/ReportMetadata/MetadataWithIcon.tsx +21 -0
  105. package/src/components/ReportMetadata/index.tsx +46 -0
  106. package/src/components/ReportMetadata/styles.scss +99 -0
  107. package/src/components/SideBySide/index.tsx +54 -0
  108. package/src/components/SideBySide/styles.scss +59 -0
  109. package/src/components/SideNav/SideNav.tsx +78 -0
  110. package/src/components/SideNav/SideNavView.hbs +39 -0
  111. package/src/components/SideNav/SideNavView.js +81 -0
  112. package/src/components/SideNav/styles.scss +126 -0
  113. package/src/components/Suites/index.tsx +62 -0
  114. package/src/components/Suites/styles.scss +10 -0
  115. package/src/components/Tabs/index.tsx +33 -0
  116. package/src/components/Tabs/styles.scss +56 -0
  117. package/src/components/TestResult/TestResultAttachmentsView/index.tsx +27 -0
  118. package/src/components/TestResult/TestResultAttachmentsView/styles.scss +12 -0
  119. package/src/components/TestResult/TestResultDescription/index.tsx +27 -0
  120. package/src/components/TestResult/TestResultDescription/styles.scss +12 -0
  121. package/src/components/TestResult/TestResultDropdown/index.tsx +23 -0
  122. package/src/components/TestResult/TestResultDropdown/styles.scss +34 -0
  123. package/src/components/TestResult/TestResultEmpty/index.tsx +33 -0
  124. package/src/components/TestResult/TestResultEmpty/styles.scss +25 -0
  125. package/src/components/TestResult/TestResultError/index.tsx +48 -0
  126. package/src/components/TestResult/TestResultError/styles.scss +51 -0
  127. package/src/components/TestResult/TestResultHeader/index.tsx +53 -0
  128. package/src/components/TestResult/TestResultHeader/styles.scss +43 -0
  129. package/src/components/TestResult/TestResultHistory/TestResultHistoryItem.tsx +67 -0
  130. package/src/components/TestResult/TestResultHistory/index.tsx +26 -0
  131. package/src/components/TestResult/TestResultHistory/styles.scss +63 -0
  132. package/src/components/TestResult/TestResultInfo/TestResultInfoStatuses.tsx +30 -0
  133. package/src/components/TestResult/TestResultInfo/index.tsx +79 -0
  134. package/src/components/TestResult/TestResultInfo/styles.scss +50 -0
  135. package/src/components/TestResult/TestResultLinks/index.tsx +56 -0
  136. package/src/components/TestResult/TestResultLinks/styles.scss +30 -0
  137. package/src/components/TestResult/TestResultMetadata/index.tsx +27 -0
  138. package/src/components/TestResult/TestResultMetadata/styles.scss +8 -0
  139. package/src/components/TestResult/TestResultNavigation/index.tsx +80 -0
  140. package/src/components/TestResult/TestResultNavigation/styles.scss +48 -0
  141. package/src/components/TestResult/TestResultOverview.tsx +40 -0
  142. package/src/components/TestResult/TestResultParameters/index.tsx +30 -0
  143. package/src/components/TestResult/TestResultParameters/styles.scss +8 -0
  144. package/src/components/TestResult/TestResultPrevStatuses/index.tsx +49 -0
  145. package/src/components/TestResult/TestResultPrevStatuses/styles.scss +57 -0
  146. package/src/components/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +49 -0
  147. package/src/components/TestResult/TestResultRetriesView/index.tsx +20 -0
  148. package/src/components/TestResult/TestResultRetriesView/styles.scss +69 -0
  149. package/src/components/TestResult/TestResultSetup/index.tsx +49 -0
  150. package/src/components/TestResult/TestResultSeverity/index.tsx +27 -0
  151. package/src/components/TestResult/TestResultSeverity/styles.scss +29 -0
  152. package/src/components/TestResult/TestResultStatus/index.tsx +26 -0
  153. package/src/components/TestResult/TestResultStatus/styles.scss +36 -0
  154. package/src/components/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx +12 -0
  155. package/src/components/TestResult/TestResultSteps/attachment.tsx +68 -0
  156. package/src/components/TestResult/TestResultSteps/attachmentCode.tsx +20 -0
  157. package/src/components/TestResult/TestResultSteps/attachmentImage.tsx +32 -0
  158. package/src/components/TestResult/TestResultSteps/attachmentVideo.tsx +15 -0
  159. package/src/components/TestResult/TestResultSteps/index.tsx +49 -0
  160. package/src/components/TestResult/TestResultSteps/styles.scss +225 -0
  161. package/src/components/TestResult/TestResultSteps/testResultAttachment.tsx +77 -0
  162. package/src/components/TestResult/TestResultSteps/testResultAttachmentInfo.tsx +83 -0
  163. package/src/components/TestResult/TestResultSteps/testResultStep.tsx +78 -0
  164. package/src/components/TestResult/TestResultSteps/testResultStepInfo.tsx +30 -0
  165. package/src/components/TestResult/TestResultSteps/wrongAttachment.tsx +8 -0
  166. package/src/components/TestResult/TestResultTabs/index.tsx +59 -0
  167. package/src/components/TestResult/TestResultTabs/styles.scss +76 -0
  168. package/src/components/TestResult/TestResultTeardown/index.tsx +49 -0
  169. package/src/components/TestResult/TestResultView.hbs +32 -0
  170. package/src/components/TestResult/TestResultView.js +90 -0
  171. package/src/components/TestResult/index.tsx +54 -0
  172. package/src/components/TestResult/styles.scss +29 -0
  173. package/src/components/TestResultView/index.tsx +31 -0
  174. package/src/components/ThemeButton/ThemeButton.tsx +20 -0
  175. package/src/components/Timeline/index.tsx +2 -0
  176. package/src/components/Tree/Tree.tsx +76 -0
  177. package/src/components/Tree/TreeHeader.tsx +82 -0
  178. package/src/components/Tree/TreeItem.tsx +49 -0
  179. package/src/components/Tree/TreeItemIcon.tsx +32 -0
  180. package/src/components/Tree/index.tsx +60 -0
  181. package/src/components/Tree/styles.scss +185 -0
  182. package/src/favicon.ico +0 -0
  183. package/src/index.html +40 -0
  184. package/src/index.js +52 -0
  185. package/src/index.tsx +60 -0
  186. package/src/mixins.scss +128 -0
  187. package/src/rtl.scss +19 -0
  188. package/src/stores/behaviors.ts +127 -0
  189. package/src/stores/categories.ts +127 -0
  190. package/src/stores/chart.ts +32 -0
  191. package/src/stores/envInfo.ts +34 -0
  192. package/src/stores/index.ts +4 -0
  193. package/src/stores/locale.ts +83 -0
  194. package/src/stores/packages.ts +127 -0
  195. package/src/stores/router.ts +55 -0
  196. package/src/stores/stats.ts +36 -0
  197. package/src/stores/tabs.ts +7 -0
  198. package/src/stores/testResults.ts +66 -0
  199. package/src/stores/theme.ts +33 -0
  200. package/src/stores/tree.ts +127 -0
  201. package/src/stores/types.ts +5 -0
  202. package/src/styles.scss +91 -0
  203. package/src/translations/am.json +127 -0
  204. package/src/translations/az.json +127 -0
  205. package/src/translations/br.json +214 -0
  206. package/src/translations/constants.ts +124 -0
  207. package/src/translations/de.json +127 -0
  208. package/src/translations/en.json +128 -0
  209. package/src/translations/es.json +118 -0
  210. package/src/translations/fr.json +118 -0
  211. package/src/translations/he.json +118 -0
  212. package/src/translations/isv.json +216 -0
  213. package/src/translations/it.json +118 -0
  214. package/src/translations/ja.json +118 -0
  215. package/src/translations/ka.json +118 -0
  216. package/src/translations/kr.json +118 -0
  217. package/src/translations/nl.json +118 -0
  218. package/src/translations/pl.json +116 -0
  219. package/src/translations/pt.json +118 -0
  220. package/src/translations/ru.json +116 -0
  221. package/src/translations/sv.json +118 -0
  222. package/src/translations/tr.json +118 -0
  223. package/src/translations/zh.json +118 -0
  224. package/src/types/globals.d.ts +13 -0
  225. package/src/types/window.d.ts +8 -0
  226. package/src/utils/attachments.ts +156 -0
  227. package/src/utils/capitalize.ts +6 -0
  228. package/src/utils/copyToClipboard.ts +16 -0
  229. package/src/utils/isMac.ts +8 -0
  230. package/src/utils/navigate.ts +7 -0
  231. package/src/utils/statuses.js +1 -0
  232. package/src/utils/statuses.ts +55 -0
  233. package/src/utils/time.ts +17 -0
  234. package/src/utils/treeFilters.ts +139 -0
  235. package/src/variables.scss +71 -0
  236. package/test/utils/treeFilters.test.ts +448 -0
  237. package/tsconfig.json +25 -0
  238. package/types.d.ts +85 -0
  239. package/vitest.config.ts +18 -0
  240. package/webpack.config--old.js +127 -0
  241. package/webpack.config.js +108 -0
@@ -0,0 +1,49 @@
1
+ import { type HistoryTestResult } from "@allurereport/core-api";
2
+ import { SvgIcon, Text, TooltipWrapper, allureIcons } from "@allurereport/web-components";
3
+ import type { FunctionalComponent } from "preact";
4
+ import type { AwesomeTestResult } from "types";
5
+ import { useI18n } from "@/stores";
6
+ import { capitalize } from "@/utils/capitalize";
7
+ import { navigateTo } from "@/utils/navigate";
8
+ import { timestampToDate } from "@/utils/time";
9
+ import * as styles from "./styles.scss";
10
+
11
+ const TestResultPrevStatus: FunctionalComponent<{ item: HistoryTestResult }> = ({ item }) => {
12
+ return (
13
+ <div className={styles["test-result-prev-status"]} onClick={() => navigateTo(`testresult/${item.id}`)}>
14
+ <SvgIcon id={allureIcons.lineShapesDotCircle} className={styles[`status-${item?.status}`]} />
15
+ </div>
16
+ );
17
+ };
18
+ const TestResultPrevStatusTooltip: FunctionalComponent<{ item: HistoryTestResult }> = ({ item }) => {
19
+ const convertedStop = item.stop && timestampToDate(item.stop);
20
+ const { t } = useI18n("statuses");
21
+ const status = t(item.status);
22
+
23
+ return (
24
+ <div className={styles["test-result-prev-status-tooltip"]}>
25
+ <Text tag={"div"} size={"m"} bold>
26
+ {capitalize(status)}
27
+ </Text>
28
+ <Text size={"m"}>{convertedStop}</Text>
29
+ </div>
30
+ );
31
+ };
32
+
33
+ export type TestResultPrevStatusesProps = {
34
+ history: AwesomeTestResult["history"];
35
+ };
36
+
37
+ export const TestResultPrevStatuses: FunctionalComponent<TestResultPrevStatusesProps> = ({ history }) => {
38
+ return (
39
+ <div className={styles["test-result-prev-statuses"]}>
40
+ {history?.slice(0, 6).map((item, key) => (
41
+ <div key={key} className={styles["test-result-prev-status"]}>
42
+ <TooltipWrapper key={key} tooltipComponent={<TestResultPrevStatusTooltip item={item} />}>
43
+ <TestResultPrevStatus item={item} />
44
+ </TooltipWrapper>
45
+ </div>
46
+ ))}
47
+ </div>
48
+ );
49
+ };
@@ -0,0 +1,57 @@
1
+ .test-result-prev-statuses {
2
+ display: flex;
3
+ align-items: center;
4
+ }
5
+
6
+ .test-result-prev-status {
7
+ position: relative;
8
+ display: flex;
9
+ cursor: pointer;
10
+
11
+ &:not(:first-child) {
12
+ padding-left: 8px;
13
+
14
+ &:before {
15
+ content: "";
16
+ width: 8px;
17
+ position: absolute;
18
+ height: 2px;
19
+ left: 0;
20
+ top: 0;
21
+ bottom: 0;
22
+ margin: auto;
23
+ background: var(--on-border-medium);
24
+ }
25
+ }
26
+ }
27
+
28
+ .status-passed {
29
+ color: var(--bg-support-castor);
30
+ }
31
+
32
+ .status-failed {
33
+ color: var(--bg-support-capella);
34
+ }
35
+
36
+ .status-broken {
37
+ color: var(--bg-support-atlas);
38
+ }
39
+
40
+ .status-skipped {
41
+ color: var(--bg-support-rau);
42
+ }
43
+
44
+ .status-unknown {
45
+ color: var(--bg-support-skat);
46
+ }
47
+
48
+ .test-result-prev-status-tooltip {
49
+ text-align: center;
50
+ background-color: var(--constant-bg-base-modal);
51
+ color: var(--constant-on-text-primary);
52
+ padding: 2px 8px;
53
+ border-radius: 6px;
54
+ font-size: 12px;
55
+ max-width: 600px;
56
+ min-width: max-content;
57
+ }
@@ -0,0 +1,49 @@
1
+ import { type TestResult, formatDuration } from "@allurereport/core-api";
2
+ import { IconButton, Text, allureIcons } from "@allurereport/web-components";
3
+ import { type FunctionalComponent } from "preact";
4
+ import { useState } from "preact/hooks";
5
+ import { ArrowButton } from "@/components/ArrowButton";
6
+ import { TestResultError } from "@/components/TestResult/TestResultError";
7
+ import * as styles from "@/components/TestResult/TestResultRetriesView/styles.scss";
8
+ import TreeItemIcon from "@/components/Tree/TreeItemIcon";
9
+ import { navigateTo } from "@/utils/navigate";
10
+ import { timestampToDate } from "@/utils/time";
11
+
12
+ export const TestResultRetriesItem: FunctionalComponent<{
13
+ testResultItem: TestResult;
14
+ }> = ({ testResultItem }) => {
15
+ const { id, status, message, trace, stop, duration } = testResultItem;
16
+ const [isOpened, setIsOpen] = useState(false);
17
+ const convertedStop = timestampToDate(stop);
18
+ const formattedDuration = formatDuration(duration as number);
19
+ const navigateUrl = `testresult/${id}`;
20
+
21
+ return (
22
+ <div>
23
+ <div className={styles["test-result-retries-item-header"]} onClick={() => setIsOpen(!isOpened)}>
24
+ {Boolean(message) && <ArrowButton isOpened={isOpened} icon={allureIcons.lineArrowsChevronDown} />}
25
+ <div className={styles["test-result-retries-item-wrap"]}>
26
+ <TreeItemIcon status={status} className={styles["test-result-retries-item-status"]} />
27
+ <Text className={styles["test-result-retries-item-text"]}>{convertedStop}</Text>
28
+ <div className={styles["test-result-retries-item-info"]}>
29
+ <Text type="ui" size={"s"} className={styles["item-time"]}>
30
+ {formattedDuration}
31
+ </Text>
32
+ <IconButton
33
+ icon={allureIcons.lineGeneralLinkExternal}
34
+ style={"ghost"}
35
+ size={"s"}
36
+ className={styles["test-result-retries-item-link"]}
37
+ onClick={() => navigateTo(navigateUrl)}
38
+ />
39
+ </div>
40
+ </div>
41
+ </div>
42
+ {isOpened && message && (
43
+ <div className={styles["test-result-retries-item-content"]}>
44
+ <TestResultError message={message} trace={trace} />
45
+ </div>
46
+ )}
47
+ </div>
48
+ );
49
+ };
@@ -0,0 +1,20 @@
1
+ import type { FunctionalComponent } from "preact";
2
+ import type { AwesomeTestResult } from "types";
3
+ import * as styles from "@/components/TestResult/TestResultHistory/styles.scss";
4
+ import { TestResultRetriesItem } from "@/components/TestResult/TestResultRetriesView/TestResultRetriesItem";
5
+ import { useI18n } from "@/stores";
6
+
7
+ export const TestResultRetriesView: FunctionalComponent<{ testResult: AwesomeTestResult }> = ({ testResult }) => {
8
+ const { retries } = testResult ?? {};
9
+ const { t } = useI18n("empty");
10
+
11
+ return (
12
+ <div className={styles["test-result-history"]}>
13
+ {retries.length ? (
14
+ retries?.map((item, key) => <TestResultRetriesItem testResultItem={item} key={key} />)
15
+ ) : (
16
+ <div className={styles["test-result-empty"]}>{t("no-retries-results")}</div>
17
+ )}
18
+ </div>
19
+ );
20
+ };
@@ -0,0 +1,69 @@
1
+ .test-result-retries {
2
+ padding: 12px 24px 32px;
3
+ min-height: 320px;
4
+ }
5
+
6
+ .test-result-retries-item-header {
7
+ display: flex;
8
+ width: 100%;
9
+ gap: 4px;
10
+ align-items: center;
11
+ cursor: pointer;
12
+
13
+ a {
14
+ color: inherit;
15
+ cursor: pointer;
16
+ text-decoration: none;
17
+ display: contents;
18
+ }
19
+ }
20
+
21
+ .test-result-retries-item-wrap {
22
+ transition: background-color 300ms;
23
+ display: flex;
24
+ gap: 4px;
25
+ justify-content: space-between;
26
+ border-radius: 6px;
27
+ padding: 4px;
28
+ width: 100%;
29
+ align-items: flex-start;
30
+
31
+ &:hover {
32
+ background: var(--bg-control-flat-medium);
33
+ }
34
+ }
35
+
36
+ .test-result-retries-item-text {
37
+ padding-top: 2px;
38
+ }
39
+
40
+ .test-result-retries-item-info {
41
+ display: flex;
42
+ gap: 4px;
43
+ align-items: center;
44
+ margin-left: auto;
45
+ }
46
+
47
+ .item-time {
48
+ margin-left: auto;
49
+ line-height: 20px;
50
+ color: var(--on-text-secondary);
51
+ }
52
+
53
+ .test-result-retries-item-content {
54
+ padding-left: 24px;
55
+ }
56
+
57
+ .test-result-retries-item-link {
58
+ color: var(--on-icon-secondary);
59
+ }
60
+
61
+ .test-result-retries-item-status {
62
+ padding-top: 4px;
63
+ }
64
+
65
+ .test-result-empty {
66
+ display: flex;
67
+ width: 100%;
68
+ justify-content: center;
69
+ }
@@ -0,0 +1,49 @@
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
+
11
+ const typeMap = {
12
+ before: TestResultStep,
13
+ after: TestResultStep,
14
+ step: TestResultStep,
15
+ attachment: TestResultAttachment,
16
+ };
17
+
18
+ export type TestResultSetupProps = {
19
+ setup: AwesomeTestResult["setup"];
20
+ };
21
+
22
+ export const TestResultSetup: FunctionalComponent<TestResultSetupProps> = ({ setup }) => {
23
+ const [isOpened, setIsOpen] = useState(false);
24
+ const { t } = useI18n("execution");
25
+
26
+ return (
27
+ <div className={styles["test-result-steps"]}>
28
+ <TestResultDropdown
29
+ icon={allureIcons.lineTimeClockStopwatch}
30
+ isOpened={isOpened}
31
+ setIsOpen={setIsOpen}
32
+ counter={setup?.length}
33
+ title={t("setup")}
34
+ />
35
+ {isOpened && (
36
+ <div className={styles["test-result-steps-root"]}>
37
+ {setup?.map((item, key) => {
38
+ const StepComponent = typeMap[item.type];
39
+ return StepComponent ? (
40
+ // FIXME: use proper type in the StepComponent component
41
+ // @ts-ignore
42
+ <StepComponent item={item} stepIndex={key + 1} key={key} className={styles["test-result-step-root"]} />
43
+ ) : null;
44
+ })}
45
+ </div>
46
+ )}
47
+ </div>
48
+ );
49
+ };
@@ -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,26 @@
1
+ import type { TestStatus } from "@allurereport/core-api";
2
+ import { Text } from "@allurereport/web-components";
3
+ import clsx from "clsx";
4
+ import TreeItemIcon from "@/components/Tree/TreeItemIcon";
5
+ import { useI18n } from "@/stores";
6
+ import { capitalize } from "@/utils/capitalize";
7
+ import * as styles from "./styles.scss";
8
+
9
+ export const TestResultStatus = ({ status }: { status: TestStatus }) => {
10
+ const { t } = useI18n("statuses");
11
+ return (
12
+ <div
13
+ data-testid={`test-result-status-${status}`}
14
+ className={clsx(styles["test-result-status"], styles[`status-${status}`])}
15
+ >
16
+ <TreeItemIcon
17
+ status={status}
18
+ className={styles["test-result-status-icon"]}
19
+ classNameIcon={styles["test-result-status-icon"]}
20
+ />
21
+ <Text type={"ui"} size={"s"} bold className={styles["test-result-status-text"]}>
22
+ {capitalize(t(status) ?? status)}
23
+ </Text>
24
+ </div>
25
+ );
26
+ };
@@ -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,12 @@
1
+ import type { FunctionalComponent } from "preact";
2
+ import * as styles from "./styles.scss";
3
+
4
+ // TODO: use proper type here
5
+ export type HtmlAttachmentPreviewProps = {
6
+ attachment: { text: string };
7
+ };
8
+
9
+ export const HtmlAttachmentPreview: FunctionalComponent<HtmlAttachmentPreviewProps> = ({ attachment }) => {
10
+ // eslint-disable-next-line react/no-danger
11
+ return <div className={styles["html-attachment-preview"]} dangerouslySetInnerHTML={{ __html: attachment?.text }} />;
12
+ };
@@ -0,0 +1,68 @@
1
+ import type { AttachmentTestStepResult } from "@allurereport/core-api";
2
+ import { Spinner } from "@allurereport/web-components";
3
+ import type { FunctionalComponent } from "preact";
4
+ import { useEffect, useState } from "preact/hooks";
5
+ import { modalData } from "@/components/Modal";
6
+ import { HtmlAttachmentPreview } from "@/components/TestResult/TestResultSteps/HtmlAttachmentPreview";
7
+ import { AttachmentCode } from "@/components/TestResult/TestResultSteps/attachmentCode";
8
+ import { AttachmentImage } from "@/components/TestResult/TestResultSteps/attachmentImage";
9
+ import { AttachmentVideo } from "@/components/TestResult/TestResultSteps/attachmentVideo";
10
+ import { EmptyComponent } from "@/components/TestResult/TestResultSteps/wrongAttachment";
11
+ import { type Attachments, attachmentType, fetchAttachment } from "@/utils/attachments";
12
+ import * as styles from "./styles.scss";
13
+
14
+ const componentsByAttachmentType: Record<string, any> = {
15
+ image: AttachmentImage,
16
+ svg: AttachmentImage,
17
+ json: AttachmentCode,
18
+ code: AttachmentCode,
19
+ uri: AttachmentCode,
20
+ css: AttachmentCode,
21
+ table: AttachmentCode,
22
+ html: AttachmentCode,
23
+ text: AttachmentCode,
24
+ video: AttachmentVideo,
25
+ };
26
+ const previewComponentsByAttachmentType: Record<string, any> = {
27
+ html: HtmlAttachmentPreview,
28
+ };
29
+
30
+ export interface AttachmentTestStepResultProps {
31
+ item: AttachmentTestStepResult;
32
+ previewable?: boolean;
33
+ }
34
+
35
+ export const Attachment: FunctionalComponent<AttachmentTestStepResultProps> = ({ item, previewable }) => {
36
+ const {
37
+ link: { contentType, id, ext },
38
+ } = item;
39
+ const [attachment, setAttachment] = useState<Attachments>(null);
40
+ const [loaded, setLoaded] = useState(false);
41
+ const attachmentComponent = attachmentType(contentType);
42
+ const CurrentComponent = componentsByAttachmentType[attachmentComponent.type];
43
+ const CurrentPreviewComponent = previewComponentsByAttachmentType[attachmentComponent.type];
44
+
45
+ useEffect(() => {
46
+ const fetchData = async () => {
47
+ const result: Attachments = await fetchAttachment(id, ext, contentType);
48
+ setLoaded(true);
49
+ setAttachment(result);
50
+ };
51
+ fetchData();
52
+ }, [contentType, id, ext]);
53
+
54
+ if (!loaded) {
55
+ return (
56
+ <div className={styles["test-result-spinner"]}>
57
+ <Spinner />
58
+ </div>
59
+ );
60
+ }
61
+
62
+ // temp solution before modal component refactoring
63
+ if (CurrentPreviewComponent && previewable && modalData.value.preview) {
64
+ return <CurrentPreviewComponent attachment={attachment} item={item} />;
65
+ }
66
+
67
+ return CurrentComponent ? <CurrentComponent attachment={attachment} item={item} /> : <EmptyComponent />;
68
+ };
@@ -0,0 +1,20 @@
1
+ import { type AttachmentTestStepResult } from "@allurereport/core-api";
2
+ import { type FunctionalComponent } from "preact";
3
+ import { useEffect } from "preact/hooks";
4
+ import Prism from "prismjs";
5
+ import "@/assets/scss/code.scss";
6
+
7
+ export const AttachmentCode: FunctionalComponent<{
8
+ item: AttachmentTestStepResult;
9
+ attachment: { text?: string };
10
+ }> = ({ attachment, item }) => {
11
+ useEffect(() => {
12
+ Prism.highlightAll();
13
+ }, [attachment]);
14
+
15
+ return (
16
+ <pre key={item?.link?.id} className={`language-${item?.link?.ext?.replace(".", "")} line-numbers`}>
17
+ <code>{attachment?.text}</code>
18
+ </pre>
19
+ );
20
+ };
@@ -0,0 +1,32 @@
1
+ import { type FunctionalComponent } from "preact";
2
+ import { useEffect, useState } from "preact/hooks";
3
+ import * as styles from "@/components/TestResult/TestResultSteps/styles.scss";
4
+ import { EmptyComponent } from "@/components/TestResult/TestResultSteps/wrongAttachment";
5
+
6
+ export const AttachmentImage: FunctionalComponent<{
7
+ attachment: { img: string; originalFileName: string };
8
+ }> = ({ attachment }) => {
9
+ const [isValidImage, setIsValidImage] = useState(true);
10
+
11
+ useEffect(() => {
12
+ if (attachment?.img) {
13
+ const img = new Image();
14
+ img.onload = () => setIsValidImage(true);
15
+ img.onerror = () => setIsValidImage(false);
16
+ img.src = attachment.img;
17
+ }
18
+ }, [attachment?.img]);
19
+
20
+ if (!attachment?.img || !isValidImage) {
21
+ return (
22
+ <div className={styles["test-result-attachment-error"]}>
23
+ <EmptyComponent />
24
+ </div>
25
+ );
26
+ }
27
+ return (
28
+ <div className={styles["test-result-attachment-image"]}>
29
+ {attachment?.img && <img src={attachment.img} alt={attachment.originalFileName} />}
30
+ </div>
31
+ );
32
+ };
@@ -0,0 +1,15 @@
1
+ import { Spinner } from "@allurereport/web-components";
2
+ import { type FunctionalComponent } from "preact";
3
+
4
+ export const AttachmentVideo: FunctionalComponent<{
5
+ attachment: { src: string; contentType?: string };
6
+ }> = ({ attachment }) => {
7
+ if (!attachment) {
8
+ return <Spinner />;
9
+ }
10
+ return (
11
+ <video controls loop muted>
12
+ <source src={attachment?.src} type={attachment?.contentType} />
13
+ </video>
14
+ );
15
+ };
@@ -0,0 +1,49 @@
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 * as styles from "./styles.scss";
10
+
11
+ const typeMap = {
12
+ step: TestResultStep,
13
+ attachment: TestResultAttachment,
14
+ } as const;
15
+
16
+ export type TestResultStepsProps = {
17
+ steps: AwesomeTestResult["steps"];
18
+ };
19
+
20
+ type StepComponentProps = FunctionalComponent<{
21
+ item?: AwesomeTestStepResult;
22
+ stepIndex?: number;
23
+ }>;
24
+
25
+ export const TestResultSteps: FunctionalComponent<TestResultStepsProps> = ({ steps }) => {
26
+ const [isOpened, setIsOpen] = useState(true);
27
+
28
+ const { t } = useI18n("execution");
29
+ return (
30
+ <div className={styles["test-result-steps"]}>
31
+ <TestResultDropdown
32
+ icon={allureIcons.lineHelpersPlayCircle}
33
+ isOpened={isOpened}
34
+ setIsOpen={setIsOpen}
35
+ counter={steps?.length}
36
+ title={t("body")}
37
+ />
38
+ {isOpened && (
39
+ <div className={styles["test-result-steps-root"]}>
40
+ {steps?.map((item: AwesomeTestStepResult, index) => {
41
+ const { type } = item;
42
+ const StepComponent: StepComponentProps = typeMap[type];
43
+ return StepComponent ? <StepComponent item={item} stepIndex={index + 1} key={index} /> : null;
44
+ })}
45
+ </div>
46
+ )}
47
+ </div>
48
+ );
49
+ };