@allurereport/web-awesome 3.0.0-beta.9 → 3.0.1

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 (290) hide show
  1. package/dist/multi/173.app-bae2a0fe5738d77cd976.js +1 -0
  2. package/dist/multi/174.app-bae2a0fe5738d77cd976.js +1 -0
  3. package/dist/multi/252.app-bae2a0fe5738d77cd976.js +1 -0
  4. package/dist/multi/282.app-bae2a0fe5738d77cd976.js +1 -0
  5. package/dist/multi/29.app-bae2a0fe5738d77cd976.js +1 -0
  6. package/dist/multi/416.app-bae2a0fe5738d77cd976.js +1 -0
  7. package/dist/multi/527.app-bae2a0fe5738d77cd976.js +1 -0
  8. package/dist/multi/600.app-bae2a0fe5738d77cd976.js +1 -0
  9. package/dist/multi/605.app-bae2a0fe5738d77cd976.js +1 -0
  10. package/dist/multi/638.app-bae2a0fe5738d77cd976.js +1 -0
  11. package/dist/multi/672.app-bae2a0fe5738d77cd976.js +1 -0
  12. package/dist/multi/686.app-bae2a0fe5738d77cd976.js +1 -0
  13. package/dist/multi/725.app-bae2a0fe5738d77cd976.js +1 -0
  14. package/dist/multi/741.app-bae2a0fe5738d77cd976.js +1 -0
  15. package/dist/multi/755.app-bae2a0fe5738d77cd976.js +1 -0
  16. package/dist/multi/894.app-bae2a0fe5738d77cd976.js +1 -0
  17. package/dist/multi/91.app-bae2a0fe5738d77cd976.js +1 -0
  18. package/dist/multi/943.app-bae2a0fe5738d77cd976.js +1 -0
  19. package/dist/multi/980.app-bae2a0fe5738d77cd976.js +1 -0
  20. package/dist/multi/app-bae2a0fe5738d77cd976.js +2 -0
  21. package/dist/multi/app-bae2a0fe5738d77cd976.js.LICENSE.txt +10 -0
  22. package/dist/multi/manifest.json +25 -24
  23. package/dist/multi/styles-bbf68b2ba63c38b53c38.css +48 -0
  24. package/dist/single/app-996d3b5869f8fc942b66.js +2 -0
  25. package/dist/single/app-996d3b5869f8fc942b66.js.LICENSE.txt +10 -0
  26. package/dist/single/manifest.json +1 -1
  27. package/package.json +31 -19
  28. package/src/assets/scss/day.scss +2 -0
  29. package/src/assets/scss/index.scss +1 -3
  30. package/src/assets/scss/night.scss +2 -0
  31. package/src/assets/scss/palette.scss +391 -391
  32. package/src/assets/scss/theme.scss +292 -79
  33. package/src/components/BaseLayout/index.tsx +10 -32
  34. package/src/components/BaseLayout/styles.scss +14 -4
  35. package/src/components/Charts/index.tsx +245 -0
  36. package/src/components/Charts/styles.scss +27 -0
  37. package/src/components/EnvironmentPicker/index.tsx +60 -0
  38. package/src/components/EnvironmentPicker/styles.scss +9 -0
  39. package/src/components/Footer/FooterLogo.tsx +1 -2
  40. package/src/components/Footer/FooterVersion.tsx +7 -3
  41. package/src/components/Footer/index.tsx +6 -2
  42. package/src/components/Header/CiInfo/index.tsx +67 -0
  43. package/src/components/Header/CiInfo/styles.scss +7 -0
  44. package/src/components/Header/index.tsx +21 -8
  45. package/src/components/Header/styles.scss +9 -1
  46. package/src/components/HeaderControls/index.tsx +20 -0
  47. package/src/components/MainReport/index.tsx +84 -6
  48. package/src/components/MainReport/styles.scss +20 -0
  49. package/src/components/Metadata/index.tsx +6 -4
  50. package/src/components/MetadataButton/index.tsx +14 -6
  51. package/src/components/MetadataButton/styles.scss +3 -0
  52. package/src/components/Modal/index.tsx +15 -167
  53. package/src/components/NavTabs/index.tsx +70 -0
  54. package/src/components/{TestResult/TestResultTabs → NavTabs}/styles.scss +0 -3
  55. package/src/components/Report/index.tsx +7 -0
  56. package/src/components/ReportBody/Filters.tsx +96 -64
  57. package/src/components/ReportBody/HeaderActions.tsx +2 -2
  58. package/src/components/ReportBody/SortBy.tsx +4 -7
  59. package/src/components/ReportBody/index.tsx +30 -24
  60. package/src/components/ReportBody/styles.scss +9 -3
  61. package/src/components/ReportGlobalAttachments/index.tsx +34 -0
  62. package/src/components/ReportGlobalAttachments/styles.scss +11 -0
  63. package/src/components/ReportGlobalErrors/index.tsx +30 -0
  64. package/src/components/ReportGlobalErrors/styles.scss +12 -0
  65. package/src/components/ReportHeader/ReportHeaderLogo.tsx +6 -2
  66. package/src/components/ReportHeader/ReportHeaderPie.tsx +1 -2
  67. package/src/components/ReportHeader/index.tsx +38 -12
  68. package/src/components/ReportHeader/styles.scss +9 -1
  69. package/src/components/ReportMetadata/MetadataSummary.tsx +57 -65
  70. package/src/components/ReportMetadata/MetadataWithIcon.tsx +11 -13
  71. package/src/components/ReportMetadata/index.tsx +50 -3
  72. package/src/components/ReportMetadata/styles.scss +0 -2
  73. package/src/components/ReportQualityGateResults/index.tsx +42 -0
  74. package/src/components/ReportQualityGateResults/styles.scss +44 -0
  75. package/src/components/ReportTabs/index.tsx +37 -0
  76. package/src/components/SectionPicker/index.tsx +55 -0
  77. package/src/components/SectionPicker/styles.scss +5 -0
  78. package/src/components/SectionSwitcher/index.tsx +16 -0
  79. package/src/components/SectionSwitcher/styles.scss +4 -0
  80. package/src/components/SectionTabs/index.tsx +0 -0
  81. package/src/components/SideBySide/index.tsx +52 -0
  82. package/src/components/SideBySide/styles.scss +64 -0
  83. package/src/components/SplitLayout/index.tsx +71 -0
  84. package/src/components/SplitLayout/styles.scss +84 -0
  85. package/src/components/TestResult/TestStepsEmpty/index.tsx +3 -9
  86. package/src/components/TestResult/TrAttachmentsView/index.tsx +29 -0
  87. package/src/components/TestResult/{TestResultDescription → TrDescription}/index.tsx +5 -5
  88. package/src/components/TestResult/{TestResultDropdown → TrDropdown}/index.tsx +7 -5
  89. package/src/components/TestResult/{TestResultEmpty → TrEmpty}/index.tsx +7 -13
  90. package/src/components/TestResult/TrEnvironmentItem/index.tsx +82 -0
  91. package/src/components/TestResult/TrEnvironmentItem/styles.scss +60 -0
  92. package/src/components/TestResult/TrEnvironmentsView/index.tsx +64 -0
  93. package/src/components/TestResult/TrEnvironmentsView/styles.scss +11 -0
  94. package/src/components/TestResult/TrError/TrDiff.tsx +121 -0
  95. package/src/components/TestResult/TrError/index.tsx +111 -0
  96. package/src/components/TestResult/TrError/styles.scss +223 -0
  97. package/src/components/TestResult/TrHeader/TrBreadcrumbs.tsx +44 -0
  98. package/src/components/TestResult/TrHeader/index.tsx +15 -0
  99. package/src/components/TestResult/{TestResultHeader → TrHeader}/styles.scss +7 -2
  100. package/src/components/TestResult/TrHistory/TrHistoryItem.tsx +94 -0
  101. package/src/components/TestResult/TrHistory/index.tsx +26 -0
  102. package/src/components/TestResult/{TestResultHistory → TrHistory}/styles.scss +2 -1
  103. package/src/components/TestResult/{TestResultInfo/TestResultInfoStatuses.tsx → TrInfo/TrInfoStatuses.tsx} +6 -4
  104. package/src/components/TestResult/TrInfo/index.tsx +99 -0
  105. package/src/components/TestResult/{TestResultInfo → TrInfo}/styles.scss +18 -0
  106. package/src/components/TestResult/{TestResultLinks → TrLinks}/index.tsx +8 -8
  107. package/src/components/TestResult/{TestResultMetadata → TrMetadata}/index.tsx +6 -6
  108. package/src/components/TestResult/{TestResultNavigation → TrNavigation}/index.tsx +7 -9
  109. package/src/components/TestResult/TrOverview.tsx +46 -0
  110. package/src/components/TestResult/{TestResultParameters → TrParameters}/index.tsx +4 -4
  111. package/src/components/TestResult/TrPrevStatuses/index.tsx +63 -0
  112. package/src/components/TestResult/TrPwTraces/PwTrace.tsx +34 -0
  113. package/src/components/TestResult/TrPwTraces/PwTraceButton.tsx +32 -0
  114. package/src/components/TestResult/TrPwTraces/index.tsx +32 -0
  115. package/src/components/TestResult/TrPwTraces/styles.scss +20 -0
  116. package/src/components/TestResult/TrRetriesView/TrRetriesItem.tsx +70 -0
  117. package/src/components/TestResult/TrRetriesView/index.tsx +29 -0
  118. package/src/components/TestResult/{TestResultSetup → TrSetup}/index.tsx +13 -13
  119. package/src/components/TestResult/{TestResultSeverity → TrSeverity}/index.tsx +2 -2
  120. package/src/components/TestResult/{TestResultStatus → TrStatus}/index.tsx +5 -5
  121. package/src/components/TestResult/TrSteps/TrAttachment.tsx +118 -0
  122. package/src/components/TestResult/{TestResultSteps/testResultAttachmentInfo.tsx → TrSteps/TrAttachmentInfo.tsx} +11 -11
  123. package/src/components/TestResult/TrSteps/TrStep.tsx +98 -0
  124. package/src/components/TestResult/TrSteps/TrStepInfo.tsx +90 -0
  125. package/src/components/TestResult/{TestResultSteps → TrSteps}/index.tsx +12 -12
  126. package/src/components/TestResult/{TestResultSteps → TrSteps}/styles.scss +49 -10
  127. package/src/components/TestResult/{TestResultSteps → TrSteps}/wrongAttachment.tsx +1 -1
  128. package/src/components/TestResult/TrTabs/index.tsx +42 -0
  129. package/src/components/TestResult/{TestResultTeardown → TrTeardown}/index.tsx +13 -13
  130. package/src/components/TestResult/index.tsx +54 -38
  131. package/src/components/TestResult/styles.scss +12 -0
  132. package/src/components/Timeline/index.tsx +100 -0
  133. package/src/components/Timeline/styles.scss +45 -0
  134. package/src/components/ToggleLayout/index.tsx +17 -0
  135. package/src/components/Tree/index.tsx +117 -11
  136. package/src/components/Tree/styles.scss +23 -5
  137. package/src/index.html +22 -6
  138. package/src/index.tsx +90 -20
  139. package/src/locales/az.json +378 -0
  140. package/src/locales/de.json +378 -0
  141. package/src/locales/en.json +378 -0
  142. package/src/locales/es.json +378 -0
  143. package/src/locales/fr.json +378 -0
  144. package/src/locales/he.json +378 -0
  145. package/src/locales/hy.json +378 -0
  146. package/src/locales/it.json +378 -0
  147. package/src/locales/ja.json +378 -0
  148. package/src/locales/ka.json +378 -0
  149. package/src/locales/kr.json +378 -0
  150. package/src/locales/nl.json +378 -0
  151. package/src/locales/pl.json +386 -0
  152. package/src/locales/pt.json +378 -0
  153. package/src/locales/ru.json +386 -0
  154. package/src/locales/sv.json +378 -0
  155. package/src/locales/tr.json +378 -0
  156. package/src/locales/ua.json +329 -0
  157. package/src/locales/zh.json +378 -0
  158. package/src/stores/chart.ts +41 -6
  159. package/src/stores/env.ts +88 -0
  160. package/src/stores/envInfo.ts +2 -2
  161. package/src/stores/globals.ts +28 -0
  162. package/src/stores/layout.ts +36 -0
  163. package/src/stores/locale.ts +77 -29
  164. package/src/stores/modal.ts +22 -0
  165. package/src/stores/qualityGate.ts +28 -0
  166. package/src/stores/router.ts +108 -0
  167. package/src/stores/sections.ts +63 -0
  168. package/src/stores/stats.ts +52 -7
  169. package/src/stores/testResults.ts +13 -9
  170. package/src/stores/theme.ts +15 -18
  171. package/src/stores/timeline.ts +39 -0
  172. package/src/stores/tree.ts +65 -110
  173. package/src/stores/treeFilters/actions.ts +67 -0
  174. package/src/stores/treeFilters/constants.ts +7 -0
  175. package/src/stores/treeFilters/index.ts +3 -0
  176. package/src/stores/treeFilters/store.ts +73 -0
  177. package/src/stores/treeFilters/types.ts +12 -0
  178. package/src/stores/variables.ts +40 -0
  179. package/src/styles.scss +66 -0
  180. package/src/utils/persist.ts +23 -0
  181. package/src/utils/time.ts +1 -0
  182. package/src/utils/tree.ts +30 -0
  183. package/src/utils/treeFilters.ts +42 -24
  184. package/test/components/Header/CiInfo.test.tsx +177 -0
  185. package/test/components/Header.test.tsx +122 -0
  186. package/test/stores/treeFilters.test.ts +302 -0
  187. package/test/utils/treeFilters.test.ts +189 -44
  188. package/tsconfig.json +7 -2
  189. package/tsconfig.node.json +8 -0
  190. package/types.d.ts +45 -24
  191. package/vitest.config.ts +15 -2
  192. package/vitest.setup.ts +1 -0
  193. package/webpack.config.js +35 -5
  194. package/dist/multi/141.app-f32e4213.js +0 -1
  195. package/dist/multi/222.app-f32e4213.js +0 -1
  196. package/dist/multi/335.app-f32e4213.js +0 -1
  197. package/dist/multi/34.app-f32e4213.js +0 -1
  198. package/dist/multi/349.app-f32e4213.js +0 -1
  199. package/dist/multi/378.app-f32e4213.js +0 -1
  200. package/dist/multi/406.app-f32e4213.js +0 -1
  201. package/dist/multi/476.app-f32e4213.js +0 -1
  202. package/dist/multi/53.app-f32e4213.js +0 -1
  203. package/dist/multi/584.app-f32e4213.js +0 -1
  204. package/dist/multi/690.app-f32e4213.js +0 -1
  205. package/dist/multi/747.app-f32e4213.js +0 -1
  206. package/dist/multi/767.app-f32e4213.js +0 -1
  207. package/dist/multi/816.app-f32e4213.js +0 -1
  208. package/dist/multi/83.app-f32e4213.js +0 -1
  209. package/dist/multi/873.app-f32e4213.js +0 -1
  210. package/dist/multi/920.app-f32e4213.js +0 -1
  211. package/dist/multi/991.app-f32e4213.js +0 -1
  212. package/dist/multi/app-f32e4213.js +0 -2
  213. package/dist/multi/app-f32e4213.js.LICENSE.txt +0 -16
  214. package/dist/multi/styles-f32e4213.css +0 -284
  215. package/dist/single/app-7fa8e43f.js +0 -2
  216. package/dist/single/app-7fa8e43f.js.LICENSE.txt +0 -16
  217. package/src/assets/scss/code.scss +0 -71
  218. package/src/assets/scss/typography.scss +0 -218
  219. package/src/components/ArrowButton/index.tsx +0 -36
  220. package/src/components/ArrowButton/styles.scss +0 -35
  221. package/src/components/LanguagePicker/index.tsx +0 -40
  222. package/src/components/Modal/styles.scss +0 -126
  223. package/src/components/ReportLogo/index.tsx +0 -16
  224. package/src/components/ReportLogo/styles.scss +0 -20
  225. package/src/components/ReportLogoFull/index.tsx +0 -20
  226. package/src/components/ReportLogoFull/styles.scss +0 -7
  227. package/src/components/Tabs/index.tsx +0 -62
  228. package/src/components/TestResult/TestResultAttachmentsView/index.tsx +0 -27
  229. package/src/components/TestResult/TestResultError/index.tsx +0 -59
  230. package/src/components/TestResult/TestResultError/styles.scss +0 -51
  231. package/src/components/TestResult/TestResultHeader/index.tsx +0 -55
  232. package/src/components/TestResult/TestResultHistory/TestResultHistoryItem.tsx +0 -67
  233. package/src/components/TestResult/TestResultHistory/index.tsx +0 -26
  234. package/src/components/TestResult/TestResultInfo/index.tsx +0 -79
  235. package/src/components/TestResult/TestResultOverview.tsx +0 -43
  236. package/src/components/TestResult/TestResultPrevStatuses/index.tsx +0 -49
  237. package/src/components/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +0 -52
  238. package/src/components/TestResult/TestResultRetriesView/index.tsx +0 -24
  239. package/src/components/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx +0 -12
  240. package/src/components/TestResult/TestResultSteps/attachment.tsx +0 -68
  241. package/src/components/TestResult/TestResultSteps/attachmentCode.tsx +0 -20
  242. package/src/components/TestResult/TestResultSteps/attachmentImage.tsx +0 -32
  243. package/src/components/TestResult/TestResultSteps/attachmentVideo.tsx +0 -15
  244. package/src/components/TestResult/TestResultSteps/testResultAttachment.tsx +0 -77
  245. package/src/components/TestResult/TestResultSteps/testResultStep.tsx +0 -85
  246. package/src/components/TestResult/TestResultSteps/testResultStepInfo.tsx +0 -30
  247. package/src/components/TestResult/TestResultTabs/index.tsx +0 -59
  248. package/src/components/ThemeButton/ThemeButton.tsx +0 -20
  249. package/src/components/Tree/Tree.tsx +0 -75
  250. package/src/components/Tree/TreeHeader.tsx +0 -82
  251. package/src/components/Tree/TreeItem.tsx +0 -35
  252. package/src/components/Tree/TreeItemIcon.tsx +0 -32
  253. package/src/i18n/constants.ts +0 -124
  254. package/src/i18n/locales/am.json +0 -120
  255. package/src/i18n/locales/az.json +0 -120
  256. package/src/i18n/locales/de.json +0 -120
  257. package/src/i18n/locales/en.json +0 -121
  258. package/src/i18n/locales/es.json +0 -120
  259. package/src/i18n/locales/fr.json +0 -120
  260. package/src/i18n/locales/he.json +0 -120
  261. package/src/i18n/locales/it.json +0 -120
  262. package/src/i18n/locales/ja.json +0 -120
  263. package/src/i18n/locales/ka.json +0 -120
  264. package/src/i18n/locales/kr.json +0 -120
  265. package/src/i18n/locales/nl.json +0 -120
  266. package/src/i18n/locales/pl.json +0 -118
  267. package/src/i18n/locales/pt.json +0 -120
  268. package/src/i18n/locales/ru.json +0 -118
  269. package/src/i18n/locales/sv.json +0 -120
  270. package/src/i18n/locales/tr.json +0 -120
  271. package/src/i18n/locales/zh.json +0 -120
  272. package/src/utils/attachments.ts +0 -156
  273. package/src/utils/capitalize.ts +0 -6
  274. /package/dist/multi/{JetBrainsMono_vf-b9a9c326..woff → JetBrainsMono_vf.woff} +0 -0
  275. /package/dist/multi/{JetBrainsMono_vf-9e9649b6..woff2 → JetBrainsMono_vf.woff2} +0 -0
  276. /package/dist/multi/{pt-root-ui_vf-22fe60ca..woff → pt-root-ui_vf.woff} +0 -0
  277. /package/dist/multi/{pt-root-ui_vf-9d251e8b..woff2 → pt-root-ui_vf.woff2} +0 -0
  278. /package/src/components/{Tabs → ReportTabs}/styles.scss +0 -0
  279. /package/src/components/TestResult/{TestResultAttachmentsView → TrAttachmentsView}/styles.scss +0 -0
  280. /package/src/components/TestResult/{TestResultDescription → TrDescription}/styles.scss +0 -0
  281. /package/src/components/TestResult/{TestResultDropdown → TrDropdown}/styles.scss +0 -0
  282. /package/src/components/TestResult/{TestResultEmpty → TrEmpty}/styles.scss +0 -0
  283. /package/src/components/TestResult/{TestResultLinks → TrLinks}/styles.scss +0 -0
  284. /package/src/components/TestResult/{TestResultMetadata → TrMetadata}/styles.scss +0 -0
  285. /package/src/components/TestResult/{TestResultNavigation → TrNavigation}/styles.scss +0 -0
  286. /package/src/components/TestResult/{TestResultParameters → TrParameters}/styles.scss +0 -0
  287. /package/src/components/TestResult/{TestResultPrevStatuses → TrPrevStatuses}/styles.scss +0 -0
  288. /package/src/components/TestResult/{TestResultRetriesView → TrRetriesView}/styles.scss +0 -0
  289. /package/src/components/TestResult/{TestResultSeverity → TrSeverity}/styles.scss +0 -0
  290. /package/src/components/TestResult/{TestResultStatus → TrStatus}/styles.scss +0 -0
@@ -0,0 +1,177 @@
1
+ import { CiType } from "@allurereport/core-api";
2
+ import { getReportOptions } from "@allurereport/web-commons";
3
+ import { cleanup, render, screen } from "@testing-library/preact";
4
+ import { h } from "preact";
5
+ import { type Mock, beforeEach, describe, expect, it, vi } from "vitest";
6
+ import { CiInfo } from "@/components/Header/CiInfo";
7
+
8
+ const fixtures = {
9
+ pullRequestUrl: "https://github.com/repo/pull/123",
10
+ jobUrl: "https://github.com/repo/actions/runs/123",
11
+ jobRunUrl: "https://github.com/repo/actions/runs/123/jobs/456",
12
+ pullRequestName: "PR #123",
13
+ jobName: "Build Job",
14
+ jobRunName: "Run #456",
15
+ };
16
+
17
+ vi.mock("@allurereport/web-components", async () => {
18
+ const { CiType } = await import("@allurereport/core-api");
19
+
20
+ return {
21
+ Text: (props: { children: string }) => <span>{props.children}</span>,
22
+ SvgIcon: (props: { id: string; size?: string }) => <span data-testid="icon">{props.id}</span>,
23
+ allureIcons: {
24
+ amazon: "amazon",
25
+ azure: "azure",
26
+ bitbucket: "bitbucket",
27
+ circleci: "circle",
28
+ drone: "drone",
29
+ github: "github",
30
+ gitlab: "gitlab",
31
+ jenkins: "jenkins",
32
+ },
33
+ };
34
+ });
35
+ vi.mock("@allurereport/web-commons", async (importOriginal) => {
36
+ return {
37
+ ...(await importOriginal()),
38
+ getReportOptions: vi.fn(),
39
+ };
40
+ });
41
+
42
+ beforeEach(() => {
43
+ vi.clearAllMocks();
44
+ cleanup();
45
+ });
46
+
47
+ describe("components > Header > CiInfo", () => {
48
+ it("should render well-known CI icon", () => {
49
+ const ciTypes: CiType[] = [
50
+ CiType.Amazon,
51
+ CiType.Azure,
52
+ CiType.Bitbucket,
53
+ CiType.Circle,
54
+ CiType.Drone,
55
+ CiType.Github,
56
+ CiType.Gitlab,
57
+ CiType.Jenkins,
58
+ ];
59
+
60
+ for (const type of ciTypes) {
61
+ (getReportOptions as Mock).mockReturnValueOnce({
62
+ ci: {
63
+ pullRequestUrl: fixtures.pullRequestUrl,
64
+ type,
65
+ },
66
+ });
67
+
68
+ cleanup();
69
+ render(<CiInfo />);
70
+
71
+ expect(screen.getByTestId("icon")).toHaveTextContent(type);
72
+ }
73
+ });
74
+
75
+ it("shouldn't render icon for unknown CI", () => {
76
+ (getReportOptions as Mock).mockReturnValueOnce({
77
+ ci: {
78
+ type: undefined,
79
+ },
80
+ });
81
+
82
+ render(<CiInfo />);
83
+
84
+ expect(screen.queryByTestId("icon")).not.toBeInTheDocument();
85
+ });
86
+
87
+ it("should render there is no link to use", () => {
88
+ (getReportOptions as Mock).mockReturnValueOnce({
89
+ ci: {},
90
+ });
91
+
92
+ render(<CiInfo />);
93
+
94
+ expect(screen.queryByRole("link")).not.toBeInTheDocument();
95
+ });
96
+
97
+ it("should presence pull request url as href when provided", () => {
98
+ (getReportOptions as Mock).mockReturnValueOnce({
99
+ ci: {
100
+ pullRequestUrl: fixtures.pullRequestUrl,
101
+ jobUrl: fixtures.jobUrl,
102
+ jobRunUrl: fixtures.jobRunUrl,
103
+ },
104
+ });
105
+
106
+ render(<CiInfo />);
107
+
108
+ expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.pullRequestUrl);
109
+ });
110
+
111
+ it("should presence use job run url as href when provided", () => {
112
+ (getReportOptions as Mock).mockReturnValueOnce({
113
+ ci: {
114
+ jobUrl: fixtures.jobUrl,
115
+ jobRunUrl: fixtures.jobRunUrl,
116
+ },
117
+ });
118
+
119
+ render(<CiInfo />);
120
+
121
+ expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.jobRunUrl);
122
+ });
123
+
124
+ it("should use job url as href when provided", () => {
125
+ (getReportOptions as Mock).mockReturnValueOnce({
126
+ ci: {
127
+ jobRunUrl: fixtures.jobRunUrl,
128
+ },
129
+ });
130
+
131
+ render(<CiInfo />);
132
+
133
+ expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.jobRunUrl);
134
+ });
135
+
136
+ it("should presence pull request name as text when provided", () => {
137
+ (getReportOptions as Mock).mockReturnValueOnce({
138
+ ci: {
139
+ pullRequestUrl: fixtures.pullRequestUrl,
140
+ pullRequestName: fixtures.pullRequestName,
141
+ jobName: fixtures.jobName,
142
+ jobRunName: fixtures.jobRunName,
143
+ },
144
+ });
145
+
146
+ render(<CiInfo />);
147
+
148
+ expect(screen.getByRole("link")).toHaveTextContent(fixtures.pullRequestName);
149
+ });
150
+
151
+ it("should presence job run name as text when provided", () => {
152
+ (getReportOptions as Mock).mockReturnValueOnce({
153
+ ci: {
154
+ jobUrl: fixtures.jobUrl,
155
+ jobName: fixtures.jobName,
156
+ jobRunName: fixtures.jobRunName,
157
+ },
158
+ });
159
+
160
+ render(<CiInfo />);
161
+
162
+ expect(screen.getByRole("link")).toHaveTextContent(fixtures.jobRunName);
163
+ });
164
+
165
+ it("should presence job name as text when provided", () => {
166
+ (getReportOptions as Mock).mockReturnValueOnce({
167
+ ci: {
168
+ jobRunUrl: fixtures.jobRunUrl,
169
+ jobRunName: fixtures.jobRunName,
170
+ },
171
+ });
172
+
173
+ render(<CiInfo />);
174
+
175
+ expect(screen.getByRole("link")).toHaveTextContent(fixtures.jobRunName);
176
+ });
177
+ });
@@ -0,0 +1,122 @@
1
+ import { getReportOptions } from "@allurereport/web-commons";
2
+ import { cleanup, render, screen } from "@testing-library/preact";
3
+ import { Mock, beforeEach, describe, expect, it, vi } from "vitest";
4
+ import { Header } from "@/components/Header";
5
+ import { CiInfo } from "@/components/Header/CiInfo";
6
+ import { route } from "@/stores/router";
7
+ import { availableSections } from "@/stores/sections";
8
+
9
+ const fixtures = {
10
+ ci: {
11
+ type: "github",
12
+ },
13
+ };
14
+
15
+ vi.mock("@allurereport/web-commons", () => ({
16
+ getReportOptions: vi.fn().mockReturnValue({}),
17
+ }));
18
+ vi.mock("@/stores/router", async () => {
19
+ const { signal } = await import("@preact/signals");
20
+
21
+ return {
22
+ route: signal({}),
23
+ };
24
+ });
25
+ vi.mock("@/stores/sections", async () => {
26
+ const { signal } = await import("@preact/signals");
27
+
28
+ return {
29
+ availableSections: signal([]),
30
+ };
31
+ });
32
+ vi.mock("@/components/HeaderControls", () => ({
33
+ HeaderControls: () => <div data-testid="header-controls"></div>,
34
+ }));
35
+ vi.mock("@/components/SectionPicker", () => ({
36
+ SectionPicker: () => <div data-testid="section-picker"></div>,
37
+ }));
38
+ vi.mock("@/components/TestResult/TrHeader/TrBreadcrumbs", () => ({
39
+ TrBreadcrumbs: () => <div data-testid="breadcrumbs"></div>,
40
+ }));
41
+ vi.mock("@/components/Header/CiInfo", () => ({
42
+ // CiInfo: vi.fn().mockReturnValue(<div data-testid="ci-info"></div>),
43
+ CiInfo: vi.fn().mockImplementation(() => <div data-testid="ci-info"></div>),
44
+ }));
45
+
46
+ beforeEach(() => {
47
+ vi.clearAllMocks();
48
+ cleanup();
49
+ route.value = {};
50
+ availableSections.value = [];
51
+ });
52
+
53
+ describe("components > Header", () => {
54
+ it("should render sections picker when there are sections available", () => {
55
+ availableSections.value = ["section1", "section2"];
56
+
57
+ render(<Header />);
58
+
59
+ expect(screen.getByTestId("section-picker")).toBeInTheDocument();
60
+ });
61
+
62
+ it("shouldn't render sections picker when there are no sections available", () => {
63
+ render(<Header />);
64
+
65
+ expect(screen.queryByTestId("section-picker")).not.toBeInTheDocument();
66
+ });
67
+
68
+ it("should render ci info only when testResultId route parameter doesn't exists and ci report option is available", () => {
69
+ route.value = {
70
+ params: {},
71
+ };
72
+ (getReportOptions as Mock).mockReturnValue({
73
+ ci: fixtures.ci,
74
+ });
75
+
76
+ render(<Header />);
77
+
78
+ expect(CiInfo).toHaveBeenCalled();
79
+ expect(screen.getByTestId("ci-info")).toBeInTheDocument();
80
+ });
81
+
82
+ it("shouldn't render ci info when testResultId route parameter exists", () => {
83
+ route.value = {
84
+ params: {
85
+ testResultId: "1",
86
+ },
87
+ };
88
+ (getReportOptions as Mock).mockReturnValue({
89
+ ci: fixtures.ci,
90
+ });
91
+
92
+ render(<Header />);
93
+
94
+ expect(CiInfo).not.toHaveBeenCalled();
95
+ expect(screen.queryByTestId("ci-info")).not.toBeInTheDocument();
96
+ });
97
+
98
+ it("should render breadcrumbs when testResultId route parameter exists", () => {
99
+ route.value = {
100
+ params: {
101
+ testResultId: "1",
102
+ },
103
+ };
104
+ (getReportOptions as Mock).mockReturnValue({
105
+ ci: fixtures.ci,
106
+ });
107
+
108
+ render(<Header />);
109
+
110
+ expect(screen.getByTestId("breadcrumbs")).toBeInTheDocument();
111
+ });
112
+
113
+ it("shouldn't render breadcrumbs when testResultId route parameter doesn't exists", () => {
114
+ route.value = {
115
+ params: {},
116
+ };
117
+
118
+ render(<Header />);
119
+
120
+ expect(screen.queryByTestId("breadcrumbs")).not.toBeInTheDocument();
121
+ });
122
+ });
@@ -0,0 +1,302 @@
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
2
+ import {
3
+ clearTreeFilters,
4
+ setTestTypeFilter,
5
+ setTransitionFilter,
6
+ setTreeDirection,
7
+ setTreeQuery,
8
+ setTreeSortBy,
9
+ setTreeStatus,
10
+ treeDirection,
11
+ treeFilter,
12
+ treeQuery,
13
+ treeSortBy,
14
+ treeStatus,
15
+ } from "@/stores/treeFilters";
16
+
17
+ const defaultFilter = {
18
+ flaky: false,
19
+ retry: false,
20
+ new: false,
21
+ fixed: false,
22
+ regressed: false,
23
+ malfunctioned: false,
24
+ };
25
+
26
+ describe("stores > treeFilters", () => {
27
+ beforeEach(() => {
28
+ // Reset all signals to default state before each test
29
+ treeQuery.value = "";
30
+ treeStatus.value = "total";
31
+ treeSortBy.value = "order";
32
+ treeDirection.value = "asc";
33
+ treeFilter.value = { ...defaultFilter };
34
+ });
35
+
36
+ afterEach(() => {
37
+ vi.clearAllMocks();
38
+ });
39
+
40
+ describe("clearTreeFilters", () => {
41
+ it("should reset query, status and filters to default state", () => {
42
+ // Set some non-default values
43
+ treeQuery.value = "test query";
44
+ treeStatus.value = "passed";
45
+ treeFilter.value = {
46
+ flaky: true,
47
+ retry: true,
48
+ new: true,
49
+ fixed: true,
50
+ regressed: true,
51
+ malfunctioned: true,
52
+ };
53
+
54
+ clearTreeFilters();
55
+
56
+ expect(treeQuery.value).toBe("");
57
+ expect(treeStatus.value).toBe("total");
58
+ expect(treeFilter.value).toEqual(defaultFilter);
59
+ });
60
+
61
+ it("should not reset sortBy and direction", () => {
62
+ treeSortBy.value = "duration";
63
+ treeDirection.value = "desc";
64
+
65
+ clearTreeFilters();
66
+
67
+ expect(treeSortBy.value).toBe("duration");
68
+ expect(treeDirection.value).toBe("desc");
69
+ });
70
+ });
71
+
72
+ describe("setTreeQuery", () => {
73
+ it("should update query", () => {
74
+ setTreeQuery("search term");
75
+
76
+ expect(treeQuery.value).toBe("search term");
77
+ });
78
+
79
+ it("should update query to empty string", () => {
80
+ treeQuery.value = "some query";
81
+
82
+ setTreeQuery("");
83
+
84
+ expect(treeQuery.value).toBe("");
85
+ });
86
+ });
87
+
88
+ describe("setTreeStatus", () => {
89
+ it("should update status to passed", () => {
90
+ setTreeStatus("passed");
91
+
92
+ expect(treeStatus.value).toBe("passed");
93
+ });
94
+
95
+ it("should update status to failed", () => {
96
+ setTreeStatus("failed");
97
+
98
+ expect(treeStatus.value).toBe("failed");
99
+ });
100
+
101
+ it("should update status to broken", () => {
102
+ setTreeStatus("broken");
103
+
104
+ expect(treeStatus.value).toBe("broken");
105
+ });
106
+
107
+ it("should update status to skipped", () => {
108
+ setTreeStatus("skipped");
109
+
110
+ expect(treeStatus.value).toBe("skipped");
111
+ });
112
+
113
+ it("should update status to total", () => {
114
+ treeStatus.value = "passed";
115
+
116
+ setTreeStatus("total");
117
+
118
+ expect(treeStatus.value).toBe("total");
119
+ });
120
+ });
121
+
122
+ describe("setTreeSortBy", () => {
123
+ it("should update sortBy to duration", () => {
124
+ setTreeSortBy("duration");
125
+
126
+ expect(treeSortBy.value).toBe("duration");
127
+ });
128
+
129
+ it("should update sortBy to status", () => {
130
+ setTreeSortBy("status");
131
+
132
+ expect(treeSortBy.value).toBe("status");
133
+ });
134
+
135
+ it("should update sortBy to alphabet", () => {
136
+ setTreeSortBy("alphabet");
137
+
138
+ expect(treeSortBy.value).toBe("alphabet");
139
+ });
140
+
141
+ it("should update sortBy to order", () => {
142
+ treeSortBy.value = "duration";
143
+
144
+ setTreeSortBy("order");
145
+
146
+ expect(treeSortBy.value).toBe("order");
147
+ });
148
+ });
149
+
150
+ describe("setTreeDirection", () => {
151
+ it("should update direction to desc", () => {
152
+ setTreeDirection("desc");
153
+
154
+ expect(treeDirection.value).toBe("desc");
155
+ });
156
+
157
+ it("should update direction to asc", () => {
158
+ treeDirection.value = "desc";
159
+
160
+ setTreeDirection("asc");
161
+
162
+ expect(treeDirection.value).toBe("asc");
163
+ });
164
+ });
165
+
166
+ describe("setTestTypeFilter", () => {
167
+ it("should enable flaky filter", () => {
168
+ setTestTypeFilter("flaky", true);
169
+
170
+ expect(treeFilter.value.flaky).toBe(true);
171
+ });
172
+
173
+ it("should disable flaky filter", () => {
174
+ treeFilter.value = { ...defaultFilter, flaky: true };
175
+
176
+ setTestTypeFilter("flaky", false);
177
+
178
+ expect(treeFilter.value.flaky).toBe(false);
179
+ });
180
+
181
+ it("should enable retry filter", () => {
182
+ setTestTypeFilter("retry", true);
183
+
184
+ expect(treeFilter.value.retry).toBe(true);
185
+ });
186
+
187
+ it("should disable retry filter", () => {
188
+ treeFilter.value = { ...defaultFilter, retry: true };
189
+
190
+ setTestTypeFilter("retry", false);
191
+
192
+ expect(treeFilter.value.retry).toBe(false);
193
+ });
194
+
195
+ it("should enable both flaky and retry filters independently", () => {
196
+ setTestTypeFilter("flaky", true);
197
+ setTestTypeFilter("retry", true);
198
+
199
+ expect(treeFilter.value.flaky).toBe(true);
200
+ expect(treeFilter.value.retry).toBe(true);
201
+ });
202
+
203
+ it("should not affect transition filters", () => {
204
+ treeFilter.value = { ...defaultFilter, new: true };
205
+
206
+ setTestTypeFilter("flaky", true);
207
+
208
+ expect(treeFilter.value.new).toBe(true);
209
+ expect(treeFilter.value.flaky).toBe(true);
210
+ });
211
+ });
212
+
213
+ describe("setTransitionFilter", () => {
214
+ it("should enable new filter", () => {
215
+ setTransitionFilter("new", true);
216
+
217
+ expect(treeFilter.value.new).toBe(true);
218
+ });
219
+
220
+ it("should enable fixed filter", () => {
221
+ setTransitionFilter("fixed", true);
222
+
223
+ expect(treeFilter.value.fixed).toBe(true);
224
+ });
225
+
226
+ it("should enable regressed filter", () => {
227
+ setTransitionFilter("regressed", true);
228
+
229
+ expect(treeFilter.value.regressed).toBe(true);
230
+ });
231
+
232
+ it("should enable malfunctioned filter", () => {
233
+ setTransitionFilter("malfunctioned", true);
234
+
235
+ expect(treeFilter.value.malfunctioned).toBe(true);
236
+ });
237
+
238
+ it("should disable the previous transition when enabling a new one", () => {
239
+ setTransitionFilter("new", true);
240
+ expect(treeFilter.value.new).toBe(true);
241
+
242
+ setTransitionFilter("fixed", true);
243
+
244
+ expect(treeFilter.value.new).toBe(false);
245
+ expect(treeFilter.value.fixed).toBe(true);
246
+ expect(treeFilter.value.regressed).toBe(false);
247
+ expect(treeFilter.value.malfunctioned).toBe(false);
248
+ });
249
+
250
+ it("should disable all other transitions when enabling regressed", () => {
251
+ treeFilter.value = { ...defaultFilter, new: true, fixed: true };
252
+
253
+ setTransitionFilter("regressed", true);
254
+
255
+ expect(treeFilter.value.new).toBe(false);
256
+ expect(treeFilter.value.fixed).toBe(false);
257
+ expect(treeFilter.value.regressed).toBe(true);
258
+ expect(treeFilter.value.malfunctioned).toBe(false);
259
+ });
260
+
261
+ it("should allow only one transition to be enabled at a time", () => {
262
+ setTransitionFilter("new", true);
263
+ setTransitionFilter("fixed", true);
264
+ setTransitionFilter("regressed", true);
265
+ setTransitionFilter("malfunctioned", true);
266
+
267
+ expect(treeFilter.value.new).toBe(false);
268
+ expect(treeFilter.value.fixed).toBe(false);
269
+ expect(treeFilter.value.regressed).toBe(false);
270
+ expect(treeFilter.value.malfunctioned).toBe(true);
271
+ });
272
+
273
+ it("should disable the transition when value is false", () => {
274
+ treeFilter.value = { ...defaultFilter, new: true };
275
+
276
+ setTransitionFilter("new", false);
277
+
278
+ expect(treeFilter.value.new).toBe(false);
279
+ });
280
+
281
+ it("should disable all transitions when disabling the active one", () => {
282
+ setTransitionFilter("fixed", true);
283
+
284
+ setTransitionFilter("fixed", false);
285
+
286
+ expect(treeFilter.value.new).toBe(false);
287
+ expect(treeFilter.value.fixed).toBe(false);
288
+ expect(treeFilter.value.regressed).toBe(false);
289
+ expect(treeFilter.value.malfunctioned).toBe(false);
290
+ });
291
+
292
+ it("should not affect test type filters (flaky, retry)", () => {
293
+ treeFilter.value = { ...defaultFilter, flaky: true, retry: true };
294
+
295
+ setTransitionFilter("new", true);
296
+
297
+ expect(treeFilter.value.flaky).toBe(true);
298
+ expect(treeFilter.value.retry).toBe(true);
299
+ expect(treeFilter.value.new).toBe(true);
300
+ });
301
+ });
302
+ });