Skip to content

Commit

Permalink
new ui-tests for aggregation issue #7908
Browse files Browse the repository at this point in the history
  • Loading branch information
sgauruseu authored and ashklianko committed Oct 7, 2024
1 parent 6f844a6 commit 15b39fb
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 1 deletion.
5 changes: 4 additions & 1 deletion testing/libs/elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']",
Expand Down Expand Up @@ -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 +
Expand Down
15 changes: 15 additions & 0 deletions testing/page_objects/browsepanel/content.filter.panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
49 changes: 49 additions & 0 deletions testing/specs/misc/filtering.by.owner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 15b39fb

Please sign in to comment.