@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,225 @@
1
+ .test-result-steps {
2
+ padding-right: 24px;
3
+
4
+ &:not(:first-child) {
5
+ border-top: 1px solid var(--on-border-muted);
6
+ }
7
+ }
8
+
9
+ .test-result-steps-root {
10
+ padding-left: 30px;
11
+ }
12
+
13
+ .test-result-step {
14
+ &:not(:first-child) {
15
+ border-top: 1px solid var(--on-border-muted);
16
+ }
17
+ }
18
+
19
+ .test-result-step-content {
20
+ padding-left: 24px;
21
+ margin-bottom: 12px;
22
+ border-top: 1px solid var(--on-border-muted);
23
+ }
24
+
25
+ .test-result-attachment-content {
26
+ max-height: 450px;
27
+ overflow-y: auto;
28
+ border-top: 1px solid var(--on-border-muted);
29
+ }
30
+
31
+ .test-result-attachment-content-wrapper {
32
+ padding-left: 16px;
33
+ margin-left: 11px;
34
+ max-height: 450px;
35
+ overflow-y: auto;
36
+ }
37
+
38
+ .test-result-step-root {
39
+ padding-left: 12px;
40
+ }
41
+
42
+ .test-result-step-header {
43
+ display: flex;
44
+ align-items: center;
45
+ gap: 4px;
46
+ transition: background-color 300ms;
47
+ cursor: pointer;
48
+ padding: 4px 8px 4px 6px;
49
+ min-height: 32px;
50
+
51
+ &:hover {
52
+ background: var(--bg-control-flat-medium);
53
+ }
54
+ }
55
+
56
+ .test-result-header-text {
57
+ padding-left: 4px;
58
+ word-break: break-word;
59
+ }
60
+
61
+ .test-result-step-button {
62
+ padding: 2px;
63
+ box-sizing: border-box;
64
+ margin-right: 2px;
65
+ margin-left: 2px;
66
+ }
67
+
68
+ .test-result-step-number {
69
+ color: var(--on-text-hint);
70
+ min-width: 16px;
71
+ text-align: center;
72
+ box-sizing: content-box;
73
+ }
74
+
75
+ .item-time {
76
+ flex: none;
77
+ margin-left: auto;
78
+ color: var(--on-text-hint);
79
+ line-height: 20px;
80
+ min-width: 56px;
81
+ text-align: right;
82
+ }
83
+
84
+ .item-info {
85
+ margin-left: auto;
86
+ display: flex;
87
+ gap: 8px;
88
+ color: var(--on-text-secondary);
89
+ align-items: center;
90
+ flex: 0 0 auto;
91
+ }
92
+
93
+ .item-buttons {
94
+ display: flex;
95
+ align-items: center;
96
+ gap: 4px;
97
+ color: var(--on-icon-secondary);
98
+ min-width: 52px;
99
+ justify-content: flex-end;
100
+ }
101
+
102
+ .item-info-step {
103
+ display: flex;
104
+ gap: 4px;
105
+ align-items: center;
106
+ }
107
+
108
+ .item-info-step-icon {
109
+ color: var(--on-icon-secondary);
110
+ }
111
+
112
+ .test-result-step-chevron {
113
+ width: 12px;
114
+ height: 12px;
115
+ transform: rotate(-90deg);
116
+ transition: transform 200ms;
117
+ }
118
+
119
+ .test-result-step-chevron-open {
120
+ transform: rotate(0deg);
121
+ }
122
+
123
+ .test-result-attachment-header {
124
+ display: flex;
125
+ align-items: center;
126
+ gap: 4px;
127
+ transition: background-color 300ms;
128
+ cursor: pointer;
129
+ padding: 4px 8px 4px 6px;
130
+
131
+ &:hover {
132
+ background: var(--bg-control-flat-medium);
133
+ }
134
+ }
135
+
136
+ .test-result-attachment-arrow {
137
+ transform: rotate(-90deg);
138
+ transition: transform 200ms;
139
+ }
140
+
141
+ .test-result-attachment-arrow-opened {
142
+ transform: rotate(0);
143
+ }
144
+
145
+ .test-result-attachment-icon {
146
+ color: var(--on-icon-secondary);
147
+ padding: 2px 4px;
148
+ height: max-content;
149
+ }
150
+
151
+ .test-result-attachment-text {
152
+ padding-left: 4px;
153
+ word-break: break-word;
154
+ }
155
+
156
+ .test-result-attachment-image {
157
+ overflow: hidden;
158
+ cursor: pointer;
159
+ padding: 4px 0;
160
+ position: relative;
161
+ width: 100%;
162
+ height: 100%;
163
+
164
+ img {
165
+ width: 100%;
166
+ height: 100%;
167
+ object-fit: scale-down;
168
+ }
169
+ }
170
+
171
+ .test-result-parameters {
172
+ padding-left: 62px;
173
+ }
174
+
175
+ .attachment-background {
176
+ filter: blur(40px) brightness(0.4);
177
+ background-position: 50%;
178
+ background-size: cover;
179
+ position: absolute;
180
+ inset: -100px;
181
+ z-index: -1;
182
+ }
183
+
184
+ .test-result-attachment-error {
185
+ display: flex;
186
+ align-items: center;
187
+ justify-content: center;
188
+ }
189
+
190
+ .test-result-visibility-hidden {
191
+ visibility: hidden;
192
+ }
193
+
194
+ .item-button {
195
+ color: var(--bg-control-flat);
196
+ }
197
+
198
+ .wrong-attachment-sign {
199
+ display: flex;
200
+ justify-content: center;
201
+ align-items: center;
202
+ }
203
+
204
+ .test-result-attachment-missed {
205
+ color: var(--on-text-secondary);
206
+ line-height: 20px;
207
+ margin-right: auto;
208
+ padding-top: 2px;
209
+ }
210
+
211
+ .test-result-spinner {
212
+ display: flex;
213
+ align-items: center;
214
+ justify-content: center;
215
+ width: 100%;
216
+ min-height: 32px;
217
+ }
218
+
219
+ .test-result-strut {
220
+ width: 24px;
221
+ }
222
+
223
+ .html-attachment-preview {
224
+ padding: 0 16px;
225
+ }
@@ -0,0 +1,77 @@
1
+ import type { AttachmentTestStepResult } from "@allurereport/core-api";
2
+ import { Code, SvgIcon, Text, allureIcons } from "@allurereport/web-components";
3
+ import type { FunctionComponent } from "preact";
4
+ import { useState } from "preact/hooks";
5
+ import { ArrowButton } from "@/components/ArrowButton";
6
+ import { Attachment } from "@/components/TestResult/TestResultSteps/attachment";
7
+ import * as styles from "@/components/TestResult/TestResultSteps/styles.scss";
8
+ import { TestResultAttachmentInfo } from "@/components/TestResult/TestResultSteps/testResultAttachmentInfo";
9
+ import { attachmentType } from "@/utils/attachments";
10
+
11
+ const { lineImagesImage, lineFilesFileAttachment2 } = allureIcons;
12
+
13
+ const iconMap: Record<string, string> = {
14
+ "text/plain": lineFilesFileAttachment2,
15
+ "application/xml": lineFilesFileAttachment2,
16
+ "text/html": lineFilesFileAttachment2,
17
+ "text/csv": lineFilesFileAttachment2,
18
+ "text/tab-separated-values": lineFilesFileAttachment2,
19
+ "text/css": lineFilesFileAttachment2,
20
+ "text/uri-list": lineFilesFileAttachment2,
21
+ "image/svg+xml": lineImagesImage,
22
+ "image/png": lineImagesImage,
23
+ "application/json": lineFilesFileAttachment2,
24
+ "application/zip": lineFilesFileAttachment2,
25
+ "video/webm": lineImagesImage,
26
+ "image/jpeg": lineImagesImage,
27
+ "video/mp4": lineImagesImage,
28
+ "application/vnd.allure.image.diff": lineImagesImage,
29
+ };
30
+
31
+ export const TestResultAttachment: FunctionComponent<{
32
+ item: AttachmentTestStepResult;
33
+ stepIndex?: number;
34
+ className?: string;
35
+ }> = ({ item, stepIndex }) => {
36
+ const [isOpened, setIsOpen] = useState(false);
37
+ const { link } = item;
38
+ const { missed } = link;
39
+ const componentType = attachmentType(link.contentType);
40
+ const isValidComponentType = !["archive", null].includes(componentType.type as string);
41
+
42
+ return (
43
+ <div className={styles["test-result-step"]}>
44
+ <div
45
+ className={styles["test-result-attachment-header"]}
46
+ onClick={(e) => {
47
+ e.stopPropagation();
48
+ setIsOpen((prev) => !prev);
49
+ }}
50
+ >
51
+ <ArrowButton isOpened={isOpened} />
52
+ <div className={styles["test-result-attachment-icon"]}>
53
+ <SvgIcon size="s" id={iconMap[link.contentType] ?? lineFilesFileAttachment2} />
54
+ </div>
55
+
56
+ <Code size="s" className={styles["test-result-step-number"]}>
57
+ {stepIndex}
58
+ </Code>
59
+
60
+ <Text className={styles["test-result-attachment-text"]}>{link.name || link.originalFileName}</Text>
61
+ {missed && (
62
+ <Text size={"s"} className={styles["test-result-attachment-missed"]}>
63
+ missed
64
+ </Text>
65
+ )}
66
+ <TestResultAttachmentInfo item={item} shouldExpand={isValidComponentType} />
67
+ </div>
68
+ {isOpened && isValidComponentType && (
69
+ <div className={styles["test-result-attachment-content-wrapper"]}>
70
+ <div className={styles["test-result-attachment-content"]}>
71
+ <Attachment item={item} />
72
+ </div>
73
+ </div>
74
+ )}
75
+ </div>
76
+ );
77
+ };
@@ -0,0 +1,83 @@
1
+ import type { AttachmentTestStepResult } from "@allurereport/core-api";
2
+ import { IconButton, Text, TooltipWrapper, allureIcons } from "@allurereport/web-components";
3
+ import { filesize } from "filesize";
4
+ import type { FunctionalComponent } from "preact";
5
+ import { useEffect } from "preact/hooks";
6
+ import { isModalOpen, openModal } from "@/components/Modal";
7
+ import { Attachment } from "@/components/TestResult/TestResultSteps/attachment";
8
+ import * as styles from "@/components/TestResult/TestResultSteps/styles.scss";
9
+ import { useI18n } from "@/stores";
10
+ import { downloadAttachment } from "@/utils/attachments";
11
+
12
+ interface TestResultAttachmentInfoProps {
13
+ item?: AttachmentTestStepResult;
14
+ shouldExpand?: boolean;
15
+ }
16
+
17
+ export const TestResultAttachmentInfo: FunctionalComponent<TestResultAttachmentInfoProps> = ({
18
+ item,
19
+ shouldExpand,
20
+ }) => {
21
+ const { id, ext, contentType } = item.link;
22
+ const { t: tooltip } = useI18n("controls");
23
+ const contentLength = item.link.missed === false ? item.link.contentLength : undefined;
24
+ const contentSize = contentLength
25
+ ? filesize(contentLength, {
26
+ base: 2,
27
+ round: 1,
28
+ })
29
+ : "-";
30
+
31
+ const expandAttachment = (event: Event) => {
32
+ event.stopPropagation();
33
+ openModal({
34
+ data: item,
35
+ component: <Attachment item={item} previewable={true} />,
36
+ });
37
+ };
38
+
39
+ useEffect(() => {
40
+ if (isModalOpen.value) {
41
+ openModal({
42
+ data: item,
43
+ component: <Attachment item={item} />,
44
+ });
45
+ }
46
+ }, [item]);
47
+
48
+ const downloadData = async (e: MouseEvent) => {
49
+ e.stopPropagation();
50
+ await downloadAttachment(id, ext, contentType);
51
+ };
52
+
53
+ return (
54
+ <div className={styles["item-info"]}>
55
+ {Boolean(contentType) && <Text size={"s"}>{contentType}</Text>}
56
+ {Boolean(contentSize) && <Text size={"s"}>{contentSize}</Text>}
57
+ <div className={styles["item-buttons"]}>
58
+ {shouldExpand && (
59
+ <TooltipWrapper tooltipText={tooltip("expand")}>
60
+ <IconButton
61
+ className={styles["item-button"]}
62
+ style={"ghost"}
63
+ size={"s"}
64
+ iconSize={"s"}
65
+ icon={allureIcons.lineArrowsExpand3}
66
+ onClick={expandAttachment}
67
+ />
68
+ </TooltipWrapper>
69
+ )}
70
+ <TooltipWrapper tooltipText={tooltip("downloadAttachment")}>
71
+ <IconButton
72
+ style={"ghost"}
73
+ size={"s"}
74
+ iconSize={"s"}
75
+ className={styles["item-button"]}
76
+ icon={allureIcons.lineGeneralDownloadCloud}
77
+ onClick={(e: MouseEvent) => downloadData(e)}
78
+ />
79
+ </TooltipWrapper>
80
+ </div>
81
+ </div>
82
+ );
83
+ };
@@ -0,0 +1,78 @@
1
+ import type { DefaultTestStepResult } from "@allurereport/core-api";
2
+ import { Code, Text, allureIcons } from "@allurereport/web-components";
3
+ import type { FunctionComponent } from "preact";
4
+ import { useState } from "preact/hooks";
5
+ import { ArrowButton } from "@/components/ArrowButton";
6
+ import { MetadataList } from "@/components/Metadata";
7
+ import { type MetadataItem } from "@/components/ReportMetadata";
8
+ import * as styles from "@/components/TestResult/TestResultSteps/styles.scss";
9
+ import { TestResultAttachment } from "@/components/TestResult/TestResultSteps/testResultAttachment";
10
+ import { TestResultStepInfo } from "@/components/TestResult/TestResultSteps/testResultStepInfo";
11
+ import TreeItemIcon from "@/components/Tree/TreeItemIcon";
12
+
13
+ export const TestResultStepParameters = (props: { parameters: DefaultTestStepResult["parameters"] }) => {
14
+ const { parameters } = props;
15
+
16
+ return (
17
+ <div className={styles["test-result-parameters"]}>
18
+ <MetadataList size={"s"} envInfo={parameters as unknown as MetadataItem[]} columns={1} />
19
+ </div>
20
+ );
21
+ };
22
+ export const TestResultStepsContent = (props: { item: DefaultTestStepResult }) => {
23
+ const { item } = props;
24
+
25
+ return (
26
+ <div className={styles["test-result-step-content"]}>
27
+ {Boolean(item?.parameters?.length) && <TestResultStepParameters parameters={item.parameters} />}
28
+ {Boolean(item?.steps?.length) && (
29
+ <>
30
+ {item.steps?.map((subItem, key) => {
31
+ if (subItem.type === "step") {
32
+ return <TestResultStep stepIndex={key + 1} key={key} item={subItem} />;
33
+ }
34
+
35
+ if (subItem.type === "attachment") {
36
+ return <TestResultAttachment stepIndex={key + 1} key={key} item={subItem} />;
37
+ }
38
+
39
+ return null;
40
+ })}
41
+ </>
42
+ )}
43
+ </div>
44
+ );
45
+ };
46
+
47
+ export const TestResultStep: FunctionComponent<{
48
+ item: DefaultTestStepResult;
49
+ stepIndex?: number;
50
+ className?: string;
51
+ }> = ({ item, stepIndex }) => {
52
+ const [isOpened, setIsOpen] = useState(false);
53
+ const hasContent = Boolean(item?.steps?.length || item?.parameters?.length);
54
+
55
+ return (
56
+ <div className={styles["test-result-step"]}>
57
+ <div className={styles["test-result-step-header"]} onClick={() => setIsOpen(!isOpened)}>
58
+ {!hasContent ? (
59
+ <div className={styles["test-result-strut"]} />
60
+ ) : (
61
+ <ArrowButton
62
+ isOpened={isOpened}
63
+ icon={allureIcons.arrowsChevronDown}
64
+ iconSize={"xs"}
65
+ className={!hasContent ? styles["test-result-visibility-hidden"] : ""}
66
+ />
67
+ )}
68
+ <TreeItemIcon status={item.status} />
69
+ <Code size={"s"} className={styles["test-result-step-number"]}>
70
+ {stepIndex}
71
+ </Code>
72
+ <Text className={styles["test-result-header-text"]}>{item.name}</Text>
73
+ <TestResultStepInfo item={item} />
74
+ </div>
75
+ {hasContent && isOpened && <TestResultStepsContent item={item} />}
76
+ </div>
77
+ );
78
+ };
@@ -0,0 +1,30 @@
1
+ import { type DefaultTestStepResult, formatDuration } from "@allurereport/core-api";
2
+ import { SvgIcon, Text, allureIcons } from "@allurereport/web-components";
3
+ import * as styles from "@/components/TestResult/TestResultSteps/styles.scss";
4
+
5
+ export const TestResultStepInfo = (props: { item: DefaultTestStepResult }) => {
6
+ const { item } = props;
7
+ const formattedDuration = formatDuration(item?.duration as number);
8
+ const stepLength = item.steps?.length;
9
+ const attachmentLength = item.steps?.filter((step) => step.type === "attachment")?.length;
10
+
11
+ return (
12
+ <div className={styles["item-info"]}>
13
+ {Boolean(stepLength) && (
14
+ <div className={styles["item-info-step"]}>
15
+ <SvgIcon id={allureIcons.lineArrowsCornerDownRight} className={styles["item-info-step-icon"]} />
16
+ <Text size={"s"}>{stepLength}</Text>
17
+ </div>
18
+ )}
19
+ {Boolean(attachmentLength) && (
20
+ <div className={styles["item-info-step"]}>
21
+ <SvgIcon id={allureIcons.lineFilesFileAttachment2} className={styles["item-info-step-icon"]} />
22
+ <Text size={"s"}>{attachmentLength}</Text>
23
+ </div>
24
+ )}
25
+ <Text type="ui" size={"s"} className={styles["item-time"]}>
26
+ {formattedDuration}
27
+ </Text>
28
+ </div>
29
+ );
30
+ };
@@ -0,0 +1,8 @@
1
+ import * as styles from "@/components/TestResult/TestResultSteps/styles.scss";
2
+ import { useI18n } from "@/stores";
3
+
4
+ export const EmptyComponent = () => {
5
+ const { t } = useI18n("errors");
6
+
7
+ return <div className={styles["wrong-attachment-sign"]}>{t("missedAttachment")}</div>;
8
+ };
@@ -0,0 +1,59 @@
1
+ import { Text } from "@allurereport/web-components";
2
+ import { type ComponentChildren, createContext } from "preact";
3
+ import { useContext, useState } from "preact/hooks";
4
+ import * as styles from "./styles.scss";
5
+
6
+ type TestResultTabsContextT = {
7
+ currentTab: string | undefined;
8
+ setCurrentTab: (id: string) => void;
9
+ };
10
+
11
+ const TestResultTabsContext = createContext<TestResultTabsContextT | null>(null);
12
+
13
+ export const useTestResultTabsContext = () => {
14
+ const context = useContext(TestResultTabsContext);
15
+
16
+ if (!context) {
17
+ throw new Error("TestResultTabs components must be used within a TestResultTabs component");
18
+ }
19
+
20
+ return context;
21
+ };
22
+
23
+ export const TestResultTabsProvider = (props: { initialTab?: string; children: ComponentChildren }) => {
24
+ const { children, initialTab } = props;
25
+ const [currentTab, setCurrentTab] = useState<string | undefined>(initialTab);
26
+
27
+ return (
28
+ <TestResultTabsContext.Provider value={{ currentTab, setCurrentTab }}>{children}</TestResultTabsContext.Provider>
29
+ );
30
+ };
31
+
32
+ export const TestResultTabs = (props: { children: ComponentChildren; initialTab?: string }) => {
33
+ return <TestResultTabsProvider {...props} />;
34
+ };
35
+
36
+ export const TestResultTabsList = (props: { children: ComponentChildren }) => {
37
+ return <div className={styles.tabsList}>{props.children}</div>;
38
+ };
39
+
40
+ export const TestResultTab = (props: { id: string; children: ComponentChildren; disabled?: boolean }) => {
41
+ const { id, children } = props;
42
+ const { currentTab, setCurrentTab } = useTestResultTabsContext();
43
+ const isCurrentTab = currentTab === id;
44
+
45
+ const handleTabClick = () => {
46
+ if (isCurrentTab) {
47
+ return;
48
+ }
49
+ setCurrentTab(id);
50
+ };
51
+
52
+ return (
53
+ <button className={styles.tab} onClick={handleTabClick} aria-current={isCurrentTab ? true : undefined}>
54
+ <Text type="paragraph" size="m">
55
+ {children}
56
+ </Text>
57
+ </button>
58
+ );
59
+ };
@@ -0,0 +1,76 @@
1
+ .test-result-tabs {
2
+ display: flex;
3
+ }
4
+
5
+ .tabsList {
6
+ display: flex;
7
+ overflow-x: auto;
8
+ flex-grow: 0;
9
+ max-width: max-content;
10
+ gap: 8px;
11
+ }
12
+
13
+ .tab {
14
+ color: var(--on-text-primary);
15
+ cursor: pointer;
16
+ user-select: none;
17
+ flex-shrink: 0;
18
+ transform: scale(1);
19
+ outline: none;
20
+ background-color: var(--bg-base-primary);
21
+ padding: 8px;
22
+ border: none;
23
+ border-radius: 4px;
24
+ transition:
25
+ transform var(--interaction-transition-duration) ease-out,
26
+ outline var(--interaction-transition-duration) ease-out,
27
+ background-color var(--color-change-transition-duration),
28
+ border-color var(--color-change-transition-duration);
29
+ margin: 0 0 8px;
30
+
31
+ &:after {
32
+ content: "";
33
+ position: absolute;
34
+ bottom: -8px;
35
+ width: 100%;
36
+ left: 0;
37
+ border-bottom: 2px solid transparent;
38
+ }
39
+
40
+ &[disabled] {
41
+ opacity: 0.5;
42
+ }
43
+ &[aria-current] {
44
+ background-color: var(--bg-base-primary);
45
+ cursor: default;
46
+
47
+ &:after {
48
+ border-bottom: 2px solid var(--on-support-aldebaran);
49
+ }
50
+
51
+ span {
52
+ font-weight: bold;
53
+ }
54
+ }
55
+
56
+ &:hover:not([aria-current]) {
57
+ background-color: var(--bg-control-flat-medium);
58
+ }
59
+
60
+ &:active:not([aria-current]) {
61
+ background-color: var(--bg-control-flat-heavy);
62
+ transform: scale(0.94);
63
+ }
64
+
65
+ &:focus {
66
+ outline: 1px solid transparent;
67
+ }
68
+
69
+ &:focus-visible {
70
+ outline: 0 solid var(--ad-other-focus);
71
+
72
+ &:not([aria-current]) {
73
+ background-color: var(--bg-control-flat-medium);
74
+ }
75
+ }
76
+ }
@@ -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 TestResultTeardownProps = {
19
+ teardown: AwesomeTestResult["teardown"];
20
+ };
21
+
22
+ export const TestResultTeardown: FunctionalComponent<TestResultTeardownProps> = ({ teardown }) => {
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.lineHelpersFlag}
30
+ isOpened={isOpened}
31
+ setIsOpen={setIsOpen}
32
+ counter={teardown?.length}
33
+ title={t("teardown")}
34
+ />
35
+ {isOpened && (
36
+ <div className={styles["test-result-steps-root"]}>
37
+ {teardown?.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
+ };