@allurereport/web-awesome 3.0.0-beta.3
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/.babelrc.js +46 -0
- package/.eslintrc.cjs +15 -0
- package/README.md +27 -0
- package/dist/multi/141.app-b6362ca0.js +1 -0
- package/dist/multi/222.app-b6362ca0.js +1 -0
- package/dist/multi/335.app-b6362ca0.js +1 -0
- package/dist/multi/34.app-b6362ca0.js +1 -0
- package/dist/multi/349.app-b6362ca0.js +1 -0
- package/dist/multi/378.app-b6362ca0.js +1 -0
- package/dist/multi/406.app-b6362ca0.js +1 -0
- package/dist/multi/476.app-b6362ca0.js +1 -0
- package/dist/multi/53.app-b6362ca0.js +1 -0
- package/dist/multi/584.app-b6362ca0.js +1 -0
- package/dist/multi/690.app-b6362ca0.js +1 -0
- package/dist/multi/747.app-b6362ca0.js +1 -0
- package/dist/multi/767.app-b6362ca0.js +1 -0
- package/dist/multi/816.app-b6362ca0.js +1 -0
- package/dist/multi/83.app-b6362ca0.js +1 -0
- package/dist/multi/873.app-b6362ca0.js +1 -0
- package/dist/multi/920.app-b6362ca0.js +1 -0
- package/dist/multi/991.app-b6362ca0.js +1 -0
- package/dist/multi/JetBrainsMono_vf-9e9649b6..woff2 +0 -0
- package/dist/multi/JetBrainsMono_vf-b9a9c326..woff +0 -0
- package/dist/multi/app-b6362ca0.js +2 -0
- package/dist/multi/app-b6362ca0.js.LICENSE.txt +16 -0
- package/dist/multi/manifest.json +26 -0
- package/dist/multi/pt-root-ui_vf-22fe60ca..woff +0 -0
- package/dist/multi/pt-root-ui_vf-9d251e8b..woff2 +0 -0
- package/dist/multi/styles-b6362ca0.css +363 -0
- package/dist/single/app-57ae0a60.js +2 -0
- package/dist/single/app-57ae0a60.js.LICENSE.txt +16 -0
- package/dist/single/manifest.json +3 -0
- package/package.json +93 -0
- package/postcss.config.js +5 -0
- package/src/assets/fonts/JetBrainsMono_vf.woff +0 -0
- package/src/assets/fonts/JetBrainsMono_vf.woff2 +0 -0
- package/src/assets/fonts/pt-root-ui_vf.woff +0 -0
- package/src/assets/fonts/pt-root-ui_vf.woff2 +0 -0
- package/src/assets/scss/_common.scss +134 -0
- package/src/assets/scss/code.css +71 -0
- package/src/assets/scss/day.scss +51 -0
- package/src/assets/scss/fonts.scss +21 -0
- package/src/assets/scss/index.scss +9 -0
- package/src/assets/scss/mixins.scss +26 -0
- package/src/assets/scss/night.scss +61 -0
- package/src/assets/scss/palette.scss +393 -0
- package/src/assets/scss/theme.scss +117 -0
- package/src/assets/scss/typography.scss +218 -0
- package/src/assets/scss/vars.scss +8 -0
- package/src/assets/svg/arrows-chevron-down.svg +5 -0
- package/src/assets/svg/github.svg +5 -0
- package/src/assets/svg/line-alerts-notification-box.svg +3 -0
- package/src/assets/svg/line-arrows-chevron-down-double.svg +3 -0
- package/src/assets/svg/line-arrows-chevron-down.svg +3 -0
- package/src/assets/svg/line-arrows-chevron-right.svg +3 -0
- package/src/assets/svg/line-arrows-chevron-up-double.svg +3 -0
- package/src/assets/svg/line-arrows-chevron-up.svg +3 -0
- package/src/assets/svg/line-arrows-corner-down-right.svg +3 -0
- package/src/assets/svg/line-arrows-expand-3.svg +3 -0
- package/src/assets/svg/line-arrows-refresh-ccw-1.svg +3 -0
- package/src/assets/svg/line-arrows-sort-line-asc.svg +3 -0
- package/src/assets/svg/line-arrows-sort-line-desc.svg +3 -0
- package/src/assets/svg/line-arrows-switch-vertical-1.svg +3 -0
- package/src/assets/svg/line-dev-bug-2.svg +3 -0
- package/src/assets/svg/line-dev-code-square.svg +3 -0
- package/src/assets/svg/line-files-file-attachment-2.svg +3 -0
- package/src/assets/svg/line-general-check.svg +3 -0
- package/src/assets/svg/line-general-checklist3.svg +3 -0
- package/src/assets/svg/line-general-copy-3.svg +3 -0
- package/src/assets/svg/line-general-download-cloud.svg +3 -0
- package/src/assets/svg/line-general-equal.svg +3 -0
- package/src/assets/svg/line-general-home-line.svg +3 -0
- package/src/assets/svg/line-general-link-1.svg +3 -0
- package/src/assets/svg/line-general-link-external.svg +3 -0
- package/src/assets/svg/line-general-search-md.svg +3 -0
- package/src/assets/svg/line-general-settings-1.svg +3 -0
- package/src/assets/svg/line-general-x-close.svg +3 -0
- package/src/assets/svg/line-general-zap.svg +3 -0
- package/src/assets/svg/line-helpers-flag.svg +4 -0
- package/src/assets/svg/line-helpers-play-circle.svg +4 -0
- package/src/assets/svg/line-images-image.svg +3 -0
- package/src/assets/svg/line-security-key.svg +3 -0
- package/src/assets/svg/line-shapes-dot-circle.svg +3 -0
- package/src/assets/svg/line-shapes-moon.svg +3 -0
- package/src/assets/svg/line-shapes-sun.svg +3 -0
- package/src/assets/svg/line-time-clock-stopwatch.svg +3 -0
- package/src/assets/svg/report-logo.svg +64 -0
- package/src/assets/svg/solid-alert-circle.svg +3 -0
- package/src/assets/svg/solid-check-circle.svg +3 -0
- package/src/assets/svg/solid-help-circle.svg +3 -0
- package/src/assets/svg/solid-minus-circle.svg +3 -0
- package/src/assets/svg/solid-x-circle.svg +3 -0
- package/src/assets/svg/spinner.svg +18 -0
- package/src/assets/svg/view-off.svg +12 -0
- package/src/assets/svg/view.svg +11 -0
- package/src/components/app/ArrowButton/index.tsx +36 -0
- package/src/components/app/ArrowButton/styles.scss +32 -0
- package/src/components/app/BaseLayout/index.tsx +60 -0
- package/src/components/app/BaseLayout/styles.scss +60 -0
- package/src/components/app/Footer/FooterLogo.tsx +16 -0
- package/src/components/app/Footer/FooterVersion.tsx +27 -0
- package/src/components/app/Footer/index.tsx +13 -0
- package/src/components/app/Footer/styles.scss +14 -0
- package/src/components/app/Header/index.tsx +17 -0
- package/src/components/app/Header/styles.scss +26 -0
- package/src/components/app/LanguagePicker/index.tsx +41 -0
- package/src/components/app/MainReport/index.tsx +19 -0
- package/src/components/app/Metadata/index.tsx +114 -0
- package/src/components/app/Metadata/styles.scss +146 -0
- package/src/components/app/MetadataButton/index.tsx +33 -0
- package/src/components/app/MetadataButton/styles.scss +53 -0
- package/src/components/app/Modal/index.tsx +184 -0
- package/src/components/app/Modal/styles.scss +126 -0
- package/src/components/app/ReportBody/Filters.tsx +94 -0
- package/src/components/app/ReportBody/HeaderActions.tsx +21 -0
- package/src/components/app/ReportBody/SortBy.tsx +134 -0
- package/src/components/app/ReportBody/context.tsx +107 -0
- package/src/components/app/ReportBody/index.tsx +71 -0
- package/src/components/app/ReportBody/styles.scss +64 -0
- package/src/components/app/ReportHeader/ReportHeaderLabelList.tsx +12 -0
- package/src/components/app/ReportHeader/ReportHeaderLogo.tsx +10 -0
- package/src/components/app/ReportHeader/ReportHeaderPie.tsx +14 -0
- package/src/components/app/ReportHeader/index.tsx +33 -0
- package/src/components/app/ReportHeader/styles.scss +49 -0
- package/src/components/app/ReportLogo/index.tsx +17 -0
- package/src/components/app/ReportLogo/styles.scss +20 -0
- package/src/components/app/ReportLogoFull/index.tsx +21 -0
- package/src/components/app/ReportLogoFull/styles.scss +7 -0
- package/src/components/app/ReportMetadata/MetadataItem.tsx +45 -0
- package/src/components/app/ReportMetadata/MetadataSummary.tsx +79 -0
- package/src/components/app/ReportMetadata/MetadataTestType.tsx +16 -0
- package/src/components/app/ReportMetadata/MetadataWithIcon.tsx +25 -0
- package/src/components/app/ReportMetadata/index.tsx +46 -0
- package/src/components/app/ReportMetadata/styles.scss +99 -0
- package/src/components/app/Tabs/index.tsx +58 -0
- package/src/components/app/Tabs/styles.scss +56 -0
- package/src/components/app/TestResult/TestResultAttachmentsView/index.tsx +27 -0
- package/src/components/app/TestResult/TestResultAttachmentsView/styles.scss +12 -0
- package/src/components/app/TestResult/TestResultDescription/index.tsx +27 -0
- package/src/components/app/TestResult/TestResultDescription/styles.scss +12 -0
- package/src/components/app/TestResult/TestResultDropdown/index.tsx +19 -0
- package/src/components/app/TestResult/TestResultDropdown/styles.scss +34 -0
- package/src/components/app/TestResult/TestResultEmpty/index.tsx +34 -0
- package/src/components/app/TestResult/TestResultEmpty/styles.scss +25 -0
- package/src/components/app/TestResult/TestResultError/index.tsx +51 -0
- package/src/components/app/TestResult/TestResultError/styles.scss +40 -0
- package/src/components/app/TestResult/TestResultHeader/index.tsx +55 -0
- package/src/components/app/TestResult/TestResultHeader/styles.scss +43 -0
- package/src/components/app/TestResult/TestResultHistory/TestResultHistoryItem.tsx +57 -0
- package/src/components/app/TestResult/TestResultHistory/index.tsx +26 -0
- package/src/components/app/TestResult/TestResultHistory/styles.scss +63 -0
- package/src/components/app/TestResult/TestResultInfo/index.tsx +79 -0
- package/src/components/app/TestResult/TestResultInfo/styles.scss +33 -0
- package/src/components/app/TestResult/TestResultLinks/index.tsx +60 -0
- package/src/components/app/TestResult/TestResultLinks/styles.scss +30 -0
- package/src/components/app/TestResult/TestResultMetadata/index.tsx +27 -0
- package/src/components/app/TestResult/TestResultMetadata/styles.scss +8 -0
- package/src/components/app/TestResult/TestResultNavigation/index.tsx +89 -0
- package/src/components/app/TestResult/TestResultNavigation/styles.scss +48 -0
- package/src/components/app/TestResult/TestResultOverview.tsx +40 -0
- package/src/components/app/TestResult/TestResultParameters/index.tsx +30 -0
- package/src/components/app/TestResult/TestResultParameters/styles.scss +8 -0
- package/src/components/app/TestResult/TestResultPrevStatuses/index.tsx +52 -0
- package/src/components/app/TestResult/TestResultPrevStatuses/styles.scss +57 -0
- package/src/components/app/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +50 -0
- package/src/components/app/TestResult/TestResultRetriesView/index.tsx +24 -0
- package/src/components/app/TestResult/TestResultRetriesView/styles.scss +69 -0
- package/src/components/app/TestResult/TestResultSetup/index.tsx +50 -0
- package/src/components/app/TestResult/TestResultSeverity/index.tsx +34 -0
- package/src/components/app/TestResult/TestResultSeverity/styles.scss +29 -0
- package/src/components/app/TestResult/TestResultStatus/index.tsx +26 -0
- package/src/components/app/TestResult/TestResultStatus/styles.scss +36 -0
- package/src/components/app/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx +12 -0
- package/src/components/app/TestResult/TestResultSteps/attachment.tsx +70 -0
- package/src/components/app/TestResult/TestResultSteps/attachmentCode.tsx +15 -0
- package/src/components/app/TestResult/TestResultSteps/attachmentImage.tsx +29 -0
- package/src/components/app/TestResult/TestResultSteps/attachmentVideo.tsx +12 -0
- package/src/components/app/TestResult/TestResultSteps/index.tsx +49 -0
- package/src/components/app/TestResult/TestResultSteps/styles.scss +225 -0
- package/src/components/app/TestResult/TestResultSteps/testResultAttachment.tsx +79 -0
- package/src/components/app/TestResult/TestResultSteps/testResultAttachmentInfo.tsx +87 -0
- package/src/components/app/TestResult/TestResultSteps/testResultStep.tsx +71 -0
- package/src/components/app/TestResult/TestResultSteps/testResultStepInfo.tsx +33 -0
- package/src/components/app/TestResult/TestResultSteps/wrongAttachment.tsx +8 -0
- package/src/components/app/TestResult/TestResultTabs/index.tsx +59 -0
- package/src/components/app/TestResult/TestResultTabs/styles.scss +76 -0
- package/src/components/app/TestResult/TestResultTeardown/index.tsx +49 -0
- package/src/components/app/TestResult/index.tsx +56 -0
- package/src/components/app/ThemeButton/ThemeButton.tsx +22 -0
- package/src/components/app/Tree/Tree.tsx +122 -0
- package/src/components/app/Tree/TreeHeader.tsx +81 -0
- package/src/components/app/Tree/TreeItem.tsx +31 -0
- package/src/components/app/Tree/TreeItemIcon.tsx +35 -0
- package/src/components/app/Tree/index.tsx +40 -0
- package/src/components/app/Tree/styles.scss +170 -0
- package/src/components/commons/Button/index.tsx +176 -0
- package/src/components/commons/Button/styles.scss +558 -0
- package/src/components/commons/Counter/index.tsx +29 -0
- package/src/components/commons/Counter/styles.scss +21 -0
- package/src/components/commons/Label/index.tsx +11 -0
- package/src/components/commons/Label/styles.scss +7 -0
- package/src/components/commons/Link/index.tsx +20 -0
- package/src/components/commons/Link/styles.scss +46 -0
- package/src/components/commons/Loadable/index.tsx +32 -0
- package/src/components/commons/Menu/index.tsx +173 -0
- package/src/components/commons/Menu/styles.scss +94 -0
- package/src/components/commons/PageLoader/index.tsx +10 -0
- package/src/components/commons/PageLoader/styles.scss +29 -0
- package/src/components/commons/SearchBox/index.tsx +61 -0
- package/src/components/commons/SearchBox/styles.scss +58 -0
- package/src/components/commons/Spinner/index.tsx +8 -0
- package/src/components/commons/SuccessRatePieChart/index.tsx +52 -0
- package/src/components/commons/SuccessRatePieChart/styles.scss +12 -0
- package/src/components/commons/SvgIcon/index.tsx +46 -0
- package/src/components/commons/SvgIcon/styles.scss +26 -0
- package/src/components/commons/Toggle/index.tsx +29 -0
- package/src/components/commons/Toggle/styles.scss +48 -0
- package/src/components/commons/Tooltip/index.tsx +123 -0
- package/src/components/commons/Tooltip/styles.scss +38 -0
- package/src/components/commons/Typography/index.tsx +99 -0
- package/src/hooks/useDebouncedCallback.ts +31 -0
- package/src/i18n/constants.ts +105 -0
- package/src/i18n/locales/am.json +115 -0
- package/src/i18n/locales/az.json +115 -0
- package/src/i18n/locales/de.json +115 -0
- package/src/i18n/locales/en.json +115 -0
- package/src/i18n/locales/es.json +114 -0
- package/src/i18n/locales/fr.json +115 -0
- package/src/i18n/locales/he.json +115 -0
- package/src/i18n/locales/it.json +115 -0
- package/src/i18n/locales/ja.json +115 -0
- package/src/i18n/locales/ka.json +115 -0
- package/src/i18n/locales/kr.json +115 -0
- package/src/i18n/locales/nl.json +115 -0
- package/src/i18n/locales/pl.json +113 -0
- package/src/i18n/locales/pt.json +115 -0
- package/src/i18n/locales/ru.json +113 -0
- package/src/i18n/locales/sv.json +115 -0
- package/src/i18n/locales/tr.json +115 -0
- package/src/i18n/locales/zh.json +115 -0
- package/src/index.html +35 -0
- package/src/index.tsx +48 -0
- package/src/stores/chart.ts +32 -0
- package/src/stores/envInfo.ts +34 -0
- package/src/stores/index.ts +4 -0
- package/src/stores/locale.ts +79 -0
- package/src/stores/stats.ts +36 -0
- package/src/stores/testResults.ts +40 -0
- package/src/stores/theme.ts +33 -0
- package/src/stores/tree.ts +33 -0
- package/src/stores/types.ts +5 -0
- package/src/types/globals.d.ts +8 -0
- package/src/types/window.d.ts +8 -0
- package/src/utils/attachments.ts +156 -0
- package/src/utils/capitalize.ts +4 -0
- package/src/utils/copyToClipboard.ts +3 -0
- package/src/utils/isMac.ts +7 -0
- package/src/utils/statuses.ts +55 -0
- package/src/utils/time.ts +17 -0
- package/src/utils/treeFilters.ts +150 -0
- package/tsconfig.json +25 -0
- package/types.d.ts +53 -0
- package/webpack.config.js +108 -0
package/src/index.html
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Allure Awesome</title>
|
|
5
|
+
<base href="http://localhost:8080" />
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<div id="app"></div>
|
|
9
|
+
<script>
|
|
10
|
+
window.allure = window.allure || {};
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
const { origin, pathname } = window.location;
|
|
15
|
+
const url = new URL(pathname, origin);
|
|
16
|
+
const baseEl = document.createElement("base");
|
|
17
|
+
|
|
18
|
+
baseEl.href = url.toString();
|
|
19
|
+
|
|
20
|
+
window.document.head.appendChild(baseEl);
|
|
21
|
+
</script>
|
|
22
|
+
<script>
|
|
23
|
+
window.allureReportOptions = {
|
|
24
|
+
reportName: "Allure Report (Dev)",
|
|
25
|
+
logo: "/data/logo.jpg",
|
|
26
|
+
theme: "light",
|
|
27
|
+
reportLanguage: "ru",
|
|
28
|
+
createdAt: 1731513697651,
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
<script async>
|
|
32
|
+
window.allureReportDataReady = true;
|
|
33
|
+
</script>
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { render } from "preact";
|
|
2
|
+
import "preact/debug";
|
|
3
|
+
import { useEffect, useState } from "preact/hooks";
|
|
4
|
+
import "@/assets/scss/index.scss";
|
|
5
|
+
import { BaseLayout } from "@/components/app/BaseLayout";
|
|
6
|
+
import { isMac } from "@/utils/isMac";
|
|
7
|
+
|
|
8
|
+
const App = () => {
|
|
9
|
+
const [testResultId, setTestResultId] = useState<string>("");
|
|
10
|
+
|
|
11
|
+
const getLocationHashId = () => {
|
|
12
|
+
const hash = globalThis.location.hash;
|
|
13
|
+
const match = hash.match(/[^#/]+$/);
|
|
14
|
+
return match ? match[0] : null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const handleHashChange = () => {
|
|
19
|
+
const id = getLocationHashId();
|
|
20
|
+
setTestResultId(id);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
handleHashChange();
|
|
24
|
+
globalThis.addEventListener("hashchange", handleHashChange);
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
globalThis.removeEventListener("hashchange", handleHashChange);
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
return <BaseLayout testResultId={testResultId} />;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const navigateTo = (path: string) => {
|
|
35
|
+
globalThis.location.hash = path;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const rootElement = document.getElementById("app");
|
|
39
|
+
|
|
40
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
41
|
+
if (isMac) {
|
|
42
|
+
document.documentElement.setAttribute("data-os", "mac");
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
(async () => {
|
|
47
|
+
render(<App />, rootElement);
|
|
48
|
+
})();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
|
+
import { signal } from "@preact/signals";
|
|
3
|
+
import { StoreSignalState } from "@/stores/types";
|
|
4
|
+
|
|
5
|
+
export const pieChartStore = signal<StoreSignalState<any>>({
|
|
6
|
+
loading: true,
|
|
7
|
+
error: undefined,
|
|
8
|
+
data: undefined,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const fetchPieChartData = async () => {
|
|
12
|
+
pieChartStore.value = {
|
|
13
|
+
...pieChartStore.value,
|
|
14
|
+
loading: true,
|
|
15
|
+
error: undefined,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const res = await fetchReportJsonData("widgets/allure_pie_chart.json");
|
|
20
|
+
|
|
21
|
+
pieChartStore.value = {
|
|
22
|
+
data: res,
|
|
23
|
+
error: undefined,
|
|
24
|
+
loading: false
|
|
25
|
+
};
|
|
26
|
+
} catch (err) {
|
|
27
|
+
pieChartStore.value = {
|
|
28
|
+
error: err.message,
|
|
29
|
+
loading: false
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { EnvironmentItem } from "@allurereport/core-api";
|
|
2
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
3
|
+
import { signal } from "@preact/signals";
|
|
4
|
+
import { StoreSignalState } from "@/stores/types";
|
|
5
|
+
|
|
6
|
+
export const envInfoStore = signal<StoreSignalState<EnvironmentItem[]>>({
|
|
7
|
+
loading: false,
|
|
8
|
+
error: undefined,
|
|
9
|
+
data: undefined,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const fetchEnvInfo = async () => {
|
|
13
|
+
envInfoStore.value = {
|
|
14
|
+
...envInfoStore.value,
|
|
15
|
+
loading: true,
|
|
16
|
+
error: undefined,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const res = await fetchReportJsonData<EnvironmentItem[]>("widgets/allure_environment.json");
|
|
21
|
+
|
|
22
|
+
envInfoStore.value = {
|
|
23
|
+
data: res,
|
|
24
|
+
error: undefined,
|
|
25
|
+
loading: false,
|
|
26
|
+
};
|
|
27
|
+
} catch (e) {
|
|
28
|
+
envInfoStore.value = {
|
|
29
|
+
...envInfoStore.value,
|
|
30
|
+
error: e.message,
|
|
31
|
+
loading: false,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { getReportOptions } from "@allurereport/web-commons";
|
|
2
|
+
import { computed, signal } from "@preact/signals";
|
|
3
|
+
import i18next, { type TOptions } from "i18next";
|
|
4
|
+
import { DEFAULT_LOCALE, LANG_LOCALE, type LangLocale } from "@/i18n/constants";
|
|
5
|
+
import type { AllureAwesomeReportOptions } from "../../types.js";
|
|
6
|
+
|
|
7
|
+
const { reportLanguage } = getReportOptions<AllureAwesomeReportOptions>() ?? {};
|
|
8
|
+
|
|
9
|
+
const namespaces = [
|
|
10
|
+
"empty",
|
|
11
|
+
"execution",
|
|
12
|
+
"filters",
|
|
13
|
+
"search",
|
|
14
|
+
"severity",
|
|
15
|
+
"sort-by",
|
|
16
|
+
"sort-by.directions",
|
|
17
|
+
"sort-by.values",
|
|
18
|
+
"statuses",
|
|
19
|
+
"tabs",
|
|
20
|
+
"testSummary",
|
|
21
|
+
"ui",
|
|
22
|
+
"welcome",
|
|
23
|
+
"controls",
|
|
24
|
+
"errors",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export const currentLocale = signal<LangLocale>("en" as LangLocale);
|
|
28
|
+
|
|
29
|
+
export const currentLocaleIso = computed(() => {
|
|
30
|
+
const locale = currentLocale.value;
|
|
31
|
+
|
|
32
|
+
return LANG_LOCALE[locale].iso;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const currentLocaleIsRTL = computed(() => {
|
|
36
|
+
return ["ar", "he", "fa"].includes(currentLocale.value as string);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const getLocale = () => {
|
|
40
|
+
const locale = localStorage.getItem("currentLocale") || reportLanguage || DEFAULT_LOCALE;
|
|
41
|
+
setLocale(locale as LangLocale);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
i18next
|
|
45
|
+
.use({
|
|
46
|
+
type: "backend",
|
|
47
|
+
async read(language: LangLocale, namespace: string, callback: (errorValue: unknown, translations: null) => void) {
|
|
48
|
+
await import(`@/i18n/locales/${language}.json`)
|
|
49
|
+
.then((resources) => {
|
|
50
|
+
callback(null, resources[namespace]);
|
|
51
|
+
})
|
|
52
|
+
.catch((error) => {
|
|
53
|
+
callback(error, null);
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
.init({
|
|
58
|
+
lng: currentLocale.value,
|
|
59
|
+
fallbackLng: "en",
|
|
60
|
+
ns: namespaces,
|
|
61
|
+
interpolation: {
|
|
62
|
+
escapeValue: false,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const useI18n = (namespace?: string) => {
|
|
67
|
+
const t = computed(() => (key: string, options?: TOptions) => i18next.t(key, { ns: namespace, ...options }));
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
t: t.value,
|
|
71
|
+
currentLocale: currentLocale.value,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const setLocale = async (locale: LangLocale) => {
|
|
76
|
+
await i18next.changeLanguage(locale);
|
|
77
|
+
localStorage.setItem("currentLocale", locale);
|
|
78
|
+
currentLocale.value = locale;
|
|
79
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Statistic } from "@allurereport/core-api";
|
|
2
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
3
|
+
import { signal } from "@preact/signals";
|
|
4
|
+
import { StoreSignalState } from "@/stores/types";
|
|
5
|
+
|
|
6
|
+
export const statsStore = signal<StoreSignalState<Statistic>>({
|
|
7
|
+
loading: true,
|
|
8
|
+
error: undefined,
|
|
9
|
+
data: {
|
|
10
|
+
total: 0,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const fetchStats = async () => {
|
|
15
|
+
statsStore.value = {
|
|
16
|
+
...statsStore.value,
|
|
17
|
+
loading: true,
|
|
18
|
+
error: undefined,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
const res = await fetchReportJsonData<Statistic>("widgets/allure_statistic.json");
|
|
23
|
+
|
|
24
|
+
statsStore.value = {
|
|
25
|
+
data: res,
|
|
26
|
+
error: undefined,
|
|
27
|
+
loading: false,
|
|
28
|
+
};
|
|
29
|
+
} catch (err) {
|
|
30
|
+
statsStore.value = {
|
|
31
|
+
data: { total: 0 },
|
|
32
|
+
error: err.message,
|
|
33
|
+
loading: false,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
|
+
import { signal } from "@preact/signals";
|
|
3
|
+
import { type AllureAwesomeTestResult } from "../../types";
|
|
4
|
+
import { type StoreSignalState } from "./types";
|
|
5
|
+
|
|
6
|
+
export const testResultStore = signal<StoreSignalState<Record<string, AllureAwesomeTestResult>>>({
|
|
7
|
+
loading: true,
|
|
8
|
+
error: undefined,
|
|
9
|
+
data: undefined,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const fetchTestResult = async (testResultId: string) => {
|
|
13
|
+
if (!testResultId || testResultStore.value.data?.[testResultId]) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
testResultStore.value = {
|
|
18
|
+
...testResultStore.value,
|
|
19
|
+
loading: true,
|
|
20
|
+
error: undefined,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const data = await fetchReportJsonData<AllureAwesomeTestResult>(
|
|
25
|
+
`data/test-results/${testResultId}.json`,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
testResultStore.value = {
|
|
29
|
+
data: { ...testResultStore.value.data, [testResultId]: data },
|
|
30
|
+
error: undefined,
|
|
31
|
+
loading: false,
|
|
32
|
+
};
|
|
33
|
+
} catch (err) {
|
|
34
|
+
testResultStore.value = {
|
|
35
|
+
...testResultStore.value,
|
|
36
|
+
error: err.message,
|
|
37
|
+
loading: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getReportOptions } from "@allurereport/web-commons";
|
|
2
|
+
import { signal } from "@preact/signals";
|
|
3
|
+
import type { AllureAwesomeReportOptions } from "../../types.js";
|
|
4
|
+
|
|
5
|
+
type Theme = "light" | "dark";
|
|
6
|
+
|
|
7
|
+
const { theme } = getReportOptions<AllureAwesomeReportOptions>() ?? {};
|
|
8
|
+
|
|
9
|
+
export const themeStore = signal<Theme>("light");
|
|
10
|
+
|
|
11
|
+
export const setTheme = (newTheme: Theme): void => {
|
|
12
|
+
themeStore.value = newTheme;
|
|
13
|
+
document.documentElement.setAttribute("data-theme", newTheme);
|
|
14
|
+
window.localStorage.setItem("theme", newTheme);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const toggleTheme = () => {
|
|
18
|
+
setTheme(themeStore.value === "light" ? "dark" : "light");
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getTheme = () => {
|
|
22
|
+
const themeFromLS = (window.localStorage.getItem("theme") as Theme | null) || (theme as Theme);
|
|
23
|
+
|
|
24
|
+
if (themeFromLS) {
|
|
25
|
+
setTheme(themeFromLS);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
30
|
+
const initialTheme = prefersDarkScheme ? "dark" : "light";
|
|
31
|
+
|
|
32
|
+
setTheme(initialTheme);
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
|
+
import { signal } from "@preact/signals";
|
|
3
|
+
import type { StoreSignalState } from "@/stores/types";
|
|
4
|
+
|
|
5
|
+
export const treeStore = signal<StoreSignalState<any>>({
|
|
6
|
+
loading: true,
|
|
7
|
+
error: undefined,
|
|
8
|
+
data: undefined,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const fetchTreeData = async (treeName: string) => {
|
|
12
|
+
treeStore.value = {
|
|
13
|
+
...treeStore.value,
|
|
14
|
+
loading: true,
|
|
15
|
+
error: undefined,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const res = await fetchReportJsonData(`widgets/${treeName}.json`);
|
|
20
|
+
|
|
21
|
+
treeStore.value = {
|
|
22
|
+
data: res,
|
|
23
|
+
error: undefined,
|
|
24
|
+
loading: false,
|
|
25
|
+
};
|
|
26
|
+
} catch (e) {
|
|
27
|
+
treeStore.value = {
|
|
28
|
+
...treeStore.value,
|
|
29
|
+
error: e.message,
|
|
30
|
+
loading: false,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { fetchReportAttachment } from "@allurereport/web-commons";
|
|
2
|
+
|
|
3
|
+
export interface Attachments {
|
|
4
|
+
id?: string;
|
|
5
|
+
ext?: string;
|
|
6
|
+
contentType?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
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 fetchAttachment = async (id: string, ext: string, contentType: string) => {
|
|
16
|
+
if (!id && !ext) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const response = await fetchFromUrl({ id, ext, contentType });
|
|
20
|
+
const fileType = attachmentType(contentType);
|
|
21
|
+
|
|
22
|
+
switch (fileType.type) {
|
|
23
|
+
case "svg":
|
|
24
|
+
case "image": {
|
|
25
|
+
const blob = await response.blob();
|
|
26
|
+
const img = URL.createObjectURL(blob);
|
|
27
|
+
return { img, id };
|
|
28
|
+
}
|
|
29
|
+
case "uri":
|
|
30
|
+
case "code":
|
|
31
|
+
case "html":
|
|
32
|
+
case "table":
|
|
33
|
+
case "text": {
|
|
34
|
+
const text = await response.text();
|
|
35
|
+
return { text };
|
|
36
|
+
}
|
|
37
|
+
case "video": {
|
|
38
|
+
const blob = await response.blob();
|
|
39
|
+
const src = URL.createObjectURL(blob);
|
|
40
|
+
return { src, id, contentType };
|
|
41
|
+
}
|
|
42
|
+
default:
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const blobAttachment = async (id: string, ext: string, contentType: string) => {
|
|
48
|
+
const response = await fetchFromUrl({ id, ext, contentType });
|
|
49
|
+
return await response.blob();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const downloadAttachment = async (id: string, ext: string, contentType: string) => {
|
|
53
|
+
if (!id && !ext) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const fileName = `${id}${ext}`;
|
|
58
|
+
const blob = await blobAttachment(id, ext, contentType);
|
|
59
|
+
const linkUrl = URL.createObjectURL(blob);
|
|
60
|
+
const link = document.createElement("a");
|
|
61
|
+
link.href = linkUrl;
|
|
62
|
+
link.download = fileName;
|
|
63
|
+
link.click();
|
|
64
|
+
URL.revokeObjectURL(linkUrl);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const openAttachmentInNewTab = async (id: string, ext: string, contentType: string) => {
|
|
68
|
+
if (!id && !ext) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const blob = await blobAttachment(id, ext, contentType);
|
|
72
|
+
const linkUrl = URL.createObjectURL(blob);
|
|
73
|
+
globalThis.open(linkUrl, "_blank");
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const attachmentType = (type: string) => {
|
|
77
|
+
switch (type) {
|
|
78
|
+
case "image/bmp":
|
|
79
|
+
case "image/gif":
|
|
80
|
+
case "image/tiff":
|
|
81
|
+
case "image/jpeg":
|
|
82
|
+
case "image/jpg":
|
|
83
|
+
case "image/png":
|
|
84
|
+
case "image/*":
|
|
85
|
+
return {
|
|
86
|
+
type: "image",
|
|
87
|
+
icon: "file",
|
|
88
|
+
};
|
|
89
|
+
case "text/xml":
|
|
90
|
+
case "application/xml":
|
|
91
|
+
case "application/json":
|
|
92
|
+
case "text/json":
|
|
93
|
+
case "text/yaml":
|
|
94
|
+
case "application/yaml":
|
|
95
|
+
case "application/x-yaml":
|
|
96
|
+
case "text/x-yaml":
|
|
97
|
+
case "text/css":
|
|
98
|
+
return {
|
|
99
|
+
type: "code",
|
|
100
|
+
icon: "file",
|
|
101
|
+
};
|
|
102
|
+
case "text/plain":
|
|
103
|
+
case "text/*":
|
|
104
|
+
return {
|
|
105
|
+
type: "text",
|
|
106
|
+
icon: "txt",
|
|
107
|
+
};
|
|
108
|
+
case "text/html":
|
|
109
|
+
return {
|
|
110
|
+
type: "html",
|
|
111
|
+
icon: "file",
|
|
112
|
+
};
|
|
113
|
+
case "text/csv":
|
|
114
|
+
return {
|
|
115
|
+
type: "table",
|
|
116
|
+
icon: "csv",
|
|
117
|
+
};
|
|
118
|
+
case "text/tab-separated-values":
|
|
119
|
+
return {
|
|
120
|
+
type: "table",
|
|
121
|
+
icon: "table",
|
|
122
|
+
};
|
|
123
|
+
case "image/svg+xml":
|
|
124
|
+
return {
|
|
125
|
+
type: "svg",
|
|
126
|
+
icon: "file",
|
|
127
|
+
};
|
|
128
|
+
case "video/mp4":
|
|
129
|
+
case "video/ogg":
|
|
130
|
+
case "video/webm":
|
|
131
|
+
return {
|
|
132
|
+
type: "video",
|
|
133
|
+
icon: "file",
|
|
134
|
+
};
|
|
135
|
+
case "text/uri-list":
|
|
136
|
+
return {
|
|
137
|
+
type: "uri",
|
|
138
|
+
icon: "list",
|
|
139
|
+
};
|
|
140
|
+
case "application/x-tar":
|
|
141
|
+
case "application/x-gtar":
|
|
142
|
+
case "application/x-bzip2":
|
|
143
|
+
case "application/gzip":
|
|
144
|
+
case "application/zip":
|
|
145
|
+
return {
|
|
146
|
+
type: "archive",
|
|
147
|
+
icon: "file",
|
|
148
|
+
};
|
|
149
|
+
default:
|
|
150
|
+
return {
|
|
151
|
+
type: null,
|
|
152
|
+
icon: "file",
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
export const restrictedContentTypes = ["application/gzip"];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { DefaultTreeGroup, DefaultTreeLeaf, TestStatus, TreeData } from "@allurereport/core-api";
|
|
2
|
+
|
|
3
|
+
export type Stats = Record<TestStatus, number> & { total?: number };
|
|
4
|
+
|
|
5
|
+
const emptyStat: Stats = { failed: 0, broken: 0, passed: 0, skipped: 0, unknown: 0 };
|
|
6
|
+
|
|
7
|
+
const statisticByIds = (tree: TreeData<DefaultTreeLeaf, DefaultTreeGroup>, ids: string[]): Stats => {
|
|
8
|
+
return ids
|
|
9
|
+
.map((id) => tree.leavesById[id])
|
|
10
|
+
.filter((v) => v)
|
|
11
|
+
.reduce(
|
|
12
|
+
(prev, current) => {
|
|
13
|
+
prev[current.status]++;
|
|
14
|
+
return prev;
|
|
15
|
+
},
|
|
16
|
+
{ ...emptyStat },
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const mergeStats = (stat1: Stats, stat2: Stats): Stats => {
|
|
21
|
+
Object.keys(stat1).forEach((key) => {
|
|
22
|
+
stat1[key as TestStatus] += stat2[key as TestStatus];
|
|
23
|
+
});
|
|
24
|
+
return stat1;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const getGroupStatistics = (
|
|
28
|
+
tree: TreeData<DefaultTreeLeaf, DefaultTreeGroup>,
|
|
29
|
+
groupId: string,
|
|
30
|
+
statusFilter?: string,
|
|
31
|
+
): Stats => {
|
|
32
|
+
const group = tree.groupsById[groupId];
|
|
33
|
+
let stat: Stats = { ...emptyStat };
|
|
34
|
+
|
|
35
|
+
if (group?.leaves?.length) {
|
|
36
|
+
stat = mergeStats(stat, statisticByIds(tree, group.leaves));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (group?.groups?.length) {
|
|
40
|
+
for (const subGroupId of group.groups) {
|
|
41
|
+
const subGroupStat = getGroupStatistics(tree, subGroupId, statusFilter);
|
|
42
|
+
stat = mergeStats(stat, subGroupStat);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return stat;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const getStatistics = (tree: TreeData<DefaultTreeLeaf, DefaultTreeGroup>) =>
|
|
50
|
+
tree.root.groups
|
|
51
|
+
?.map((groupId) => {
|
|
52
|
+
const stat = getGroupStatistics(tree, groupId);
|
|
53
|
+
return { name: tree.groupsById[groupId].name, statistic: stat };
|
|
54
|
+
})
|
|
55
|
+
?.sort((a, b) => a.name.localeCompare(b.name)) ?? [];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useI18n } from "@/stores/locale";
|
|
2
|
+
|
|
3
|
+
const defaultOptions: Intl.DateTimeFormatOptions = {
|
|
4
|
+
month: "numeric",
|
|
5
|
+
day: "numeric",
|
|
6
|
+
year: "numeric",
|
|
7
|
+
hour: "numeric",
|
|
8
|
+
minute: "numeric",
|
|
9
|
+
second: "numeric",
|
|
10
|
+
hour12: false,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const timestampToDate = (timestamp: number, options = defaultOptions) => {
|
|
14
|
+
const date = new Date(timestamp);
|
|
15
|
+
const { t } = useI18n("ui");
|
|
16
|
+
return new Intl.DateTimeFormat("en-US", options).format(date).replace(",", ` ${t("at")}`);
|
|
17
|
+
};
|