Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] [JF] Fix selectfilter method #1315

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];

Expand All @@ -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
);
Expand Down Expand Up @@ -153,7 +153,7 @@ describe(

after("Perform test data clean up", function () {
deleteByList(applicationsList);
deleteByList(businessservicesList);
deleteByList(businessServicesList);
deleteByList(tagList);
deleteByList(stakeholders);
});
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/views/common.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']";

Expand Down
26 changes: 20 additions & 6 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,18 @@ 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 {
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")
.eq(eq)
.within(() => {
cy.get("#filtered-by").click();
abrugaro marked this conversation as resolved.
Show resolved Hide resolved
clickWithinByText('div[class="pf-v5-c-menu__content"]', "button", filterName);
});
}

export function filterInputText(searchTextValue: string, value: number): void {
Expand Down Expand Up @@ -462,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);
Expand All @@ -478,9 +492,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];
Expand Down
Loading