@allurereport/web-awesome 3.0.0-beta.9 → 3.0.0
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.
- package/dist/multi/173.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/174.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/252.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/282.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/29.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/416.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/527.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/600.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/605.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/638.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/672.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/686.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/725.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/741.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/755.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/894.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/91.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/943.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/980.app-9931797d1602fc52db5b.js +1 -0
- package/dist/multi/app-9931797d1602fc52db5b.js +2 -0
- package/dist/multi/app-9931797d1602fc52db5b.js.LICENSE.txt +10 -0
- package/dist/multi/manifest.json +25 -24
- package/dist/multi/styles-8fe37354d1c2270c691e.css +48 -0
- package/dist/single/app-6199dc1c2fd3bddc2526.js +2 -0
- package/dist/single/app-6199dc1c2fd3bddc2526.js.LICENSE.txt +10 -0
- package/dist/single/manifest.json +1 -1
- package/package.json +29 -17
- package/src/assets/scss/day.scss +2 -0
- package/src/assets/scss/index.scss +1 -3
- package/src/assets/scss/night.scss +2 -0
- package/src/assets/scss/palette.scss +391 -391
- package/src/assets/scss/theme.scss +292 -79
- package/src/components/BaseLayout/index.tsx +10 -32
- package/src/components/BaseLayout/styles.scss +14 -4
- package/src/components/Charts/index.tsx +245 -0
- package/src/components/Charts/styles.scss +27 -0
- package/src/components/EnvironmentPicker/index.tsx +60 -0
- package/src/components/EnvironmentPicker/styles.scss +9 -0
- package/src/components/Footer/FooterLogo.tsx +1 -2
- package/src/components/Footer/FooterVersion.tsx +7 -3
- package/src/components/Footer/index.tsx +6 -2
- package/src/components/Header/CiInfo/index.tsx +67 -0
- package/src/components/Header/CiInfo/styles.scss +7 -0
- package/src/components/Header/index.tsx +21 -8
- package/src/components/Header/styles.scss +9 -1
- package/src/components/HeaderControls/index.tsx +20 -0
- package/src/components/MainReport/index.tsx +84 -6
- package/src/components/MainReport/styles.scss +20 -0
- package/src/components/Metadata/index.tsx +6 -4
- package/src/components/MetadataButton/index.tsx +14 -6
- package/src/components/MetadataButton/styles.scss +3 -0
- package/src/components/Modal/index.tsx +15 -167
- package/src/components/NavTabs/index.tsx +70 -0
- package/src/components/{TestResult/TestResultTabs → NavTabs}/styles.scss +0 -3
- package/src/components/Report/index.tsx +7 -0
- package/src/components/ReportBody/Filters.tsx +45 -64
- package/src/components/ReportBody/index.tsx +26 -15
- package/src/components/ReportBody/styles.scss +9 -3
- package/src/components/ReportGlobalAttachments/index.tsx +34 -0
- package/src/components/ReportGlobalAttachments/styles.scss +11 -0
- package/src/components/ReportGlobalErrors/index.tsx +30 -0
- package/src/components/ReportGlobalErrors/styles.scss +12 -0
- package/src/components/ReportHeader/ReportHeaderLogo.tsx +6 -2
- package/src/components/ReportHeader/ReportHeaderPie.tsx +1 -2
- package/src/components/ReportHeader/index.tsx +38 -12
- package/src/components/ReportHeader/styles.scss +9 -1
- package/src/components/ReportMetadata/MetadataSummary.tsx +57 -65
- package/src/components/ReportMetadata/MetadataWithIcon.tsx +11 -13
- package/src/components/ReportMetadata/index.tsx +50 -3
- package/src/components/ReportMetadata/styles.scss +0 -2
- package/src/components/ReportQualityGateResults/index.tsx +42 -0
- package/src/components/ReportQualityGateResults/styles.scss +44 -0
- package/src/components/SectionPicker/index.tsx +55 -0
- package/src/components/SectionPicker/styles.scss +5 -0
- package/src/components/SectionSwitcher/index.tsx +16 -0
- package/src/components/SectionSwitcher/styles.scss +4 -0
- package/src/components/SectionTabs/index.tsx +0 -0
- package/src/components/SideBySide/index.tsx +52 -0
- package/src/components/SideBySide/styles.scss +64 -0
- package/src/components/SplitLayout/index.tsx +73 -0
- package/src/components/SplitLayout/styles.scss +84 -0
- package/src/components/Tabs/index.tsx +2 -2
- package/src/components/TestResult/TestStepsEmpty/index.tsx +2 -2
- package/src/components/TestResult/TrAttachmentsView/index.tsx +29 -0
- package/src/components/TestResult/{TestResultDescription → TrDescription}/index.tsx +5 -5
- package/src/components/TestResult/{TestResultDropdown → TrDropdown}/index.tsx +7 -5
- package/src/components/TestResult/{TestResultEmpty → TrEmpty}/index.tsx +6 -6
- package/src/components/TestResult/TrEnvironmentItem/index.tsx +82 -0
- package/src/components/TestResult/TrEnvironmentItem/styles.scss +60 -0
- package/src/components/TestResult/TrEnvironmentsView/index.tsx +64 -0
- package/src/components/TestResult/TrEnvironmentsView/styles.scss +11 -0
- package/src/components/TestResult/TrError/TrDiff.tsx +121 -0
- package/src/components/TestResult/TrError/index.tsx +104 -0
- package/src/components/TestResult/TrError/styles.scss +223 -0
- package/src/components/TestResult/TrHeader/TrBreadcrumbs.tsx +44 -0
- package/src/components/TestResult/TrHeader/index.tsx +15 -0
- package/src/components/TestResult/{TestResultHeader → TrHeader}/styles.scss +7 -2
- package/src/components/TestResult/TrHistory/TrHistoryItem.tsx +94 -0
- package/src/components/TestResult/TrHistory/index.tsx +26 -0
- package/src/components/TestResult/{TestResultHistory → TrHistory}/styles.scss +2 -1
- package/src/components/TestResult/{TestResultInfo/TestResultInfoStatuses.tsx → TrInfo/TrInfoStatuses.tsx} +6 -4
- package/src/components/TestResult/TrInfo/index.tsx +99 -0
- package/src/components/TestResult/{TestResultInfo → TrInfo}/styles.scss +18 -0
- package/src/components/TestResult/{TestResultLinks → TrLinks}/index.tsx +8 -8
- package/src/components/TestResult/{TestResultMetadata → TrMetadata}/index.tsx +6 -6
- package/src/components/TestResult/{TestResultNavigation → TrNavigation}/index.tsx +7 -9
- package/src/components/TestResult/TrOverview.tsx +46 -0
- package/src/components/TestResult/{TestResultParameters → TrParameters}/index.tsx +4 -4
- package/src/components/TestResult/TrPrevStatuses/index.tsx +63 -0
- package/src/components/TestResult/TrPwTraces/PwTrace.tsx +34 -0
- package/src/components/TestResult/TrPwTraces/PwTraceButton.tsx +32 -0
- package/src/components/TestResult/TrPwTraces/index.tsx +32 -0
- package/src/components/TestResult/TrPwTraces/styles.scss +20 -0
- package/src/components/TestResult/TrRetriesView/TrRetriesItem.tsx +70 -0
- package/src/components/TestResult/TrRetriesView/index.tsx +29 -0
- package/src/components/TestResult/{TestResultSetup → TrSetup}/index.tsx +13 -13
- package/src/components/TestResult/{TestResultSeverity → TrSeverity}/index.tsx +2 -2
- package/src/components/TestResult/{TestResultStatus → TrStatus}/index.tsx +5 -5
- package/src/components/TestResult/TrSteps/TrAttachment.tsx +118 -0
- package/src/components/TestResult/{TestResultSteps/testResultAttachmentInfo.tsx → TrSteps/TrAttachmentInfo.tsx} +11 -11
- package/src/components/TestResult/TrSteps/TrStep.tsx +98 -0
- package/src/components/TestResult/TrSteps/TrStepInfo.tsx +90 -0
- package/src/components/TestResult/{TestResultSteps → TrSteps}/index.tsx +12 -12
- package/src/components/TestResult/{TestResultSteps → TrSteps}/styles.scss +49 -10
- package/src/components/TestResult/{TestResultSteps → TrSteps}/wrongAttachment.tsx +1 -1
- package/src/components/TestResult/TrTabs/index.tsx +42 -0
- package/src/components/TestResult/{TestResultTeardown → TrTeardown}/index.tsx +13 -13
- package/src/components/TestResult/index.tsx +54 -38
- package/src/components/TestResult/styles.scss +12 -0
- package/src/components/Timeline/index.tsx +100 -0
- package/src/components/Timeline/styles.scss +45 -0
- package/src/components/ToggleLayout/index.tsx +17 -0
- package/src/components/Tree/index.tsx +123 -9
- package/src/components/Tree/styles.scss +23 -5
- package/src/index.html +22 -6
- package/src/index.tsx +91 -20
- package/src/locales/az.json +376 -0
- package/src/locales/de.json +376 -0
- package/src/locales/en.json +376 -0
- package/src/locales/es.json +376 -0
- package/src/locales/fr.json +376 -0
- package/src/locales/he.json +376 -0
- package/src/locales/hy.json +376 -0
- package/src/locales/it.json +376 -0
- package/src/locales/ja.json +376 -0
- package/src/locales/ka.json +376 -0
- package/src/locales/kr.json +376 -0
- package/src/locales/nl.json +376 -0
- package/src/locales/pl.json +384 -0
- package/src/locales/pt.json +376 -0
- package/src/locales/ru.json +384 -0
- package/src/locales/sv.json +376 -0
- package/src/locales/tr.json +376 -0
- package/src/locales/ua.json +327 -0
- package/src/locales/zh.json +376 -0
- package/src/stores/chart.ts +41 -6
- package/src/stores/env.ts +88 -0
- package/src/stores/envInfo.ts +2 -2
- package/src/stores/globals.ts +28 -0
- package/src/stores/layout.ts +36 -0
- package/src/stores/locale.ts +77 -29
- package/src/stores/modal.ts +22 -0
- package/src/stores/qualityGate.ts +28 -0
- package/src/stores/router.ts +108 -0
- package/src/stores/sections.ts +63 -0
- package/src/stores/stats.ts +52 -7
- package/src/stores/testResults.ts +13 -9
- package/src/stores/theme.ts +15 -18
- package/src/stores/timeline.ts +39 -0
- package/src/stores/tree.ts +61 -22
- package/src/stores/variables.ts +40 -0
- package/src/styles.scss +66 -0
- package/src/utils/time.ts +1 -0
- package/src/utils/tree.ts +23 -0
- package/src/utils/treeFilters.ts +27 -21
- package/test/components/Header/CiInfo.test.tsx +177 -0
- package/test/components/Header.test.tsx +122 -0
- package/test/utils/treeFilters.test.ts +44 -44
- package/tsconfig.json +7 -2
- package/tsconfig.node.json +8 -0
- package/types.d.ts +43 -24
- package/vitest.config.ts +15 -2
- package/vitest.setup.ts +1 -0
- package/webpack.config.js +35 -5
- package/dist/multi/141.app-f32e4213.js +0 -1
- package/dist/multi/222.app-f32e4213.js +0 -1
- package/dist/multi/335.app-f32e4213.js +0 -1
- package/dist/multi/34.app-f32e4213.js +0 -1
- package/dist/multi/349.app-f32e4213.js +0 -1
- package/dist/multi/378.app-f32e4213.js +0 -1
- package/dist/multi/406.app-f32e4213.js +0 -1
- package/dist/multi/476.app-f32e4213.js +0 -1
- package/dist/multi/53.app-f32e4213.js +0 -1
- package/dist/multi/584.app-f32e4213.js +0 -1
- package/dist/multi/690.app-f32e4213.js +0 -1
- package/dist/multi/747.app-f32e4213.js +0 -1
- package/dist/multi/767.app-f32e4213.js +0 -1
- package/dist/multi/816.app-f32e4213.js +0 -1
- package/dist/multi/83.app-f32e4213.js +0 -1
- package/dist/multi/873.app-f32e4213.js +0 -1
- package/dist/multi/920.app-f32e4213.js +0 -1
- package/dist/multi/991.app-f32e4213.js +0 -1
- package/dist/multi/app-f32e4213.js +0 -2
- package/dist/multi/app-f32e4213.js.LICENSE.txt +0 -16
- package/dist/multi/styles-f32e4213.css +0 -284
- package/dist/single/app-7fa8e43f.js +0 -2
- package/dist/single/app-7fa8e43f.js.LICENSE.txt +0 -16
- package/src/assets/scss/code.scss +0 -71
- package/src/assets/scss/typography.scss +0 -218
- package/src/components/ArrowButton/index.tsx +0 -36
- package/src/components/ArrowButton/styles.scss +0 -35
- package/src/components/LanguagePicker/index.tsx +0 -40
- package/src/components/Modal/styles.scss +0 -126
- package/src/components/ReportLogo/index.tsx +0 -16
- package/src/components/ReportLogo/styles.scss +0 -20
- package/src/components/ReportLogoFull/index.tsx +0 -20
- package/src/components/ReportLogoFull/styles.scss +0 -7
- package/src/components/TestResult/TestResultAttachmentsView/index.tsx +0 -27
- package/src/components/TestResult/TestResultError/index.tsx +0 -59
- package/src/components/TestResult/TestResultError/styles.scss +0 -51
- package/src/components/TestResult/TestResultHeader/index.tsx +0 -55
- package/src/components/TestResult/TestResultHistory/TestResultHistoryItem.tsx +0 -67
- package/src/components/TestResult/TestResultHistory/index.tsx +0 -26
- package/src/components/TestResult/TestResultInfo/index.tsx +0 -79
- package/src/components/TestResult/TestResultOverview.tsx +0 -43
- package/src/components/TestResult/TestResultPrevStatuses/index.tsx +0 -49
- package/src/components/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +0 -52
- package/src/components/TestResult/TestResultRetriesView/index.tsx +0 -24
- package/src/components/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx +0 -12
- package/src/components/TestResult/TestResultSteps/attachment.tsx +0 -68
- package/src/components/TestResult/TestResultSteps/attachmentCode.tsx +0 -20
- package/src/components/TestResult/TestResultSteps/attachmentImage.tsx +0 -32
- package/src/components/TestResult/TestResultSteps/attachmentVideo.tsx +0 -15
- package/src/components/TestResult/TestResultSteps/testResultAttachment.tsx +0 -77
- package/src/components/TestResult/TestResultSteps/testResultStep.tsx +0 -85
- package/src/components/TestResult/TestResultSteps/testResultStepInfo.tsx +0 -30
- package/src/components/TestResult/TestResultTabs/index.tsx +0 -59
- package/src/components/ThemeButton/ThemeButton.tsx +0 -20
- package/src/components/Tree/Tree.tsx +0 -75
- package/src/components/Tree/TreeHeader.tsx +0 -82
- package/src/components/Tree/TreeItem.tsx +0 -35
- package/src/components/Tree/TreeItemIcon.tsx +0 -32
- package/src/i18n/constants.ts +0 -124
- package/src/i18n/locales/am.json +0 -120
- package/src/i18n/locales/az.json +0 -120
- package/src/i18n/locales/de.json +0 -120
- package/src/i18n/locales/en.json +0 -121
- package/src/i18n/locales/es.json +0 -120
- package/src/i18n/locales/fr.json +0 -120
- package/src/i18n/locales/he.json +0 -120
- package/src/i18n/locales/it.json +0 -120
- package/src/i18n/locales/ja.json +0 -120
- package/src/i18n/locales/ka.json +0 -120
- package/src/i18n/locales/kr.json +0 -120
- package/src/i18n/locales/nl.json +0 -120
- package/src/i18n/locales/pl.json +0 -118
- package/src/i18n/locales/pt.json +0 -120
- package/src/i18n/locales/ru.json +0 -118
- package/src/i18n/locales/sv.json +0 -120
- package/src/i18n/locales/tr.json +0 -120
- package/src/i18n/locales/zh.json +0 -120
- package/src/utils/attachments.ts +0 -156
- package/src/utils/capitalize.ts +0 -6
- /package/dist/multi/{JetBrainsMono_vf-b9a9c326..woff → JetBrainsMono_vf.woff} +0 -0
- /package/dist/multi/{JetBrainsMono_vf-9e9649b6..woff2 → JetBrainsMono_vf.woff2} +0 -0
- /package/dist/multi/{pt-root-ui_vf-22fe60ca..woff → pt-root-ui_vf.woff} +0 -0
- /package/dist/multi/{pt-root-ui_vf-9d251e8b..woff2 → pt-root-ui_vf.woff2} +0 -0
- /package/src/components/TestResult/{TestResultAttachmentsView → TrAttachmentsView}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultDescription → TrDescription}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultDropdown → TrDropdown}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultEmpty → TrEmpty}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultLinks → TrLinks}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultMetadata → TrMetadata}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultNavigation → TrNavigation}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultParameters → TrParameters}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultPrevStatuses → TrPrevStatuses}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultRetriesView → TrRetriesView}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultSeverity → TrSeverity}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultStatus → TrStatus}/styles.scss +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { capitalize } from "@allurereport/core-api";
|
|
2
|
+
import { SvgIcon, Text, allureIcons } from "@allurereport/web-components";
|
|
2
3
|
import { type FunctionalComponent } from "preact";
|
|
3
4
|
import { useI18n } from "@/stores";
|
|
4
|
-
import { capitalize } from "@/utils/capitalize";
|
|
5
5
|
import * as styles from "./styles.scss";
|
|
6
6
|
|
|
7
7
|
const icons: Record<string, string> = {
|
|
@@ -10,7 +10,7 @@ const icons: Record<string, string> = {
|
|
|
10
10
|
muted: allureIcons.lineGeneralEye,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const TrInfoStatuses: FunctionalComponent<{ statuses: [string, boolean][] }> = ({ statuses }) => {
|
|
14
14
|
const { t } = useI18n("filters");
|
|
15
15
|
|
|
16
16
|
return (
|
|
@@ -21,7 +21,9 @@ export const TestResultInfoStatuses: FunctionalComponent<{ statuses: [string, bo
|
|
|
21
21
|
return (
|
|
22
22
|
<div key={key} className={styles["test-result-info-status"]}>
|
|
23
23
|
<SvgIcon className={styles["metadata-icon"]} id={icons[status]} size={"s"} />
|
|
24
|
-
{
|
|
24
|
+
<Text type={"ui"} size={"s"}>
|
|
25
|
+
{capitalize(title)}
|
|
26
|
+
</Text>
|
|
25
27
|
</div>
|
|
26
28
|
);
|
|
27
29
|
})}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type TestEnvGroup, getRealEnvsCount } from "@allurereport/core-api";
|
|
2
|
+
import { formatDuration } from "@allurereport/core-api";
|
|
3
|
+
import { Counter, Heading, Loadable, Text, TooltipWrapper } from "@allurereport/web-components";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import type { FunctionalComponent } from "preact";
|
|
6
|
+
import type { AwesomeTestResult } from "types";
|
|
7
|
+
import { TrInfoStatuses } from "@/components/TestResult/TrInfo/TrInfoStatuses";
|
|
8
|
+
import { TrNavigation } from "@/components/TestResult/TrNavigation";
|
|
9
|
+
import { TrPrevStatuses } from "@/components/TestResult/TrPrevStatuses";
|
|
10
|
+
import { TrSeverity } from "@/components/TestResult/TrSeverity";
|
|
11
|
+
import { TrStatus } from "@/components/TestResult/TrStatus";
|
|
12
|
+
import { TrTab, TrTabsList } from "@/components/TestResult/TrTabs";
|
|
13
|
+
import { testEnvGroupsStore } from "@/stores/env";
|
|
14
|
+
import { isSplitMode } from "@/stores/layout";
|
|
15
|
+
import { useI18n } from "@/stores/locale";
|
|
16
|
+
import { timestampToDate } from "@/utils/time";
|
|
17
|
+
import * as styles from "./styles.scss";
|
|
18
|
+
|
|
19
|
+
export type TrInfoProps = {
|
|
20
|
+
testResult?: AwesomeTestResult;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const TrInfo: FunctionalComponent<TrInfoProps> = ({ testResult }) => {
|
|
24
|
+
const { name, status, muted, flaky, known, duration, labels, history, retries, attachments, stop } = testResult ?? {};
|
|
25
|
+
const formattedDuration = formatDuration(duration as number);
|
|
26
|
+
const fullDate = stop && timestampToDate(stop);
|
|
27
|
+
const severity = labels?.find((label) => label.name === "severity")?.value ?? "normal";
|
|
28
|
+
const { t } = useI18n("ui");
|
|
29
|
+
const statuses = Object.entries({ flaky, muted, known }).filter(([, value]) => value);
|
|
30
|
+
|
|
31
|
+
const Content = () => {
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
{name && (
|
|
35
|
+
<Heading data-testid="test-result-info-title" tag={"h1"} size={"s"} className={styles["test-result-name"]}>
|
|
36
|
+
{name}
|
|
37
|
+
</Heading>
|
|
38
|
+
)}
|
|
39
|
+
<div className={styles["test-result-info-data"]}>
|
|
40
|
+
{Boolean(status) && <TrStatus status={status} />}
|
|
41
|
+
{Boolean(history?.length) && <TrPrevStatuses history={history} />}
|
|
42
|
+
<TrSeverity severity={severity} />
|
|
43
|
+
{Boolean(statuses.length) && <TrInfoStatuses statuses={statuses} />}
|
|
44
|
+
<TooltipWrapper tooltipText={fullDate}>
|
|
45
|
+
<Text tag={"div"} size={"s"} bold className={styles["test-result-duration"]}>
|
|
46
|
+
{formattedDuration}
|
|
47
|
+
</Text>
|
|
48
|
+
</TooltipWrapper>
|
|
49
|
+
</div>
|
|
50
|
+
<div className={styles["test-result-tabs"]}>
|
|
51
|
+
<TrTabsList>
|
|
52
|
+
<TrTab id="overview">{t("overview")}</TrTab>
|
|
53
|
+
<TrTab id="history">
|
|
54
|
+
<div className={styles["test-result-tab"]}>
|
|
55
|
+
{t("history")}
|
|
56
|
+
{Boolean(history?.length) && <Counter size={"s"} count={history?.length} />}
|
|
57
|
+
</div>
|
|
58
|
+
</TrTab>
|
|
59
|
+
<TrTab id="retries">
|
|
60
|
+
<div className={styles["test-result-tab"]}>
|
|
61
|
+
{t("retries")}
|
|
62
|
+
{Boolean(retries?.length) && <Counter size={"s"} count={retries?.length} />}
|
|
63
|
+
</div>
|
|
64
|
+
</TrTab>
|
|
65
|
+
<TrTab id="attachments">
|
|
66
|
+
<div className={styles["test-result-tab"]}>
|
|
67
|
+
{t("attachments")}
|
|
68
|
+
{Boolean(attachments?.length) && <Counter size={"s"} count={attachments?.length} />}
|
|
69
|
+
</div>
|
|
70
|
+
</TrTab>
|
|
71
|
+
<Loadable<Record<string, TestEnvGroup>, TestEnvGroup | undefined>
|
|
72
|
+
source={testEnvGroupsStore}
|
|
73
|
+
transformData={(groups) => groups?.[testResult?.testCase?.id]}
|
|
74
|
+
renderData={(group) => {
|
|
75
|
+
const envsCount = getRealEnvsCount(group);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<TrTab id="environments">
|
|
79
|
+
<div className={styles["test-result-tab"]}>
|
|
80
|
+
{t("environments")}
|
|
81
|
+
{!!envsCount && <Counter size={"s"} count={envsCount} />}
|
|
82
|
+
</div>
|
|
83
|
+
</TrTab>
|
|
84
|
+
);
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
</TrTabsList>
|
|
88
|
+
</div>
|
|
89
|
+
</>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<div className={clsx(styles["test-result-info"], isSplitMode.value && styles.sticky)}>
|
|
95
|
+
<TrNavigation testResult={testResult} />
|
|
96
|
+
{testResult && <Content />}
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
padding: 20px 24px 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
.sticky {
|
|
6
|
+
position: sticky;
|
|
7
|
+
left: 0;
|
|
8
|
+
top: 0;
|
|
9
|
+
width: 100%;
|
|
10
|
+
background: var(--bg-base-primary);
|
|
11
|
+
z-index: 1;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.sticky {
|
|
15
|
+
position: sticky;
|
|
16
|
+
left: 0;
|
|
17
|
+
top: 0;
|
|
18
|
+
width: 100%;
|
|
19
|
+
background: var(--bg-base-primary);
|
|
20
|
+
z-index: 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
5
23
|
.test-result-info-data {
|
|
6
24
|
display: flex;
|
|
7
25
|
gap: 12px;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SvgIcon, Text, allureIcons } from "@allurereport/web-components";
|
|
2
2
|
import type { FunctionalComponent } from "preact";
|
|
3
3
|
import { useState } from "preact/hooks";
|
|
4
|
-
import type {
|
|
4
|
+
import type { AwesomeTestResult } from "types";
|
|
5
5
|
import { MetadataButton } from "@/components/MetadataButton";
|
|
6
6
|
import { useI18n } from "@/stores/locale";
|
|
7
7
|
import * as styles from "./styles.scss";
|
|
8
8
|
|
|
9
|
-
interface
|
|
9
|
+
interface TrLinkProps {
|
|
10
10
|
name: string;
|
|
11
11
|
url: string;
|
|
12
12
|
type: string;
|
|
@@ -19,8 +19,8 @@ const linksIconMap: Record<string, string> = {
|
|
|
19
19
|
github: allureIcons.github,
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
link:
|
|
22
|
+
const TrLink: FunctionalComponent<{
|
|
23
|
+
link: TrLinkProps;
|
|
24
24
|
}> = ({ link }) => {
|
|
25
25
|
const { url, type } = link;
|
|
26
26
|
|
|
@@ -34,15 +34,15 @@ const TestResultLink: FunctionalComponent<{
|
|
|
34
34
|
);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export type
|
|
38
|
-
links:
|
|
37
|
+
export type TrLinksProps = {
|
|
38
|
+
links: AwesomeTestResult["links"];
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
export const
|
|
41
|
+
export const TrLinks: FunctionalComponent<TrLinksProps> = ({ links }) => {
|
|
42
42
|
const [isOpened, setIsOpen] = useState(true);
|
|
43
43
|
const { t } = useI18n("ui");
|
|
44
44
|
const linkMap = links.map((link, index) => {
|
|
45
|
-
return <
|
|
45
|
+
return <TrLink link={link as TrLinkProps} key={index} />;
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
return (
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { FunctionalComponent } from "preact";
|
|
2
2
|
import { useState } from "preact/hooks";
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
3
|
+
import type { AwesomeTestResult } from "types";
|
|
4
|
+
import { TrMetadataList } from "@/components/Metadata";
|
|
5
5
|
import { MetadataButton } from "@/components/MetadataButton";
|
|
6
6
|
import { useI18n } from "@/stores/locale";
|
|
7
7
|
import * as styles from "./styles.scss";
|
|
8
8
|
|
|
9
|
-
export type
|
|
10
|
-
testResult?:
|
|
9
|
+
export type TrMetadataProps = {
|
|
10
|
+
testResult?: AwesomeTestResult;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const TrMetadata: FunctionalComponent<TrMetadataProps> = ({ testResult }) => {
|
|
14
14
|
const { t } = useI18n("ui");
|
|
15
15
|
const { labels, groupedLabels } = testResult ?? {};
|
|
16
16
|
const [isOpened, setIsOpened] = useState(true);
|
|
@@ -20,7 +20,7 @@ export const TestResultMetadata: FunctionalComponent<TestResultMetadataProps> =
|
|
|
20
20
|
<MetadataButton isOpened={isOpened} setIsOpen={setIsOpened} counter={labels?.length} title={t("labels")} />
|
|
21
21
|
|
|
22
22
|
<div className={styles["test-result-metadata-wrapper"]}>
|
|
23
|
-
{isOpened && <
|
|
23
|
+
{isOpened && <TrMetadataList groupedLabels={groupedLabels} />}
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
);
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { IconButton, allureIcons } from "@allurereport/web-components";
|
|
2
|
-
import { Loadable } from "@allurereport/web-components";
|
|
3
|
-
import { TooltipWrapper } from "@allurereport/web-components";
|
|
4
|
-
import { Code } from "@allurereport/web-components";
|
|
1
|
+
import { Code, IconButton, Loadable, TooltipWrapper, allureIcons } from "@allurereport/web-components";
|
|
5
2
|
import type { FunctionalComponent } from "preact";
|
|
6
|
-
import type {
|
|
7
|
-
import { navigateTo } from "@/index";
|
|
3
|
+
import type { AwesomeTestResult } from "types";
|
|
8
4
|
import { useI18n } from "@/stores";
|
|
5
|
+
import { navigateTo } from "@/stores/router";
|
|
9
6
|
import { testResultNavStore } from "@/stores/testResults";
|
|
10
7
|
import { copyToClipboard } from "@/utils/copyToClipboard";
|
|
11
8
|
import * as styles from "./styles.scss";
|
|
12
9
|
|
|
13
|
-
export type
|
|
14
|
-
testResult?:
|
|
10
|
+
export type TrNavigationProps = {
|
|
11
|
+
testResult?: AwesomeTestResult;
|
|
15
12
|
};
|
|
16
13
|
|
|
17
|
-
export const
|
|
14
|
+
export const TrNavigation: FunctionalComponent<TrNavigationProps> = ({ testResult }) => {
|
|
18
15
|
const { fullName, id: testResultId } = testResult ?? {};
|
|
19
16
|
const id = testResultId || "";
|
|
20
17
|
const { t: tooltip } = useI18n("controls");
|
|
@@ -42,6 +39,7 @@ export const TestResultNavigation: FunctionalComponent<TestResultNavigationProps
|
|
|
42
39
|
source={testResultNavStore}
|
|
43
40
|
renderData={(data) => {
|
|
44
41
|
const currentIndex = data.indexOf(id) + 1;
|
|
42
|
+
|
|
45
43
|
return (
|
|
46
44
|
<div className={styles["test-result-nav"]}>
|
|
47
45
|
{fullName && <FullName />}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FunctionalComponent } from "preact";
|
|
2
|
+
import type { AwesomeTestResult } from "types";
|
|
3
|
+
import * as styles from "@/components/BaseLayout/styles.scss";
|
|
4
|
+
import TestStepsEmpty from "@/components/TestResult/TestStepsEmpty";
|
|
5
|
+
import { TrDescription } from "@/components/TestResult/TrDescription";
|
|
6
|
+
import { TrError } from "@/components/TestResult/TrError";
|
|
7
|
+
import { TrLinks } from "@/components/TestResult/TrLinks";
|
|
8
|
+
import { TrMetadata } from "@/components/TestResult/TrMetadata";
|
|
9
|
+
import { TrParameters } from "@/components/TestResult/TrParameters";
|
|
10
|
+
import { TrPwTraces } from "@/components/TestResult/TrPwTraces";
|
|
11
|
+
import { TrSetup } from "@/components/TestResult/TrSetup";
|
|
12
|
+
import { TrSteps } from "@/components/TestResult/TrSteps";
|
|
13
|
+
import { TrTeardown } from "@/components/TestResult/TrTeardown";
|
|
14
|
+
|
|
15
|
+
export type TrOverviewProps = {
|
|
16
|
+
testResult?: AwesomeTestResult;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const TrOverview: FunctionalComponent<TrOverviewProps> = ({ testResult }) => {
|
|
20
|
+
const { error, parameters, groupedLabels, links, description, setup, steps, teardown, id, status } = testResult || {};
|
|
21
|
+
const isNoSteps = !setup?.length && !steps.length && !teardown.length;
|
|
22
|
+
const pwTraces = testResult?.attachments?.filter(
|
|
23
|
+
(attachment) => attachment.link.contentType === "application/vnd.allure.playwright-trace",
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
{Boolean(error?.message) && (
|
|
29
|
+
<div className={styles["test-result-errors"]}>
|
|
30
|
+
<TrError {...error} status={status} />
|
|
31
|
+
</div>
|
|
32
|
+
)}
|
|
33
|
+
{Boolean(pwTraces.length) && <TrPwTraces pwTraces={pwTraces} />}
|
|
34
|
+
{Boolean(parameters?.length) && <TrParameters parameters={parameters} />}
|
|
35
|
+
{Boolean(groupedLabels && Object.keys(groupedLabels || {})?.length) && <TrMetadata testResult={testResult} />}
|
|
36
|
+
{Boolean(links?.length) && <TrLinks links={links} />}
|
|
37
|
+
{Boolean(description) && <TrDescription description={description} />}
|
|
38
|
+
<div className={styles["test-results"]}>
|
|
39
|
+
{isNoSteps && <TestStepsEmpty />}
|
|
40
|
+
{Boolean(setup?.length) && <TrSetup id={id} setup={setup} />}
|
|
41
|
+
{Boolean(steps?.length) && <TrSteps id={id} steps={steps} />}
|
|
42
|
+
{Boolean(teardown?.length) && <TrTeardown id={id} teardown={teardown} />}
|
|
43
|
+
</div>
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { FunctionalComponent } from "preact";
|
|
2
2
|
import { useState } from "preact/hooks";
|
|
3
|
-
import type {
|
|
3
|
+
import type { AwesomeTestResult } from "types";
|
|
4
4
|
import { MetadataList } from "@/components/Metadata";
|
|
5
5
|
import { MetadataButton } from "@/components/MetadataButton";
|
|
6
6
|
import { useI18n } from "@/stores/locale";
|
|
7
7
|
import * as styles from "./styles.scss";
|
|
8
8
|
|
|
9
|
-
export type
|
|
10
|
-
parameters:
|
|
9
|
+
export type TrParametersProps = {
|
|
10
|
+
parameters: AwesomeTestResult["parameters"];
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const TrParameters: FunctionalComponent<TrParametersProps> = ({ parameters }) => {
|
|
14
14
|
const [isOpened, setIsOpened] = useState(true);
|
|
15
15
|
const { t } = useI18n("ui");
|
|
16
16
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type HistoryTestResult, capitalize } from "@allurereport/core-api";
|
|
2
|
+
import { getReportOptions } from "@allurereport/web-commons";
|
|
3
|
+
import { SvgIcon, Text, TooltipWrapper, allureIcons } from "@allurereport/web-components";
|
|
4
|
+
import type { FunctionalComponent } from "preact";
|
|
5
|
+
import type { AwesomeReportOptions, AwesomeTestResult } from "types";
|
|
6
|
+
import { useI18n } from "@/stores";
|
|
7
|
+
import { timestampToDate } from "@/utils/time";
|
|
8
|
+
import * as styles from "./styles.scss";
|
|
9
|
+
|
|
10
|
+
const TrPrevStatus: FunctionalComponent<{ item: HistoryTestResult }> = ({ item }) => {
|
|
11
|
+
const reportOptions = getReportOptions<AwesomeReportOptions & { id: string }>();
|
|
12
|
+
|
|
13
|
+
if (!item.url) {
|
|
14
|
+
return (
|
|
15
|
+
<div className={styles["test-result-prev-status"]}>
|
|
16
|
+
<SvgIcon id={allureIcons.lineShapesDotCircle} className={styles[`status-${item?.status}`]} />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { origin, pathname } = new URL(item.url);
|
|
22
|
+
const navigateUrl = new URL([pathname, reportOptions.id].join("/"), origin);
|
|
23
|
+
|
|
24
|
+
navigateUrl.hash = item.id;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<a className={styles["test-result-prev-status"]} href={navigateUrl.toString()}>
|
|
28
|
+
<SvgIcon id={allureIcons.lineShapesDotCircle} className={styles[`status-${item?.status}`]} />
|
|
29
|
+
</a>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
const TrPrevStatusTooltip: FunctionalComponent<{ item: HistoryTestResult }> = ({ item }) => {
|
|
33
|
+
const convertedStop = item.stop && timestampToDate(item.stop);
|
|
34
|
+
const { t } = useI18n("statuses");
|
|
35
|
+
const status = t(item.status);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className={styles["test-result-prev-status-tooltip"]}>
|
|
39
|
+
<Text tag={"div"} size={"m"} bold>
|
|
40
|
+
{capitalize(status)}
|
|
41
|
+
</Text>
|
|
42
|
+
<Text size={"m"}>{convertedStop}</Text>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type TrPrevStatusesProps = {
|
|
48
|
+
history: AwesomeTestResult["history"];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const TrPrevStatuses: FunctionalComponent<TrPrevStatusesProps> = ({ history }) => {
|
|
52
|
+
return (
|
|
53
|
+
<div className={styles["test-result-prev-statuses"]}>
|
|
54
|
+
{history?.slice(0, 6).map((item, key) => (
|
|
55
|
+
<div key={key} data-testid={"test-result-prev-status"} className={styles["test-result-prev-status"]}>
|
|
56
|
+
<TooltipWrapper key={key} tooltipComponent={<TrPrevStatusTooltip item={item} />}>
|
|
57
|
+
<TrPrevStatus item={item} />
|
|
58
|
+
</TooltipWrapper>
|
|
59
|
+
</div>
|
|
60
|
+
))}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import { useEffect, useRef } from "preact/hooks";
|
|
3
|
+
import * as styles from "./styles.scss";
|
|
4
|
+
|
|
5
|
+
interface PwTraceProps {
|
|
6
|
+
blob: Blob;
|
|
7
|
+
isFullScreen?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export const PwTrace = ({ blob, isFullScreen }: PwTraceProps) => {
|
|
10
|
+
const iframeRef = useRef<HTMLIFrameElement>(null);
|
|
11
|
+
|
|
12
|
+
const handleLoad = () => {
|
|
13
|
+
iframeRef.current?.contentWindow?.postMessage(
|
|
14
|
+
{ method: "load", params: { trace: blob } },
|
|
15
|
+
"https://trace.playwright.dev",
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (iframeRef.current) {
|
|
21
|
+
iframeRef.current.onload = handleLoad;
|
|
22
|
+
}
|
|
23
|
+
}, [blob]);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<iframe
|
|
27
|
+
className={clsx(styles["pw-trace"], { [styles["pw-trace-fullscreen"]]: isFullScreen })}
|
|
28
|
+
ref={iframeRef}
|
|
29
|
+
width={"100%"}
|
|
30
|
+
height={"100%"}
|
|
31
|
+
src={"https://trace.playwright.dev/next/"}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AttachmentTestStepResult } from "@allurereport/core-api";
|
|
2
|
+
import type { Attachments } from "@allurereport/web-commons";
|
|
3
|
+
import { fetchReportAttachment } from "@allurereport/web-commons";
|
|
4
|
+
import { IconButton, TooltipWrapper, allureIcons } from "@allurereport/web-components";
|
|
5
|
+
import { PwTrace } from "@/components/TestResult/TrPwTraces/PwTrace";
|
|
6
|
+
import { useI18n } from "@/stores";
|
|
7
|
+
import { openModal } from "@/stores/modal";
|
|
8
|
+
|
|
9
|
+
export const fetchFromUrl = async ({ id, ext, contentType }: Attachments) => {
|
|
10
|
+
const fileName = `${id || "-"}${ext || ""}`;
|
|
11
|
+
|
|
12
|
+
return fetchReportAttachment(`data/attachments/${fileName}?attachment`, contentType);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const PwTraceButton = ({ link }: Pick<AttachmentTestStepResult, "link">) => {
|
|
16
|
+
const { t } = useI18n("ui");
|
|
17
|
+
const openPw = async () => {
|
|
18
|
+
const hasPw = await fetchFromUrl(link);
|
|
19
|
+
const blob = await hasPw.blob();
|
|
20
|
+
|
|
21
|
+
openModal({
|
|
22
|
+
component: <PwTrace blob={blob} />,
|
|
23
|
+
title: `Playwright Trace Viewer | ${link.name}${link.ext}`,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<TooltipWrapper tooltipText={t("openPwTrace")}>
|
|
29
|
+
<IconButton icon={allureIcons.lineArrowsExpand3} size={"s"} style={"ghost"} onClick={openPw} />
|
|
30
|
+
</TooltipWrapper>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AttachmentTestStepResult } from "@allurereport/core-api";
|
|
2
|
+
import type { FunctionalComponent } from "preact";
|
|
3
|
+
import { useState } from "preact/hooks";
|
|
4
|
+
import type { AwesomeTestResult } from "types";
|
|
5
|
+
import { MetadataButton } from "@/components/MetadataButton";
|
|
6
|
+
import { TrAttachment } from "@/components/TestResult/TrSteps/TrAttachment";
|
|
7
|
+
import * as styles from "./styles.scss";
|
|
8
|
+
|
|
9
|
+
export type TrMetadataProps = {
|
|
10
|
+
testResult?: AwesomeTestResult;
|
|
11
|
+
pwTraces?: AttachmentTestStepResult[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const TrPwTraces: FunctionalComponent<TrMetadataProps> = ({ pwTraces }) => {
|
|
15
|
+
const [isOpened, setIsOpened] = useState(true);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className={styles["tr-metadata"]}>
|
|
19
|
+
<MetadataButton
|
|
20
|
+
isOpened={isOpened}
|
|
21
|
+
setIsOpen={setIsOpened}
|
|
22
|
+
counter={pwTraces?.length}
|
|
23
|
+
title={"Playwright Trace"}
|
|
24
|
+
/>
|
|
25
|
+
{isOpened && (
|
|
26
|
+
<div className={styles["tr-metadata-wrapper"]}>
|
|
27
|
+
{pwTraces?.map((pw, index) => <TrAttachment stepIndex={index + 1} item={pw} key={pw.link.id} />)}
|
|
28
|
+
</div>
|
|
29
|
+
)}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.tr-metadata {
|
|
2
|
+
padding: 12px 24px 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.tr-metadata-wrapper {
|
|
6
|
+
border-bottom: 1px solid var(--on-border-primary);
|
|
7
|
+
padding-top: 8px;
|
|
8
|
+
padding-bottom: 12px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.pw-trace {
|
|
12
|
+
--modal-paddings: 60px;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
height: calc(80vh - var(--modal-paddings));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pw-trace-fullscreen {
|
|
18
|
+
--modal-fs-paddings: 75px;
|
|
19
|
+
height: calc(100vh - var(--modal-fs-paddings));
|
|
20
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { formatDuration } from "@allurereport/core-api";
|
|
2
|
+
import { ArrowButton, IconButton, Text, TreeItemIcon, allureIcons } from "@allurereport/web-components";
|
|
3
|
+
import type { FunctionalComponent } from "preact";
|
|
4
|
+
import { useState } from "preact/hooks";
|
|
5
|
+
import type { AwesomeTestResult } from "types";
|
|
6
|
+
import { TrError } from "@/components/TestResult/TrError";
|
|
7
|
+
import * as styles from "@/components/TestResult/TrRetriesView/styles.scss";
|
|
8
|
+
import { useI18n } from "@/stores/locale";
|
|
9
|
+
import { navigateTo } from "@/stores/router";
|
|
10
|
+
import { timestampToDate } from "@/utils/time";
|
|
11
|
+
|
|
12
|
+
export type TrRetriesItemProps = {
|
|
13
|
+
testResultItem: AwesomeTestResult;
|
|
14
|
+
attempt: number;
|
|
15
|
+
totalAttempts: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const TrRetriesItem: FunctionalComponent<TrRetriesItemProps> = ({ testResultItem, attempt, totalAttempts }) => {
|
|
19
|
+
const { id, status, error, stop, duration } = testResultItem;
|
|
20
|
+
const [isOpened, setIsOpen] = useState(false);
|
|
21
|
+
|
|
22
|
+
const { t } = useI18n("ui");
|
|
23
|
+
|
|
24
|
+
const retryTitlePrefix = t("attempt", { attempt, total: totalAttempts });
|
|
25
|
+
const convertedStop = stop ? timestampToDate(stop) : undefined;
|
|
26
|
+
const retryTitle = convertedStop ? `${retryTitlePrefix} – ${convertedStop}` : retryTitlePrefix;
|
|
27
|
+
|
|
28
|
+
const formattedDuration = typeof duration === "number" ? formatDuration(duration) : undefined;
|
|
29
|
+
const navigateUrl = id;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div data-testid="test-result-retries-item">
|
|
33
|
+
<div className={styles["test-result-retries-item-header"]} onClick={() => setIsOpen(!isOpened)}>
|
|
34
|
+
{Boolean(error.trace || error.message) && (
|
|
35
|
+
<ArrowButton
|
|
36
|
+
data-testid="test-result-retries-item-arrow-button"
|
|
37
|
+
isOpened={isOpened}
|
|
38
|
+
icon={allureIcons.lineArrowsChevronDown}
|
|
39
|
+
/>
|
|
40
|
+
)}
|
|
41
|
+
<div className={styles["test-result-retries-item-wrap"]}>
|
|
42
|
+
<TreeItemIcon status={status} className={styles["test-result-retries-item-status"]} />
|
|
43
|
+
<Text data-testid="test-result-retries-item-text" className={styles["test-result-retries-item-text"]}>
|
|
44
|
+
{retryTitle}
|
|
45
|
+
</Text>
|
|
46
|
+
<div className={styles["test-result-retries-item-info"]}>
|
|
47
|
+
{Boolean(formattedDuration) && (
|
|
48
|
+
<Text type="ui" size={"s"} className={styles["item-time"]}>
|
|
49
|
+
{formattedDuration}
|
|
50
|
+
</Text>
|
|
51
|
+
)}
|
|
52
|
+
<IconButton
|
|
53
|
+
icon={allureIcons.lineGeneralLinkExternal}
|
|
54
|
+
style={"ghost"}
|
|
55
|
+
size={"s"}
|
|
56
|
+
className={styles["test-result-retries-item-link"]}
|
|
57
|
+
data-testid="test-result-retries-item-open-button"
|
|
58
|
+
onClick={() => navigateTo(navigateUrl)}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
{isOpened && (error.message || error.trace) && (
|
|
64
|
+
<div className={styles["test-result-retries-item-content"]}>
|
|
65
|
+
<TrError {...error} status={status} />
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FunctionalComponent } from "preact";
|
|
2
|
+
import type { AwesomeTestResult } from "types";
|
|
3
|
+
import * as styles from "@/components/TestResult/TrHistory/styles.scss";
|
|
4
|
+
import { TrRetriesItem } from "@/components/TestResult/TrRetriesView/TrRetriesItem";
|
|
5
|
+
import { useI18n } from "@/stores";
|
|
6
|
+
|
|
7
|
+
export const TrRetriesView: FunctionalComponent<{
|
|
8
|
+
testResult: AwesomeTestResult;
|
|
9
|
+
}> = ({ testResult }) => {
|
|
10
|
+
const { retries } = testResult ?? {};
|
|
11
|
+
const { t } = useI18n("empty");
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className={styles["test-result-history"]}>
|
|
15
|
+
{retries.length ? (
|
|
16
|
+
retries?.map((item, key) => (
|
|
17
|
+
<TrRetriesItem
|
|
18
|
+
testResultItem={item as unknown as AwesomeTestResult}
|
|
19
|
+
key={key}
|
|
20
|
+
attempt={retries.length - key}
|
|
21
|
+
totalAttempts={retries.length + 1}
|
|
22
|
+
/>
|
|
23
|
+
))
|
|
24
|
+
) : (
|
|
25
|
+
<div className={styles["test-result-empty"]}>{t("no-retries-results")}</div>
|
|
26
|
+
)}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
};
|