Skip to content

Commit

Permalink
fix: adapt e2e test to new dom
Browse files Browse the repository at this point in the history
JIRA: LX-183
risk: low
  • Loading branch information
ivan-nejezchleb committed Jun 20, 2024
1 parent 227a381 commit 0b32771
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 5 additions & 2 deletions libs/sdk-ui-tests-e2e/cypress/tools/attributeFilterButton.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// (C) 2022-2024 GoodData Corporation
import { camelCase } from "lodash";
export class AttributeFilterButton {
private attributeFilterUniqueSelector;

Expand Down Expand Up @@ -100,12 +101,14 @@ export class AttributeFilterButton {
this.searchElements(attributeValue);
if (only) {
this.getDropdownElement()
.find(`.s-attribute-filter-list-item[title="${attributeValue}"] .gd-list-item-only`)
.find(`.s-attribute-filter-list-item-${camelCase(attributeValue)} .gd-list-item-only`)
.invoke("show")
.click();
return this;
}
this.getDropdownElement().find(`.s-attribute-filter-list-item[title="${attributeValue}"]`).click();
this.getDropdownElement()
.find(`.s-attribute-filter-list-item-${camelCase(attributeValue)}`)
.click();
return this;
}

Expand Down
11 changes: 8 additions & 3 deletions libs/sdk-ui-tests-e2e/cypress/tools/filterBar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// (C) 2021-2024 GoodData Corporation
import { DashboardAttributeFilterConfigMode, DashboardDateFilterConfigMode } from "@gooddata/sdk-model";
import camelCase from "lodash/camelCase";
import { getTestClassByTitle } from "../support/commands/tools/classes";
import { DropZone } from "./enum/DropZone";
import { DateFilter } from "./dateFilter";
Expand Down Expand Up @@ -62,7 +63,9 @@ export class AttributeFilter {

selectAttributesWithoutApply(name?: string) {
this.clearAllValues();
this.getDropdownElement().find(`.s-attribute-filter-list-item[title="${name}"]`).click();
this.getDropdownElement()
.find(`.s-attribute-filter-list-item-${camelCase(name)}`)
.click();
return this;
}

Expand Down Expand Up @@ -198,14 +201,16 @@ export class AttributeFilter {

isValueSelected(attributeValue: string, expected: boolean) {
this.getDropdownElement()
.find(`.s-attribute-filter-list-item[title="${attributeValue}"]`)
.find(`.s-attribute-filter-list-item-${camelCase(attributeValue)}`)
.should(expected ? "have.class" : "not.have.class", "s-attribute-filter-list-item-selected");
return this;
}

searchAndSelectFilterItem(attributeValue: string) {
this.search(attributeValue);
this.getDropdownElement().find(`.s-attribute-filter-list-item[title="${attributeValue}"]`).click();
this.getDropdownElement()
.find(`.s-attribute-filter-list-item-${camelCase(attributeValue)}`)
.click();
return this;
}

Expand Down

0 comments on commit 0b32771

Please sign in to comment.