From 0b327712b1515aa5fcaee8a157fe50b865ff1c1f Mon Sep 17 00:00:00 2001 From: Ivan Nejezchleb Date: Thu, 20 Jun 2024 14:21:01 +0200 Subject: [PATCH] fix: adapt e2e test to new dom JIRA: LX-183 risk: low --- .../cypress/tools/attributeFilterButton.ts | 7 +++++-- libs/sdk-ui-tests-e2e/cypress/tools/filterBar.ts | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/libs/sdk-ui-tests-e2e/cypress/tools/attributeFilterButton.ts b/libs/sdk-ui-tests-e2e/cypress/tools/attributeFilterButton.ts index 49c7714ab3d..8fba6a0b1b9 100644 --- a/libs/sdk-ui-tests-e2e/cypress/tools/attributeFilterButton.ts +++ b/libs/sdk-ui-tests-e2e/cypress/tools/attributeFilterButton.ts @@ -1,4 +1,5 @@ // (C) 2022-2024 GoodData Corporation +import { camelCase } from "lodash"; export class AttributeFilterButton { private attributeFilterUniqueSelector; @@ -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; } diff --git a/libs/sdk-ui-tests-e2e/cypress/tools/filterBar.ts b/libs/sdk-ui-tests-e2e/cypress/tools/filterBar.ts index aa7c91462dc..5c42559e099 100644 --- a/libs/sdk-ui-tests-e2e/cypress/tools/filterBar.ts +++ b/libs/sdk-ui-tests-e2e/cypress/tools/filterBar.ts @@ -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"; @@ -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; } @@ -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; }