@allurereport/plugin-api
Advanced tools
+1
-0
@@ -15,2 +15,3 @@ import type { AttachmentLink, HistoryDataPoint, HistoryTestResult, KnownTestFailure, ReportVariables, Statistic, TestCase, TestEnvGroup, TestError, TestFixtureResult, TestResult } from "@allurereport/core-api"; | ||
| allHistoryDataPoints: () => Promise<HistoryDataPoint[]>; | ||
| allHistoryDataPointsByEnvironment: (environment: string) => Promise<HistoryDataPoint[]>; | ||
| allKnownIssues: () => Promise<KnownTestFailure[]>; | ||
@@ -17,0 +18,0 @@ allNewTestResults: () => Promise<TestResult[]>; |
@@ -12,1 +12,2 @@ import { type Comparator, type DefaultTreeGroup, type DefaultTreeLeaf, type TestResult, type TreeData, type TreeGroup, type TreeLeaf } from "@allurereport/core-api"; | ||
| export declare const createTreeByTitlePath: <T = TestResult, L = DefaultTreeLeaf, G = DefaultTreeGroup>(data: T[], leafFactory?: (item: T) => TreeLeaf<L>, groupFactory?: (parentGroup: string | undefined, groupClassifier: string) => TreeGroup<G>, addLeafToGroup?: (group: TreeGroup<G>, leaf: TreeLeaf<L>) => void) => TreeData<L, G>; | ||
| export declare const createTreeByLabelsAndTitlePath: <T = TestResult, L = DefaultTreeLeaf, G = DefaultTreeGroup>(data: T[], labelNames?: string[], leafFactory?: (item: T) => TreeLeaf<L>, groupFactory?: (parentGroup: string | undefined, groupClassifier: string) => TreeGroup<G>, addLeafToGroup?: (group: TreeGroup<G>, leaf: TreeLeaf<L>) => void) => TreeData<L, G>; |
+36
-0
@@ -219,1 +219,37 @@ import { findByLabelName, } from "@allurereport/core-api"; | ||
| }; | ||
| const byLabelsAndTitlePath = (item, labelNames) => { | ||
| const leaves = []; | ||
| for (const labelName of labelNames) { | ||
| const values = item.labels.filter((label) => label.name === labelName).map((label) => label.value ?? ""); | ||
| if (!values.length) { | ||
| continue; | ||
| } | ||
| leaves.push(values); | ||
| } | ||
| const titlePath = item.titlePath; | ||
| if (Array.isArray(titlePath) && titlePath.length > 0) { | ||
| for (const segment of titlePath) { | ||
| leaves.push([segment]); | ||
| } | ||
| } | ||
| return leaves; | ||
| }; | ||
| export const createTreeByLabelsAndTitlePath = (data, labelNames = [], leafFactory, groupFactory, addLeafToGroup = () => { }) => { | ||
| const leafFactoryFn = leafFactory ?? | ||
| ((tr) => { | ||
| const { id, name, status, duration } = tr; | ||
| return { | ||
| nodeId: id, | ||
| name, | ||
| status, | ||
| duration, | ||
| }; | ||
| }); | ||
| const groupFactoryFn = groupFactory ?? | ||
| ((parentId, groupClassifier) => ({ | ||
| nodeId: md5((parentId ? `${parentId}.` : "") + groupClassifier), | ||
| name: groupClassifier, | ||
| statistic: emptyStatistic(), | ||
| })); | ||
| return createTree(data, (item) => byLabelsAndTitlePath(item, labelNames), leafFactoryFn, groupFactoryFn, addLeafToGroup); | ||
| }; |
+2
-2
| { | ||
| "name": "@allurereport/plugin-api", | ||
| "version": "3.0.0-beta.23", | ||
| "version": "3.0.0-beta.24", | ||
| "description": "Allure Plugin API", | ||
@@ -29,3 +29,3 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@allurereport/core-api": "3.0.0-beta.23" | ||
| "@allurereport/core-api": "3.0.0-beta.24" | ||
| }, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
26476
7.19%554
7.57%+ Added
- Removed