diff --git a/allure-generator/src/main/javascript/features/tree/model/filter.mts b/allure-generator/src/main/javascript/features/tree/model/filter.mts index c08f9ecde..698852294 100644 --- a/allure-generator/src/main/javascript/features/tree/model/filter.mts +++ b/allure-generator/src/main/javascript/features/tree/model/filter.mts @@ -40,6 +40,8 @@ const byText = (text?: string): TreeFilter => { return ( !normalizedText || String(child.name).toLowerCase().indexOf(normalizedText) > -1 || + (typeof child.searchPath === "string" && + child.searchPath.toLowerCase().indexOf(normalizedText) > -1) || Boolean(child.children?.some(byText(normalizedText))) ); }; diff --git a/allure-generator/src/main/javascript/features/tree/model/treeData.mts b/allure-generator/src/main/javascript/features/tree/model/treeData.mts index 31345a691..33f378bd1 100644 --- a/allure-generator/src/main/javascript/features/tree/model/treeData.mts +++ b/allure-generator/src/main/javascript/features/tree/model/treeData.mts @@ -149,21 +149,25 @@ const createLeafOrderMap = (children: TreeNode[] = []) => { return new Map(sortedLeaves.map((leaf, index) => [leaf, index + 1])); }; -const normalizeNodes = (children: TreeNode[] = []): TreeNode[] => { +const normalizeNodes = (children: TreeNode[] = [], parentPath = ""): TreeNode[] => { const leafOrders = createLeafOrderMap(children); return children.map((child) => { + const searchPath = [parentPath, child.name].filter(Boolean).join("."); + if (!child.children) { return { ...child, + searchPath, order: leafOrders.get(child), }; } - const normalizedChildren = normalizeNodes(child.children); + const normalizedChildren = normalizeNodes(child.children, searchPath); return { ...child, + searchPath, children: normalizedChildren, statistic: calculateStatistic(normalizedChildren), time: calculateTime(normalizedChildren), diff --git a/allure-generator/src/main/javascript/types/report.mts b/allure-generator/src/main/javascript/types/report.mts index 8b858e058..3771ed8ff 100644 --- a/allure-generator/src/main/javascript/types/report.mts +++ b/allure-generator/src/main/javascript/types/report.mts @@ -99,6 +99,7 @@ export type TestResult = { export type TreeNode = { name?: string; + searchPath?: string; uid?: string; parentUid?: string; status?: Status; diff --git a/allure-generator/tests/e2e/support/fixtures.mts b/allure-generator/tests/e2e/support/fixtures.mts index c2220b7f7..c81f7d013 100644 --- a/allure-generator/tests/e2e/support/fixtures.mts +++ b/allure-generator/tests/e2e/support/fixtures.mts @@ -40,6 +40,8 @@ export const fixtures = { packages: { root: "io.qameta.allure", className: "PullRequestsWebTest", + methodName: "shouldClosePullRequest", + pathQuery: "qameta.allure.PullRequestsWebTest.shouldClose", }, widgets: { behaviors: "Features by stories", diff --git a/allure-generator/tests/e2e/tree.shared.spec.mts b/allure-generator/tests/e2e/tree.shared.spec.mts index aec3dc5f2..aa93ed907 100644 --- a/allure-generator/tests/e2e/tree.shared.spec.mts +++ b/allure-generator/tests/e2e/tree.shared.spec.mts @@ -23,6 +23,11 @@ for (const mode of reportModes) { await searchInput.fill("tag:sm"); await expect(page.locator(".tree__empty")).toHaveText("There are no items"); + await searchInput.fill("allure.PullRequestsWebTest"); + await expect( + page.locator(".node__leaf", { hasText: uiDemo.cases.failedPullRequest }), + ).toBeVisible(); + await searchInput.fill(uiDemo.cases.failedPullRequest); await expect( page.locator(".node__leaf", { hasText: uiDemo.cases.failedPullRequest }), @@ -133,6 +138,19 @@ for (const mode of reportModes) { await groupLocator(page, uiDemo.packages.root).locator(":scope > .node__title").click(); await expect(groupLocator(page, uiDemo.packages.className)).toBeVisible(); await expect(page.locator(".tree__download")).toHaveCount(0); + + const packagesSearchInput = page.locator(".search__input"); + await packagesSearchInput.fill(uiDemo.packages.pathQuery); + await expect(groupLocator(page, uiDemo.packages.className)).toBeVisible(); + await expect( + page.locator(".node__leaf", { hasText: uiDemo.packages.methodName }), + ).toBeVisible(); + + await packagesSearchInput.fill(uiDemo.packages.root); + await expect( + page.locator(".node__leaf", { hasText: uiDemo.packages.methodName }), + ).toBeVisible(); + await packagesSearchInput.fill(""); }); test("collapsed groups stay collapsed when selecting leaves in other groups", async ({