From c527d11d06979adc8a40b0c5527aaab12977d684 Mon Sep 17 00:00:00 2001 From: Alejandro Brugarolas Date: Mon, 20 Jan 2025 11:36:23 +0100 Subject: [PATCH 1/4] fix selectfilter method Signed-off-by: Alejandro Brugarolas --- .../migration-waves/filter_applications.test.ts | 8 ++++---- cypress/e2e/views/common.view.ts | 1 - cypress/utils/utils.ts | 14 +++++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cypress/e2e/tests/migration/migration-waves/filter_applications.test.ts b/cypress/e2e/tests/migration/migration-waves/filter_applications.test.ts index f418b75a9..1917184ab 100644 --- a/cypress/e2e/tests/migration/migration-waves/filter_applications.test.ts +++ b/cypress/e2e/tests/migration/migration-waves/filter_applications.test.ts @@ -44,7 +44,7 @@ const end = new Date(now.getTime()); end.setFullYear(end.getFullYear() + 1); let applicationsList: Application[] = []; -let businessservicesList: BusinessServices[] = []; +let businessServicesList: BusinessServices[] = []; let tagList: Tag[] = []; let stakeholders: Stakeholders[] = []; @@ -56,12 +56,12 @@ describe( before("Login and Create Test Data", function () { login(); - businessservicesList = createMultipleBusinessServices(2); + businessServicesList = createMultipleBusinessServices(2); tagList = createMultipleTags(2); stakeholders = createMultipleStakeholders(2); applicationsList = createMultipleApplicationsWithBSandTags( 2, - businessservicesList, + businessServicesList, tagList, stakeholders ); @@ -153,7 +153,7 @@ describe( after("Perform test data clean up", function () { deleteByList(applicationsList); - deleteByList(businessservicesList); + deleteByList(businessServicesList); deleteByList(tagList); deleteByList(stakeholders); }); diff --git a/cypress/e2e/views/common.view.ts b/cypress/e2e/views/common.view.ts index da01fc665..10b609266 100644 --- a/cypress/e2e/views/common.view.ts +++ b/cypress/e2e/views/common.view.ts @@ -35,7 +35,6 @@ export const alertTitle = "h4[class*='alert__title']"; export const appTable = ".pf-v5-c-table"; export const expandableRow = ".pf-c-expandable-row"; export const helper = "span.pf-v5-c-helper-text__item-text"; -export const filterToggleButton = "div.pf-c-dropdown > button.pf-c-dropdown__toggle"; export const filterInput = "input[type='search']"; export const inputText = "input[type='text']"; diff --git a/cypress/utils/utils.ts b/cypress/utils/utils.ts index ef8afdad3..886931669 100644 --- a/cypress/utils/utils.ts +++ b/cypress/utils/utils.ts @@ -392,9 +392,13 @@ export function notExists(value: string, tableSelector = appTable): void { }); } -export function selectFilter(filterName: string): void { - cy.get("#filtered-by").click(); - clickWithinByText('div[class="pf-v5-c-menu__content"]', "button", filterName); +export function selectFilter(filterName: string, eq = 0): void { + cy.get("div.pf-m-filter-group") + .eq(eq) + .within(() => { + cy.get("#filtered-by").click(); + clickWithinByText('div[class="pf-v5-c-menu__content"]', "button", filterName); + }); } export function filterInputText(searchTextValue: string, value: number): void { @@ -478,9 +482,9 @@ export function applySearchFilter( filterName: string, searchText: string | string[], identifiedRisk = false, - value?: number + eq = 0 ): void { - selectFilter(filterName, identifiedRisk, value); + selectFilter(filterName, eq); let filterValue = []; if (!Array.isArray(searchText)) { filterValue = [searchText]; From 30faacf793063a496a6b89829761d7e6445a0083 Mon Sep 17 00:00:00 2001 From: Alejandro Brugarolas Date: Mon, 20 Jan 2025 12:38:28 +0100 Subject: [PATCH 2/4] fix pr Signed-off-by: Alejandro Brugarolas --- cypress/utils/utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cypress/utils/utils.ts b/cypress/utils/utils.ts index 886931669..62ea25e68 100644 --- a/cypress/utils/utils.ts +++ b/cypress/utils/utils.ts @@ -393,6 +393,10 @@ export function notExists(value: string, tableSelector = appTable): void { } export function selectFilter(filterName: string, eq = 0): void { + if (eq === 0) { + cy.get("#filtered-by").click(); + return; + } cy.get("div.pf-m-filter-group") .eq(eq) .within(() => { From 8d6f2cc1d77229b2805e5716ee9cba156b10c29b Mon Sep 17 00:00:00 2001 From: Alejandro Brugarolas Date: Mon, 20 Jan 2025 16:47:32 +0100 Subject: [PATCH 3/4] fix pr Signed-off-by: Alejandro Brugarolas --- cypress/utils/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cypress/utils/utils.ts b/cypress/utils/utils.ts index 62ea25e68..1d4579e98 100644 --- a/cypress/utils/utils.ts +++ b/cypress/utils/utils.ts @@ -395,6 +395,7 @@ export function notExists(value: string, tableSelector = appTable): void { export function selectFilter(filterName: string, eq = 0): void { if (eq === 0) { cy.get("#filtered-by").click(); + clickWithinByText('div[class="pf-v5-c-menu__content"]', "button", filterName); return; } cy.get("div.pf-m-filter-group") @@ -470,7 +471,12 @@ export function validateSingleApplicationIssue(issue: AppIssue): void { }); } -export function applySelectFilter(filterId, filterName, filterText, isValid = true): void { +export function applySelectFilter( + filterId: string, + filterName, + filterText: string, + isValid = true +): void { selectFilter(filterName); click(".pf-v5-c-menu-toggle__button"); inputText(".pf-v5-c-text-input-group__text-input", filterText); From b0815f61959e19d40bf1d79de15e6c95d3ed84ac Mon Sep 17 00:00:00 2001 From: Alejandro Brugarolas Date: Tue, 21 Jan 2025 09:55:55 +0100 Subject: [PATCH 4/4] fix pr Signed-off-by: Alejandro Brugarolas --- cypress/e2e/views/common.view.ts | 1 + cypress/utils/utils.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/views/common.view.ts b/cypress/e2e/views/common.view.ts index 10b609266..25818dd0f 100644 --- a/cypress/e2e/views/common.view.ts +++ b/cypress/e2e/views/common.view.ts @@ -25,6 +25,7 @@ export const removeButton = "button[aria-label='Remove']"; export const clearAllButton = "button[aria-label='Clear all']"; export const controlsForm = "form.pf-v5-c-form"; export const itemsPerPageMenu = "div.pf-c-options-menu"; +export const filteredBy = "#filtered-by"; export const itemsPerPageMenuOptions = "ul.pf-v5-c-menu__list"; export const expandRow = "button[aria-label=Details]"; export const successAlertMessage = ".pf-m-success"; diff --git a/cypress/utils/utils.ts b/cypress/utils/utils.ts index 1d4579e98..2609374f6 100644 --- a/cypress/utils/utils.ts +++ b/cypress/utils/utils.ts @@ -72,6 +72,7 @@ import { expandableRow, expandRow, filterDropDownContainer, + filteredBy, filterInput, firstPageButton, itemsPerPageMenuOptions, @@ -394,14 +395,14 @@ export function notExists(value: string, tableSelector = appTable): void { export function selectFilter(filterName: string, eq = 0): void { if (eq === 0) { - cy.get("#filtered-by").click(); + cy.get(filteredBy).click(); clickWithinByText('div[class="pf-v5-c-menu__content"]', "button", filterName); return; } cy.get("div.pf-m-filter-group") .eq(eq) .within(() => { - cy.get("#filtered-by").click(); + cy.get(filteredBy).click(); clickWithinByText('div[class="pf-v5-c-menu__content"]', "button", filterName); }); }