From 7bc13cc766cb95f1fa22f1e3de837a40d0ea6827 Mon Sep 17 00:00:00 2001 From: sgauruseu Date: Tue, 1 Oct 2024 09:41:16 +0300 Subject: [PATCH] new ui-tests for aggregation issue #7908 --- testing/libs/elements.js | 5 +- .../browsepanel/content.filter.panel.js | 15 ++++++ testing/specs/misc/filtering.by.owner.spec.js | 49 +++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) diff --git a/testing/libs/elements.js b/testing/libs/elements.js index 2458071fd8..4b50a6c68b 100644 --- a/testing/libs/elements.js +++ b/testing/libs/elements.js @@ -45,7 +45,7 @@ module.exports = Object.freeze({ }, COMBOBOX: { MODE_TOGGLER_BUTTON: "//button[contains(@id,'ModeTogglerButton')]", - APPLY_SELECTION_BUTTON:"//button[contains(@class,'apply-selection-button')]", + APPLY_SELECTION_BUTTON: "//button[contains(@class,'apply-selection-button')]", }, INPUTS: { TEXT_INPUT: "//input[@type='text']", @@ -103,6 +103,9 @@ module.exports = Object.freeze({ return container + `//li[contains(@id,'ContentListElement') and descendant::p[contains(@class,'sub-name') and contains(.,'${name}')]]`; }, + listItemByDisplayName: (itemName) => { + return `//li[contains(@class,'item-view-wrapper') and descendant::h6[contains(.,'${itemName}')]]` + }, // clickable option in dropdown options list dropdownListItemByDisplayName: (container, displayName) => { return container + diff --git a/testing/page_objects/browsepanel/content.filter.panel.js b/testing/page_objects/browsepanel/content.filter.panel.js index b865d3fedb..8901b2549b 100644 --- a/testing/page_objects/browsepanel/content.filter.panel.js +++ b/testing/page_objects/browsepanel/content.filter.panel.js @@ -344,6 +344,21 @@ class BrowseFilterPanel extends Page { await filterableListBox.clickOnDropdownHandle(XPATH.lastModifiedByAggregationGroupView); } + async isCheckedInLastModifiedByListOptions(userName) { + let locator = XPATH.lastModifiedByAggregationGroupView + lib.DROPDOWN_SELECTOR.listItemByDisplayName(userName) + + lib.CHECKBOX_INPUT; + let chElement = await this.findElements(locator); + return await chElement[0].isSelected(); + } + + async uncheckItemInLastModifiedByListBox(userName) { + let locator = XPATH.lastModifiedByAggregationGroupView + lib.DROPDOWN_SELECTOR.listItemByDisplayName(userName); + let chElement = await this.findElements(locator); + await chElement[0].click(); + let filterableListBox = new FilterableListBox(); + await filterableListBox.clickOnApplySelectionButton(XPATH.lastModifiedByAggregationGroupView); + } + // Selects an option in 'Last Modified By' dropdown: async filterAndSelectLastModifiedByOption(userName) { try { diff --git a/testing/specs/misc/filtering.by.owner.spec.js b/testing/specs/misc/filtering.by.owner.spec.js index 3d3fdde561..d02d44743f 100644 --- a/testing/specs/misc/filtering.by.owner.spec.js +++ b/testing/specs/misc/filtering.by.owner.spec.js @@ -119,6 +119,55 @@ describe('filter.by.owner.spec: tests for filtering by', function () { let contentNames = await contentBrowsePanel.getDisplayNamesInGrid(); assert.ok(contentNames.includes(FOLDER.displayName)); assert.equal(contentNames.length, 3, 'Only three items should be present in the grid'); + + await studioUtils.doCloseAllWindowTabsAndSwitchToHome(); + await studioUtils.doLogout(); + }); + + it("GIVEN 'Last Modified by' selector is expanded WHEN checkbox for the user has been unchecked in List Options THEN 'Clear Filter' icon gets not visible", + async () => { + let filterPanel = new FilterPanel(); + let contentBrowsePanel = new ContentBrowsePanel(); + // 1. SU is logged in: + await studioUtils.navigateToContentStudioApp('su', 'password'); + // 2. Open 'Filter Panel' + await studioUtils.openFilterPanel(); + // 3. Select the existing user in 'Last Modified by' dropdown selector: + await filterPanel.filterAndSelectLastModifiedByOption(USER.displayName); + // 4. Expand the dropdown + await filterPanel.clickOnLastModifiedByDropdownHandle(); + // 5. Verify that the checkbox is checked: + let isChecked = await filterPanel.isCheckedInLastModifiedByListOptions(USER.displayName); + assert.ok(isChecked, "This checkbox should be checked in the dropdown"); + await studioUtils.saveScreenshot('modified_by_selected_dropdown_expanded'); + // 6. Uncheck the checkbox in the lidy-options: + await filterPanel.uncheckItemInLastModifiedByListBox(USER.displayName); + // 7. Verify that 'Clear Filter' icon is not visible in Filter Panel ( top right) + await filterPanel.waitForClearLinkNotDisplayed(); + + await studioUtils.doCloseAllWindowTabsAndSwitchToHome(); + await studioUtils.doLogout(); + }); + + it("GIVEN an user has been checked in 'Last Modified by' selector WHEN 'Clear Filter' has been clicked THEN the user-checkbox gets unchecked in List Options", + async () => { + let filterPanel = new FilterPanel(); + let contentBrowsePanel = new ContentBrowsePanel(); + // 1. SU is logged in: + await studioUtils.navigateToContentStudioApp('su', 'password'); + // 2. Open 'Filter Panel' + await studioUtils.openFilterPanel(); + // 3. Select the existing user in 'Last Modified by' dropdown selector: + await filterPanel.filterAndSelectLastModifiedByOption(USER.displayName); + await filterPanel.clickOnClearLink(); + // 4. Expand the 'Last Modified by' dropdown + await filterPanel.clickOnLastModifiedByDropdownHandle(); + await studioUtils.saveScreenshot('modified_by_selected_dropdown_expanded_2'); + // 5. Verify that the checkbox is checked: + let isChecked = await filterPanel.isCheckedInLastModifiedByListOptions(USER.displayName); + assert.ok(isChecked === false, "This checkbox should not be checked in the dropdown"); + // 6. 'Clear Filter' icon should not be displayed now + await filterPanel.waitForClearLinkNotDisplayed(); }); before(async () => {