From 45eb29468cd9335286e7f8953e75440ce5193de8 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Mon, 15 Jul 2024 16:32:44 +0200 Subject: [PATCH] Bug 1907907 - correctly set the folder path for button to filter tasks by test manifest --- tests/ui/mock/bug_suggestions.json | 12 +++++++ tests/ui/shared/FailureSummaryTab_test.jsx | 34 +++++++++++++++++++ .../failureSummary/SuggestionsListItem.jsx | 2 +- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/tests/ui/mock/bug_suggestions.json b/tests/ui/mock/bug_suggestions.json index 721c24a3cde..7090828a1c0 100644 --- a/tests/ui/mock/bug_suggestions.json +++ b/tests/ui/mock/bug_suggestions.json @@ -83,5 +83,17 @@ "search_terms": ["Got 1 unexpected statuses"], "path_end": null, "bugs": { "open_recent": [], "all_others": [] } + }, + { + "search": "TEST-UNEXPECTED-CRASH | /trusted-types/WorkerGlobalScope-eval.html | expected OK", + "search_terms": ["WorkerGlobalScope-eval.html"], + "path_end": "/trusted-types/WorkerGlobalScope-eval.html", + "bugs": { "open_recent": [], "all_others": [] } + }, + { + "search": "TEST-UNEXPECTED-CRASH | /css/css-break/hit-test-inline-fragmentation-with-border-radius.html | expected OK", + "search_terms": ["hit-test-inline-fragmentation-with-border-radius.html"], + "path_end": "/css/css-break/hit-test-inline-fragmentation-with-border-radius.html", + "bugs": { "open_recent": [], "all_others": [] } } ] diff --git a/tests/ui/shared/FailureSummaryTab_test.jsx b/tests/ui/shared/FailureSummaryTab_test.jsx index f67bcc84c23..d004a67df8c 100644 --- a/tests/ui/shared/FailureSummaryTab_test.jsx +++ b/tests/ui/shared/FailureSummaryTab_test.jsx @@ -124,4 +124,38 @@ describe('FailureSummaryTab', () => { '1725749', ); }); + + test('filter by test path contains folder path (one level depth)', async () => { + /* For web platform tests, the test manifest does not necessarily only + contain one test folder but can contain subfolders. + Support for this has not been implemented and the whole test path is + supposed to be set as filter. */ + render(testFailureSummaryTab(), { + legacyRoot: true, + }); + + await waitFor(() => + screen.getByTitle('Filter by test path: trusted-types/'), + ); + expect( + screen.getByTitle('Filter by test path: trusted-types/'), + ).toBeInTheDocument(); + }); + + test('filter by test path contains folder path (multiple level depth)', async () => { + /* For web platform tests, the test manifest does not necessarily only + contain one test folder but can contain subfolders. + Support for this has not been implemented and the whole test path is + supposed to be set as filter. */ + render(testFailureSummaryTab(), { + legacyRoot: true, + }); + + await waitFor(() => + screen.getByTitle('Filter by test path: css/css-break/'), + ); + expect( + screen.getByTitle('Filter by test path: css/css-break/'), + ).toBeInTheDocument(); + }); }); diff --git a/ui/shared/tabs/failureSummary/SuggestionsListItem.jsx b/ui/shared/tabs/failureSummary/SuggestionsListItem.jsx index d424c3fe9b5..2333ef890fc 100644 --- a/ui/shared/tabs/failureSummary/SuggestionsListItem.jsx +++ b/ui/shared/tabs/failureSummary/SuggestionsListItem.jsx @@ -131,7 +131,7 @@ export default class SuggestionsListItem extends React.Component { , ); } - const filterTestPath = suggestion.search.match(/([a-z_\\-s0-9.]+[/])+/gi); + const filterTestPath = suggestion.search.match(/([a-z_\-0-9]+[/])+/gi); return (