@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,32 @@
1
+ {{#if fullName}}
2
+ <div class="pane__subtitle long-line line-ellipsis">
3
+ {{> ../../blocks/clipboard-copy/clipboard-copy value=fullName}}
4
+ <span class="fullname__body">{{fullName}}</span>
5
+ </div>
6
+ {{/if}}
7
+ <h2 class="{{b 'pane' 'title' borderless=true}}">
8
+ <div class="{{b cls 'status'}}">
9
+ <span class="label label_status_{{status}}">{{t statusName}}</span>
10
+ </div>
11
+ <div class="{{b cls 'name'}}">
12
+ {{#if flaky}}
13
+ {{allure-icon 'flaky'}}
14
+ {{/if}}
15
+ {{#if newFailed}}
16
+ {{allure-icon 'newFailed'}}
17
+ {{/if}}
18
+ {{#if newPassed}}
19
+ {{allure-icon 'newPassed'}}
20
+ {{/if}}
21
+ {{#if newBroken}}
22
+ {{allure-icon 'newBroken'}}
23
+ {{/if}}
24
+ {{#if retriesStatusChange}}
25
+ {{allure-icon 'retriesStatusChange'}}
26
+ {{/if}}
27
+ <span class="long-line">{{name}}</span>
28
+ </div>
29
+ </h2>
30
+
31
+ {{> ../../blocks/tabs/tabs}}
32
+ <div class="{{b cls 'content'}}"></div>
@@ -0,0 +1,90 @@
1
+ import { View } from "backbone.marionette";
2
+ import { findWhere } from "underscore";
3
+ import ModalView from "@/components/Modal/ModalView.js";
4
+ import AttachmentView from "@/components/attachment/AttachmentView.js";
5
+ import ErrorSplashView from "@/components/error-splash/ErrorSplashView.js";
6
+ import TestResultOverviewView from "@/components/testresult-overview/TestResultOverviewView.js";
7
+ import { behavior, className, on, regions } from "@/decorators/index.js";
8
+ import translate from "@/helpers/t.js";
9
+ import pluginsRegistry from "@/utils/pluginsRegistry.js";
10
+ import template from "./TestResultView.hbs";
11
+ import "./styles.scss";
12
+
13
+ const subViews = [{ id: "", name: "testResult.overview.name", View: TestResultOverviewView }];
14
+
15
+ @className("test-result")
16
+ @behavior("TooltipBehavior", { position: "left" })
17
+ @behavior("ClipboardBehavior")
18
+ @regions({
19
+ content: ".test-result__content",
20
+ })
21
+ class TestResultView extends View {
22
+ template = template;
23
+
24
+ initialize({ routeState }) {
25
+ this.routeState = routeState;
26
+ this.tabs = subViews.concat(pluginsRegistry.testResultTabs);
27
+ this.tabName = this.routeState.get("testResultTab") || "";
28
+ this.listenTo(this.routeState, "change:testResultTab", (_, tabName) => this.onTabChange(tabName));
29
+ this.listenTo(this.routeState, "change:attachment", (_, uid) => this.onShowAttachment(uid));
30
+ }
31
+
32
+ onRender() {
33
+ const subView = findWhere(this.tabs, { id: this.tabName });
34
+ this.showChildView(
35
+ "content",
36
+ !subView
37
+ ? new ErrorSplashView({ code: 404, message: `Tab "${this.tabName}" not found` })
38
+ : new subView.View(this.options),
39
+ );
40
+
41
+ const attachment = this.routeState.get("attachment");
42
+ if (attachment) {
43
+ this.onShowAttachment(attachment);
44
+ }
45
+ }
46
+
47
+ onTabChange(tabName) {
48
+ this.tabName = tabName || "";
49
+ this.render();
50
+ }
51
+
52
+ onShowAttachment(uid) {
53
+ if (!uid && this.modalView) {
54
+ this.modalView.destroy();
55
+ }
56
+
57
+ if (uid) {
58
+ const attachment = this.model.getAttachment(uid);
59
+ this.modalView = new ModalView({
60
+ childView: attachment
61
+ ? new AttachmentView({ attachment, fullScreen: true })
62
+ : new ErrorSplashView({ code: 404, message: translate("errors.missedAttachment") }),
63
+ title: attachment ? attachment.name || attachment.source : translate("errors.notFound"),
64
+ });
65
+ this.modalView.show();
66
+ }
67
+ }
68
+
69
+ templateContext() {
70
+ const { baseUrl } = this.options;
71
+ return {
72
+ cls: this.className,
73
+ statusName: `status.${this.model.get("status")}`,
74
+ links: this.tabs.map((view) => {
75
+ return {
76
+ href: `${baseUrl}/${view.id}`,
77
+ name: view.name,
78
+ active: view.id === this.tabName,
79
+ };
80
+ }),
81
+ };
82
+ }
83
+
84
+ @on("click .status-details__trace-toggle")
85
+ onStacktraceClick(e) {
86
+ this.$(e.currentTarget).closest(".status-details").toggleClass("status-details__expanded");
87
+ }
88
+ }
89
+
90
+ export default TestResultView;
@@ -0,0 +1,54 @@
1
+ import type { FunctionComponent, FunctionalComponent } from "preact";
2
+ import type { AwesomeTestResult } from "types";
3
+ import * as styles from "@/components/BaseLayout/styles.scss";
4
+ import { TestResultAttachmentView } from "@/components/TestResult/TestResultAttachmentsView";
5
+ import TestResultEmpty from "@/components/TestResult/TestResultEmpty";
6
+ import TestResultHistoryView from "@/components/TestResult/TestResultHistory";
7
+ import { TestResultInfo } from "@/components/TestResult/TestResultInfo";
8
+ import { TestResultOverview } from "@/components/TestResult/TestResultOverview";
9
+ import { TestResultRetriesView } from "@/components/TestResult/TestResultRetriesView";
10
+ import { TestResultTabs, useTestResultTabsContext } from "@/components/TestResult/TestResultTabs";
11
+
12
+ export type TestResultViewProps = {
13
+ testResult?: AwesomeTestResult;
14
+ };
15
+
16
+ const TestResultView: FunctionalComponent<TestResultViewProps> = ({ testResult }) => {
17
+ const { currentTab } = useTestResultTabsContext();
18
+ const viewMap: Record<string, any> = {
19
+ overview: TestResultOverview,
20
+ history: TestResultHistoryView,
21
+ attachments: TestResultAttachmentView,
22
+ retries: TestResultRetriesView,
23
+ };
24
+ const ViewComponent = viewMap[currentTab];
25
+
26
+ return <ViewComponent testResult={testResult} />;
27
+ };
28
+
29
+ export type TestResultContentProps = {
30
+ testResult?: AwesomeTestResult;
31
+ };
32
+
33
+ const TestResultContent: FunctionalComponent<TestResultContentProps> = ({ testResult }) => {
34
+ return (
35
+ <TestResultTabs initialTab="overview">
36
+ <TestResultInfo testResult={testResult} />
37
+ <TestResultView testResult={testResult} />
38
+ </TestResultTabs>
39
+ );
40
+ };
41
+
42
+ export type TestResultProps = {
43
+ testResult?: AwesomeTestResult;
44
+ };
45
+
46
+ const TestResult: FunctionComponent<TestResultProps> = ({ testResult }) => (
47
+ <>
48
+ <div className={styles.content}>
49
+ {testResult ? <TestResultContent testResult={testResult} /> : <TestResultEmpty />}
50
+ </div>
51
+ </>
52
+ );
53
+
54
+ export default TestResult;
@@ -0,0 +1,29 @@
1
+ @import "../../variables.scss";
2
+ @import "../../mixins.scss";
3
+
4
+ .test-result {
5
+ &__name {
6
+ padding-left: 10px;
7
+ }
8
+ &__content {
9
+ margin-bottom: 300px;
10
+ }
11
+ }
12
+
13
+ .app__content > .test-result {
14
+ position: absolute;
15
+ width: 100%;
16
+ }
17
+
18
+ .testresult__failure_expanded > .testresult__trace {
19
+ display: block;
20
+ }
21
+
22
+ .message {
23
+ border-bottom: 3px solid;
24
+ @include status-border();
25
+ }
26
+
27
+ .fullname__copy {
28
+ cursor: pointer;
29
+ }
@@ -0,0 +1,31 @@
1
+ import { Loadable, PageLoader } from "@allurereport/web-components";
2
+ import { useEffect } from "preact/hooks";
3
+ import TestResult from "@/components/TestResult";
4
+ import TestResultEmpty from "@/components/TestResult/TestResultEmpty";
5
+ import { route } from "@/stores/router";
6
+ import { fetchTestResult, testResultStore } from "@/stores/testResults";
7
+
8
+ export const TestResultView = () => {
9
+ const { params } = route.value;
10
+ const { id: testResultId } = params;
11
+
12
+ useEffect(() => {
13
+ fetchTestResult(testResultId);
14
+ }, []);
15
+
16
+ return (
17
+ <Loadable
18
+ source={testResultStore}
19
+ renderLoader={() => <PageLoader />}
20
+ transformData={(data) => data[testResultId]}
21
+ renderError={() => <TestResultEmpty />}
22
+ renderData={(testResultItem) => (
23
+ <>
24
+ <div key={testResultId}>
25
+ <TestResult testResult={testResultItem} />
26
+ </div>
27
+ </>
28
+ )}
29
+ />
30
+ );
31
+ };
@@ -0,0 +1,20 @@
1
+ import { IconButton, allureIcons } from "@allurereport/web-components";
2
+ import { useEffect } from "preact/hooks";
3
+ import { getTheme, themeStore, toggleTheme } from "@/stores/theme";
4
+
5
+ export const ThemeButton = () => {
6
+ const theme = themeStore.value;
7
+
8
+ useEffect(() => {
9
+ getTheme();
10
+ }, []);
11
+
12
+ return (
13
+ <IconButton
14
+ onClick={toggleTheme}
15
+ style="ghost"
16
+ icon={theme === "light" ? allureIcons.lineShapesMoon : allureIcons.lineShapesSun}
17
+ size="s"
18
+ />
19
+ );
20
+ };
@@ -0,0 +1,2 @@
1
+ const Overview = () => <div>Overview</div>;
2
+ export default Overview;
@@ -0,0 +1,76 @@
1
+ import type { Statistic } from "@allurereport/core-api";
2
+ import cx from "clsx";
3
+ import type { FunctionComponent } from "preact";
4
+ import { useState } from "preact/hooks";
5
+ import type { AwesomeRecursiveTree, AwesomeStatus } from "types";
6
+ import TreeItem from "@/components/Tree/TreeItem";
7
+ import { route } from "@/stores/router";
8
+ import TreeHeader from "./TreeHeader";
9
+ import * as styles from "./styles.scss";
10
+
11
+ interface TreeProps {
12
+ statistic?: Statistic;
13
+ tree: AwesomeRecursiveTree;
14
+ name?: string;
15
+ root?: boolean;
16
+ statusFilter?: AwesomeStatus;
17
+ }
18
+
19
+ const Tree: FunctionComponent<TreeProps> = ({ tree, statusFilter, root, name, statistic }) => {
20
+ const { params } = route.value;
21
+ const { id: parentId, testResultId } = params;
22
+
23
+ const [isOpened, setIsOpen] = useState(
24
+ parentId === tree.nodeId || statistic === undefined || !!statistic.failed || !!statistic.broken,
25
+ );
26
+ const toggleTree = () => {
27
+ setIsOpen(!isOpened);
28
+ };
29
+ const emptyTree = !tree?.trees?.length && !tree?.leaves?.length;
30
+
31
+ if (emptyTree) {
32
+ return null;
33
+ }
34
+
35
+ const treeContent = isOpened && (
36
+ <div
37
+ data-testid="tree-content"
38
+ className={cx({
39
+ [styles["tree-content"]]: true,
40
+ [styles.root]: root,
41
+ })}
42
+ >
43
+ {tree?.trees?.map?.((subTree) => (
44
+ <Tree
45
+ key={subTree.nodeId}
46
+ name={subTree.name}
47
+ tree={subTree}
48
+ statistic={subTree.statistic}
49
+ statusFilter={statusFilter}
50
+ />
51
+ ))}
52
+ {tree?.leaves?.map?.((leaf) => (
53
+ <TreeItem
54
+ data-testid="tree-leaf"
55
+ key={leaf.nodeId}
56
+ id={leaf.nodeId}
57
+ name={leaf.name}
58
+ status={leaf.status}
59
+ groupOrder={leaf.groupOrder}
60
+ duration={leaf.duration}
61
+ parentNodeId={tree.nodeId}
62
+ isMarked={leaf.nodeId === testResultId}
63
+ />
64
+ ))}
65
+ </div>
66
+ );
67
+
68
+ return (
69
+ <div className={styles.tree}>
70
+ {name && <TreeHeader categoryTitle={name} isOpened={isOpened} toggleTree={toggleTree} statistic={statistic} />}
71
+ {treeContent}
72
+ </div>
73
+ );
74
+ };
75
+
76
+ export default Tree;
@@ -0,0 +1,82 @@
1
+ import { type Statistic, statusesList } from "@allurereport/core-api";
2
+ import { Loadable, Text } from "@allurereport/web-components";
3
+ import { clsx } from "clsx";
4
+ import { type FunctionComponent } from "preact";
5
+ import { ArrowButton } from "@/components/ArrowButton";
6
+ import { statsStore } from "@/stores";
7
+ import { route } from "@/stores/router";
8
+ import { treeFiltersStore } from "@/stores/tree";
9
+ import * as styles from "./styles.scss";
10
+
11
+ interface TreeHeaderProps {
12
+ statistic?: Statistic;
13
+ categoryTitle: string;
14
+ isOpened: boolean;
15
+ toggleTree: () => void;
16
+ }
17
+
18
+ const maxWidthTab = 140;
19
+ const minWidthTab = 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 = 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
+ statistic,
35
+ ...rest
36
+ }) => {
37
+ const { status: statusFilter } = treeFiltersStore.value;
38
+
39
+ return (
40
+ <Loadable
41
+ source={statsStore}
42
+ renderData={(stats: Statistic) => {
43
+ const width = Math.floor(progress(statistic.total, stats.total) * (maxWidthTab - minWidthTab) + minWidthTab);
44
+
45
+ const treeHeaderBar = statistic
46
+ ? statusesList
47
+ .map((status) => ({ status, value: statistic[status] }))
48
+ .filter(
49
+ ({ status, value }) =>
50
+ value !== undefined && (statusFilter === "total" || (statusFilter === status && value > 0)),
51
+ )
52
+ .map(({ status, value }) => {
53
+ const className = clsx(styles["tree-header-bar-item"], styles[status]);
54
+ const style = { flexGrow: value };
55
+
56
+ return (
57
+ <div key={status} className={className} style={style}>
58
+ {value}
59
+ </div>
60
+ );
61
+ })
62
+ : null;
63
+
64
+ return (
65
+ <div data-testid="tree-header" {...rest} className={styles["tree-header"]} onClick={toggleTree}>
66
+ <ArrowButton data-testid="tree-arrow" isOpened={isOpened} />
67
+ <Text data-testid="tree-header-title" size="m" bold className={styles["tree-header-title"]}>
68
+ {categoryTitle}
69
+ </Text>
70
+ {treeHeaderBar && (
71
+ <div className={styles["tree-header-bar"]} style={{ width: `${width}px` }}>
72
+ {treeHeaderBar}
73
+ </div>
74
+ )}
75
+ </div>
76
+ );
77
+ }}
78
+ />
79
+ );
80
+ };
81
+
82
+ export default TreeHeader;
@@ -0,0 +1,49 @@
1
+ import { type TestStatus, formatDuration } from "@allurereport/core-api";
2
+ import { Text } from "@allurereport/web-components";
3
+ import clsx from "clsx";
4
+ import type { FunctionComponent } from "preact";
5
+ import TreeItemIcon from "@/components/Tree/TreeItemIcon";
6
+ import { navigateTo, route } from "@/stores/router";
7
+ import * as styles from "./styles.scss";
8
+
9
+ interface TreeItemProps {
10
+ name: string;
11
+ status: TestStatus;
12
+ duration?: number;
13
+ id: string;
14
+ groupOrder: number;
15
+ parentNodeId?: string;
16
+ isMarked?: boolean;
17
+ }
18
+
19
+ export const TreeItem: FunctionComponent<TreeItemProps> = ({
20
+ name,
21
+ groupOrder,
22
+ status,
23
+ duration,
24
+ id,
25
+ parentNodeId,
26
+ isMarked,
27
+ ...rest
28
+ }) => {
29
+ const { tabName } = route.value;
30
+ const formattedDuration = formatDuration(duration);
31
+ const navigateToTR = () => navigateTo(`#${tabName}/${parentNodeId || "root"}/${id}`);
32
+
33
+ return (
34
+ <div {...rest} className={clsx(styles["tree-item"], isMarked && styles["tree-item-marked"])} onClick={navigateToTR}>
35
+ <TreeItemIcon status={status} />
36
+ <span data-testid="tree-leaf-order" className={styles.order}>
37
+ {groupOrder}
38
+ </span>
39
+ <Text data-testid="tree-leaf-title" className={styles["item-title"]}>
40
+ {name}
41
+ </Text>
42
+ <Text data-testid="tree-leaf-duration" type="ui" size={"m"} className={styles["item-time"]}>
43
+ {formattedDuration}
44
+ </Text>
45
+ </div>
46
+ );
47
+ };
48
+
49
+ export default TreeItem;
@@ -0,0 +1,32 @@
1
+ import { SvgIcon, allureIcons } from "@allurereport/web-components";
2
+ import { clsx } from "clsx";
3
+ import type { FunctionalComponent } from "preact";
4
+ import * as styles from "./styles.scss";
5
+
6
+ interface TestStatusIconProps {
7
+ status?: "failed" | "broken" | "passed" | "skipped" | "unknown";
8
+ className?: string;
9
+ classNameIcon?: string;
10
+ }
11
+
12
+ const { solidAlertCircle, solidCheckCircle, solidHelpCircle, solidMinusCircle, solidXCircle } = allureIcons;
13
+
14
+ const icons = {
15
+ failed: solidXCircle,
16
+ broken: solidAlertCircle,
17
+ passed: solidCheckCircle,
18
+ skipped: solidMinusCircle,
19
+ unknown: solidHelpCircle,
20
+ };
21
+
22
+ const TreeItemIcon: FunctionalComponent<TestStatusIconProps> = ({ status = "unknown", className, classNameIcon }) => {
23
+ const statusClass = clsx(styles[`status-${status}`], classNameIcon);
24
+
25
+ return (
26
+ <div data-testid={`tree-leaf-status-${status}`} className={clsx(styles["tree-item-icon"], className)}>
27
+ <SvgIcon className={statusClass} id={icons[status]} />
28
+ </div>
29
+ );
30
+ };
31
+
32
+ export default TreeItemIcon;
@@ -0,0 +1,60 @@
1
+ import { Button, Loadable, PageLoader, Text } from "@allurereport/web-components";
2
+ import { useEffect } from "preact/hooks";
3
+ import type { AwesomeStatus } from "types";
4
+ import Tree from "@/components/Tree/Tree";
5
+ import { useI18n } from "@/stores/locale";
6
+ import { currentTab } from "@/stores/tabs";
7
+ import { clearTreeFilters, filteredTree, noTests, noTestsFound, setTreeStatus, treeStore } from "@/stores/tree";
8
+ import * as styles from "./styles.scss";
9
+
10
+ export const TreeList = () => {
11
+ const { t } = useI18n("empty");
12
+
13
+ useEffect(() => {
14
+ setTreeStatus(currentTab.value as AwesomeStatus);
15
+ }, [currentTab.value]);
16
+
17
+ return (
18
+ <Loadable
19
+ source={treeStore}
20
+ renderLoader={() => <PageLoader />}
21
+ renderData={() => {
22
+ if (noTests.value) {
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
+ if (noTestsFound.value) {
33
+ return (
34
+ <div className={styles["tree-list"]}>
35
+ <div className={styles["tree-empty-results"]}>
36
+ <Text tag="p" className={styles["tree-empty-results-title"]}>
37
+ {t("no-tests-found")}
38
+ </Text>
39
+ <Button
40
+ className={styles["tree-empty-results-clear-button"]}
41
+ type="button"
42
+ text={t("clear-filters")}
43
+ size={"s"}
44
+ style={"outline"}
45
+ onClick={() => clearTreeFilters()}
46
+ />
47
+ </div>
48
+ </div>
49
+ );
50
+ }
51
+
52
+ return (
53
+ <div className={styles["tree-list"]}>
54
+ <Tree tree={filteredTree.value} statusFilter={currentTab.value as AwesomeStatus} root />
55
+ </div>
56
+ );
57
+ }}
58
+ />
59
+ );
60
+ };