diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts
index 19f244641..69395b507 100755
--- a/e2e/components/data-table/data-table.ts
+++ b/e2e/components/data-table/data-table.ts
@@ -409,6 +409,14 @@ export class DataTable extends Component {
}, {});
}
+ getSearchResultsRows(): ElementArrayFinder {
+ return this.body.all(by.css(DataTable.selectors.searchResultsRow));
+ }
+
+ getNthSearchResultsRow(nth: number): ElementFinder {
+ return this.getSearchResultsRows().get(nth - 1);
+ }
+
getSearchResultsRowByName(name: string, location: string = '') {
if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name))
diff --git a/e2e/components/search/filters/created-date-filter.ts b/e2e/components/search/filters/created-date-filter.ts
new file mode 100755
index 000000000..03d50f3ee
--- /dev/null
+++ b/e2e/components/search/filters/created-date-filter.ts
@@ -0,0 +1,137 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { ElementFinder, by, protractor } from 'protractor';
+import { GenericFilterPanel } from './generic-filter-panel';
+import { Utils } from '../../../utilities/utils';
+
+export class CreatedDateFilter extends GenericFilterPanel {
+ constructor() {
+ super('Created date');
+ }
+
+ fromField: ElementFinder = this.panelExpanded.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'From'));
+ fromInput: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-input']`));
+ fromFieldError: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-error']`));
+ toField: ElementFinder = this.panelExpanded.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'To'));
+ toInput: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-input']`))
+ toFieldError: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-error']`))
+ clearButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-clear-btn"]'));
+ applyButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-apply-btn"]'));
+
+ async isFromFieldDisplayed(): Promise {
+ return (await this.fromField.isPresent()) && (await this.fromField.isDisplayed());
+ }
+
+ async isFromErrorDisplayed(): Promise {
+ return (await this.fromFieldError.isPresent()) && (await this.fromFieldError.isDisplayed());
+ }
+
+ async isToFieldDisplayed(): Promise {
+ return (await this.toField.isPresent()) && (await this.toField.isDisplayed());
+ }
+
+ async isToErrorDisplayed(): Promise {
+ return (await this.toFieldError.isPresent()) && (await this.toFieldError.isDisplayed());
+ }
+
+ async isClearButtonEnabled(): Promise {
+ return await this.clearButton.isEnabled();
+ }
+
+ async isApplyButtonEnabled(): Promise {
+ return await this.applyButton.isEnabled();
+ }
+
+ async clickClearButton(): Promise {
+ if ( await this.isClearButtonEnabled() ) {
+ await this.clearButton.click();
+ }
+ }
+
+ async clickApplyButton(): Promise {
+ if ( await this.isApplyButtonEnabled() ) {
+ await this.applyButton.click();
+ }
+ }
+
+ async getFromValue(): Promise {
+ try {
+ const value = await this.fromInput.getAttribute('value');
+ return value;
+ } catch (error) {
+ return '';
+ }
+ }
+
+ async getFromError(): Promise {
+ try {
+ const error = await this.fromFieldError.getText();
+ return error;
+ } catch (err) {
+ return '';
+ }
+ }
+
+ async getToValue(): Promise {
+ try {
+ const value = await this.toInput.getAttribute('value');
+ return value;
+ } catch (err) {
+ return '';
+ }
+ }
+
+ async getToError(): Promise {
+ try {
+ const error = await this.toFieldError.getText();
+ return error;
+ } catch (err) {
+ return '';
+ }
+ }
+
+ async resetPanel(): Promise {
+ const fromValue = await this.getFromValue();
+ const toValue = await this.getToValue();
+ if ( fromValue.length > 0 || toValue.length > 0 ) {
+ await this.expandPanel();
+ await this.clickClearButton();
+ await this.collapsePanel();
+ }
+ }
+
+ async enterFromDate(date: string): Promise {
+ await this.expandPanel();
+ await Utils.clearFieldWithBackspace(this.fromInput);
+ await this.fromInput.sendKeys(date, protractor.Key.TAB);
+ }
+
+ async enterToDate(date: string): Promise {
+ await this.expandPanel();
+ await Utils.clearFieldWithBackspace(this.toInput);
+ await this.toInput.sendKeys(date, protractor.Key.TAB);
+ }
+}
diff --git a/e2e/components/search/filters/facet-filter.ts b/e2e/components/search/filters/facet-filter.ts
new file mode 100755
index 000000000..89fa6de41
--- /dev/null
+++ b/e2e/components/search/filters/facet-filter.ts
@@ -0,0 +1,96 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { ElementFinder, ElementArrayFinder, by, browser } from 'protractor';
+import { GenericFilterPanel } from './generic-filter-panel';
+
+export class FacetFilter extends GenericFilterPanel {
+ private readonly locators = {
+ checkbox: '.mat-checkbox',
+ checkboxChecked: '.mat-checkbox.mat-checkbox-checked',
+ button: '.adf-facet-buttons button',
+ categoryInput: 'input[placeholder="Filter category"',
+ facetsFilter: '.adf-facet-result-filter'
+ }
+
+ get facets(): ElementArrayFinder { return this.panelExpanded.all(by.css(this.locators.checkbox)); }
+ get selectedFacets(): ElementArrayFinder { return this.panel.all(by.css(this.locators.checkboxChecked)); }
+ get clearButton(): ElementFinder { return this.panel.element(by.cssContainingText(this.locators.button, 'Clear all')); }
+ get facetsFilter(): ElementFinder { return this.panelExpanded.element(by.css(this.locators.facetsFilter)); }
+ get filterCategoryInput(): ElementFinder { return this.facetsFilter.element(by.css(this.locators.categoryInput)); }
+
+ async getFiltersValues(): Promise {
+ const list: string[] = await this.facets.map(option => {
+ return option.getText();
+ });
+ return list;
+ }
+
+ async getFiltersCheckedValues(): Promise {
+ const list: string[] = await this.selectedFacets.map(option => {
+ return option.getText();
+ });
+ return list;
+ }
+
+ async resetPanel(): Promise {
+ if ( (await this.selectedFacets.count()) > 0 ) {
+ await this.expandPanel();
+ await this.selectedFacets.each(async elem => {
+ await elem.click();
+ });
+ }
+ await this.expandPanel();
+ }
+
+ async isFilterFacetsDisplayed(): Promise {
+ return await this.facetsFilter.isDisplayed();
+ }
+
+ async isClearButtonEnabled(): Promise {
+ return await this.clearButton.isEnabled();
+ }
+
+ async clickClearButton(): Promise {
+ if ( await this.isClearButtonEnabled() ) {
+ await this.clearButton.click();
+ }
+ }
+
+ async isFilterCategoryInputDisplayed(): Promise {
+ return await this.filterCategoryInput.isDisplayed();
+ }
+
+ async checkCategory(name: string): Promise {
+ const option = this.facets.filter(async (elem) => (await elem.getText()).includes(name)).first();
+ await browser.executeScript(`arguments[0].scrollIntoView();`, option);
+ await browser.actions().mouseMove(option).perform();
+ await browser.actions().click().perform();
+ }
+
+ async filterCategoriesBy(name: string): Promise {
+ await this.filterCategoryInput.sendKeys(name);
+ }
+}
diff --git a/e2e/components/search/filters/generic-filter-panel.ts b/e2e/components/search/filters/generic-filter-panel.ts
new file mode 100755
index 000000000..ad74b8afe
--- /dev/null
+++ b/e2e/components/search/filters/generic-filter-panel.ts
@@ -0,0 +1,71 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { ElementFinder, by, browser } from 'protractor';
+
+export class GenericFilterPanel {
+ private filterName: string;
+
+ constructor(filterName: string) {
+ this.filterName = filterName;
+ }
+
+ private readonly selectors = {
+ root: 'adf-search-filter',
+
+ panel: '.mat-expansion-panel',
+ panelExpanded: '.mat-expansion-panel.mat-expanded',
+ panelHeader: '.mat-expansion-panel-header'
+ }
+
+ get panel(): ElementFinder { return browser.element(by.cssContainingText(this.selectors.panel, this.filterName)); }
+ get panelExpanded(): ElementFinder { return browser.element(by.cssContainingText(this.selectors.panelExpanded, this.filterName)); }
+ get panelHeader(): ElementFinder { return this.panel.element(by.css(this.selectors.panelHeader)); }
+
+ async clickPanelHeader(): Promise {
+ await this.panelHeader.click();
+ }
+
+ async isPanelDisplayed(): Promise {
+ return (await browser.isElementPresent(this.panel)) && (await this.panel.isDisplayed());
+ }
+
+ async isPanelExpanded(): Promise {
+ return (await this.panelExpanded.isPresent()) && (await this.panelExpanded.isDisplayed());
+ }
+
+ async expandPanel(): Promise {
+ if ( !(await this.isPanelExpanded()) ) {
+ await this.clickPanelHeader();
+ }
+ }
+
+ async collapsePanel(): Promise {
+ if ( await this.isPanelExpanded() ) {
+ await this.clickPanelHeader();
+ }
+ }
+
+}
diff --git a/e2e/components/search/filters/size-filter.ts b/e2e/components/search/filters/size-filter.ts
new file mode 100755
index 000000000..76bc477b9
--- /dev/null
+++ b/e2e/components/search/filters/size-filter.ts
@@ -0,0 +1,92 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { ElementFinder, by, ElementArrayFinder } from 'protractor';
+import { GenericFilterPanel } from './generic-filter-panel';
+
+export class SizeFilter extends GenericFilterPanel {
+ constructor() {
+ super('Size');
+ }
+
+ facets: ElementArrayFinder = this.panelExpanded.all(by.css('.mat-checkbox'));
+ selectedFacets: ElementArrayFinder = this.panel.all(by.css('.mat-checkbox.mat-checkbox-checked'));
+ clearButton: ElementFinder = this.panel.element(by.cssContainingText('.adf-facet-buttons button', 'Clear all'));
+
+ async getFiltersValues(): Promise {
+ const list: string[] = await this.facets.map(option => {
+ return option.getText();
+ });
+ return list;
+ }
+
+ async getFiltersCheckedValues(): Promise {
+ const list: string[] = await this.selectedFacets.map(option => {
+ return option.getText();
+ });
+ return list;
+ }
+
+ async resetPanel(): Promise {
+ if ( (await this.selectedFacets.count()) > 0 ) {
+ await this.expandPanel();
+ await this.selectedFacets.each(async elem => {
+ await elem.click();
+ });
+ }
+ await this.collapsePanel();
+ }
+
+ async isClearButtonEnabled(): Promise {
+ return await this.clearButton.isEnabled();
+ }
+
+ async clickClearButton(): Promise {
+ if ( await this.isClearButtonEnabled() ) {
+ await this.clearButton.click();
+ }
+ }
+
+ async checkSizeSmall(): Promise {
+ const small = this.facets.filter(async (elem) => await elem.getText() === 'Small').first();
+ await small.click();
+ }
+
+ async checkSizeMedium(): Promise {
+ const medium = this.facets.filter(async (elem) => await elem.getText() === 'Medium').first();
+ await medium.click();
+ }
+
+ async checkSizeLarge(): Promise {
+ const large = this.facets.filter(async (elem) => await elem.getText() === 'Large').first();
+ await large.click();
+ }
+
+ async checkSizeHuge(): Promise {
+ const huge = this.facets.filter(async (elem) => await elem.getText() === 'Huge').first();
+ await huge.click();
+ }
+
+}
diff --git a/e2e/components/search/search-filters.ts b/e2e/components/search/search-filters.ts
new file mode 100755
index 000000000..ffda3151c
--- /dev/null
+++ b/e2e/components/search/search-filters.ts
@@ -0,0 +1,60 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { ElementFinder, by, browser } from 'protractor';
+import { Component } from '../component';
+import { SizeFilter } from './filters/size-filter';
+import { CreatedDateFilter } from './filters/created-date-filter';
+import { FacetFilter } from './filters/facet-filter';
+
+export class SearchFilters extends Component {
+ private static selectors = {
+ root: 'adf-search-filter',
+ };
+
+ mainPanel: ElementFinder = browser.element(by.css(SearchFilters.selectors.root));
+ resetAllButton: ElementFinder = this.component.element(by.cssContainingText('.mat-button', 'Reset all'));
+
+ size = new SizeFilter();
+ createdDate = new CreatedDateFilter();
+ fileType = new FacetFilter('File type');
+ creator = new FacetFilter('Creator');
+ modifier = new FacetFilter('Modifier');
+ location = new FacetFilter('Location');
+ modifiedDate = new FacetFilter('Modified date');
+
+ constructor(ancestor?: ElementFinder) {
+ super(SearchFilters.selectors.root, ancestor);
+ }
+
+ async isSearchFiltersPanelDisplayed(): Promise {
+ return (await this.mainPanel.isPresent()) && (await this.mainPanel.isDisplayed());
+ }
+
+ async clickResetAllButton(): Promise {
+ await this.resetAllButton.click();
+ }
+
+}
diff --git a/e2e/components/search/search-input.ts b/e2e/components/search/search-input.ts
index 091cb5046..b2f18529d 100755
--- a/e2e/components/search/search-input.ts
+++ b/e2e/components/search/search-input.ts
@@ -34,7 +34,7 @@ export class SearchInput extends Component {
searchContainer: '.app-search-container',
searchButton: '.app-search-button',
searchControl: '.app-search-control',
- searchInput: 'app-control-input',
+ searchInput: `input[id='app-control-input']`,
searchOptionsArea: 'search-options',
optionCheckbox: '.mat-checkbox',
clearButton: '.app-clear-icon'
@@ -43,7 +43,7 @@ export class SearchInput extends Component {
searchButton: ElementFinder = this.component.element(by.css(SearchInput.selectors.searchButton));
searchContainer: ElementFinder = browser.element(by.css(SearchInput.selectors.searchContainer));
searchControl: ElementFinder = browser.element(by.css(SearchInput.selectors.searchControl));
- searchBar: ElementFinder = browser.element(by.id(SearchInput.selectors.searchInput));
+ searchInput: ElementFinder = browser.element(by.css(SearchInput.selectors.searchInput));
searchOptionsArea: ElementFinder = browser.element(by.id(SearchInput.selectors.searchOptionsArea));
searchFilesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Files'));
searchFoldersOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Folders'));
@@ -58,6 +58,10 @@ export class SearchInput extends Component {
await browser.wait(EC.presenceOf(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---');
}
+ async waitForSearchInputToBeInteractive() {
+ await browser.wait(EC.elementToBeClickable(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---');
+ }
+
async isSearchContainerDisplayed() {
return (await this.searchContainer.isDisplayed()) && (await this.searchButton.isDisplayed());
}
@@ -162,9 +166,9 @@ export class SearchInput extends Component {
}
async searchFor(text: string) {
- await browser.wait(EC.elementToBeClickable(this.searchBar), BROWSER_WAIT_TIMEOUT, '---- timeout waiting for searchBar to be clickable');
- await this.searchBar.clear();
- await this.searchBar.sendKeys(text);
- await this.searchBar.sendKeys(protractor.Key.ENTER);
+ await this.waitForSearchInputToBeInteractive();
+ await Utils.clearFieldWithBackspace(this.searchInput);
+ await this.searchInput.sendKeys(text);
+ await this.searchInput.sendKeys(protractor.Key.ENTER);
}
}
diff --git a/e2e/components/search/search-sorting-picker.ts b/e2e/components/search/search-sorting-picker.ts
new file mode 100755
index 000000000..e274a95e3
--- /dev/null
+++ b/e2e/components/search/search-sorting-picker.ts
@@ -0,0 +1,141 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor';
+import { BROWSER_WAIT_TIMEOUT } from '../../configs';
+import { Component } from '../component';
+
+export class SearchSortingPicker extends Component {
+ private static selectors = {
+ root: 'adf-search-sorting-picker',
+
+ sortByOption: '.mat-option .mat-option-text'
+ };
+
+ sortOrderButton: ElementFinder = this.component.element(by.css('button[mat-icon-button]'));
+ sortByDropdownCollapsed: ElementFinder = this.component.element(by.css('.mat-select'));
+ sortByDropdownExpanded: ElementFinder = browser.element(by.css('.mat-select-panel'));
+ sortByList: ElementArrayFinder = this.sortByDropdownExpanded.all(by.css(SearchSortingPicker.selectors.sortByOption));
+
+ constructor(ancestor?: ElementFinder) {
+ super(SearchSortingPicker.selectors.root, ancestor);
+ }
+
+ async waitForSortByDropdownToExpand(): Promise {
+ await browser.wait(EC.visibilityOf(this.sortByDropdownExpanded), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for sortBy dropdown to expand');
+ }
+
+ async isSortOrderButtonDisplayed(): Promise {
+ return (await this.sortOrderButton.isPresent()) && (await this.sortOrderButton.isDisplayed());
+ }
+
+ async getSortOrder(): Promise<'ASC' | 'DESC' | ''> {
+ const orderArrow = await this.sortOrderButton.getText();
+
+ if ( orderArrow.includes('upward') ) {
+ return 'ASC'
+ } else if ( orderArrow.includes('downward') ) {
+ return 'DESC'
+ } else {
+ return '';
+ }
+ }
+
+ async isSortByOptionDisplayed(): Promise {
+ return (await this.sortByDropdownCollapsed.isPresent()) && (await this.sortByDropdownCollapsed.isDisplayed());
+ }
+
+ async isSortByDropdownExpanded(): Promise {
+ return (await this.sortByDropdownExpanded.isPresent()) && (await this.sortByDropdownExpanded.isDisplayed());
+ }
+
+ async getSelectedSortByOption(): Promise {
+ return await this.sortByDropdownCollapsed.getText();
+ }
+
+ async clickSortByDropdown(): Promise {
+ await this.sortByDropdownCollapsed.click();
+ await this.waitForSortByDropdownToExpand();
+ }
+
+ async getSortByOptionsList(): Promise {
+ const list: string[] = await this.sortByList.map(async option => {
+ return option.getText();
+ });
+ return list;
+ }
+
+ async sortByOption(option: string): Promise {
+ if ( !(await this.isSortByDropdownExpanded()) ) {
+ await this.clickSortByDropdown();
+ }
+ const elem = browser.element(by.cssContainingText(SearchSortingPicker.selectors.sortByOption, option));
+ await elem.click();
+ }
+
+ async sortByName(): Promise {
+ await this.sortByOption('Filename');
+ }
+
+ async sortByRelevance(): Promise {
+ await this.sortByOption('Relevance');
+ }
+
+ async sortByTitle(): Promise {
+ await this.sortByOption('Title');
+ }
+
+ async sortByModifiedDate(): Promise {
+ await this.sortByOption('Modified date');
+ }
+
+ async sortByModifier(): Promise {
+ await this.sortByOption('Modifier');
+ }
+
+ async sortByCreatedDate(): Promise {
+ await this.sortByOption('Created date');
+ }
+
+ async sortBySize(): Promise {
+ await this.sortByOption('Size');
+ }
+
+ async sortByType(): Promise {
+ await this.sortByOption('Type');
+ }
+
+ async setSortOrderASC(): Promise {
+ if ( (await this.getSortOrder()) !== 'ASC' ) {
+ await this.sortOrderButton.click();
+ }
+ }
+
+ async setSortOrderDESC(): Promise {
+ if ( (await this.getSortOrder()) !== 'DESC' ) {
+ await this.sortOrderButton.click();
+ }
+ }
+}
diff --git a/e2e/pages/search-results-page.ts b/e2e/pages/search-results-page.ts
index f45bb32aa..c6895a645 100755
--- a/e2e/pages/search-results-page.ts
+++ b/e2e/pages/search-results-page.ts
@@ -23,37 +23,53 @@
* along with Alfresco. If not, see .
*/
-import { browser, by } from 'protractor';
+import { browser, by, By, ElementFinder, ElementArrayFinder } from 'protractor';
import { BrowsingPage } from './browsing-page';
+import { SearchSortingPicker } from '../components/search/search-sorting-picker';
+import { SearchFilters } from '../components/search/search-filters';
export class SearchResultsPage extends BrowsingPage {
private static selectors = {
root: 'aca-search-results',
- filter: 'adf-search-filter',
- expansionPanel: 'mat-expansion-panel',
- size: '#expansion-panel-SEARCH.CATEGORIES.SIZE',
- createdDate: '#expansion-panel-SEARCH.CATEGORIES.CREATED_DATE',
- modifiedDate: '#expansion-panel-SEARCH.CATEGORIES.MODIFIED_DATE',
- fileType: '#expansion-panel-SEARCH.FACET_FIELDS.FILE_TYPE',
- creator: '#expansion-panel-SEARCH.CATEGORIES.CREATOR',
- modifier: '#expansion-panel-SEARCH.CATEGORIES.MODIFIER',
- location: '#expansion-panel-SEARCH.CATEGORIES.LOCATION',
-
- resultsContent: 'adf-search-results__content',
resultsContentHeader: '.adf-search-results__content-header',
- resultsInfoText: 'adf-search-results--info-text',
- resultsFacets: 'adf-search-results__facets',
-
- sortingPicker: 'adf-sorting-picker'
+ infoText: '.adf-search-results--info-text',
+ chipList: '.adf-search-chip-list',
+ chip: '.mat-chip',
+ chipCloseIcon: '.mat-chip-remove'
};
- async waitForResults() {
+ root: ElementFinder = browser.element(by.css(SearchResultsPage.selectors.root));
+ chipList: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.chipList));
+ infoText: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.infoText));
+
+ sortingPicker = new SearchSortingPicker(this.root);
+ filters = new SearchFilters(this.root);
+
+ async waitForResults(): Promise {
await this.dataTable.waitForBody();
}
- async getResultsHeader() {
- return browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
+ async getResultsHeader(): Promise {
+ return await browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
+ }
+
+ async getResultsFoundText(): Promise {
+ return await this.infoText.getText();
+ }
+
+ async getResultsChipsValues(): Promise {
+ const chips: ElementArrayFinder = this.chipList.all(by.css(SearchResultsPage.selectors.chip));
+ const chipsValues: string[] = await chips.map(async elem => {
+ return (await elem.getText()).replace(`\ncancel`, '');
+ });
+ return chipsValues;
+ }
+
+ async removeChip(chipName: string): Promise {
+ const chip: ElementFinder = browser.element(By.cssContainingText(SearchResultsPage.selectors.chip, chipName));
+ const closeChip: ElementFinder = chip.element(by.css(SearchResultsPage.selectors.chipCloseIcon));
+ await closeChip.click();
}
}
diff --git a/e2e/suites/list-views/empty-list.test.ts b/e2e/suites/list-views/empty-list.test.ts
index 93ecafd09..7c06ebdb0 100755
--- a/e2e/suites/list-views/empty-list.test.ts
+++ b/e2e/suites/list-views/empty-list.test.ts
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see .
*/
-import { LoginPage, BrowsingPage } from '../../pages/pages';
+import { LoginPage, BrowsingPage, SearchResultsPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
@@ -38,6 +38,7 @@ describe('Empty list views', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
+ const searchResultsPage = new SearchResultsPage();
const { dataTable, pagination } = page;
const { searchInput } = page.header;
@@ -168,7 +169,6 @@ describe('Empty list views', () => {
it('Search results - pagination controls not displayed - [C290123]', async () => {
await searchInput.clickSearchButton();
- await searchInput.checkOnlyFiles();
/* cspell:disable-next-line */
await searchInput.searchFor('qwertyuiop');
await dataTable.waitForBody();
@@ -181,6 +181,15 @@ describe('Empty list views', () => {
expect(await pagination.isNextButtonPresent()).toBe(false, 'Next button is present');
});
+ it('Search filters panel is not displayed on empty Search Results page - [C279189]', async () => {
+ await searchInput.clickSearchButton();
+ /* cspell:disable-next-line */
+ await searchInput.searchFor('qwertyuiop');
+ await dataTable.waitForBody();
+
+ expect(await searchResultsPage.filters.isSearchFiltersPanelDisplayed()).toBe(false, 'Search filters panel is present');
+ });
+
it('Empty Search results - Libraries - [C290020]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
diff --git a/e2e/suites/search/search-filters.test.ts b/e2e/suites/search/search-filters.test.ts
new file mode 100644
index 000000000..80989f148
--- /dev/null
+++ b/e2e/suites/search/search-filters.test.ts
@@ -0,0 +1,635 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { LoginPage, SearchResultsPage } from '../../pages/pages';
+import { RepoClient } from '../../utilities/repo-client/repo-client';
+import { Utils } from '../../utilities/utils';
+import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
+import * as moment from 'moment';
+
+describe('Search filters', () => {
+ const random = Utils.random();
+
+ const user1 = `user1-${random}`;
+ const user2 = `user2-${random}`;
+
+ const parent = `parent-${random}`;
+ let parentId: string;
+
+ const site = `site-${Utils.random()}`; let docLibId;
+
+ const fileJpgUser1 = {
+ name: `search-filters-file-1-${random}.jpg`,
+ source: FILES.jpgFile
+ };
+
+ const filePdfUser2 = {
+ name: `search-filters-file-2-${random}.pdf`,
+ title: 'search filters title',
+ description: 'search filters',
+ source: FILES.pdfFile
+ };
+
+ const expectedFileTypes = ['Adobe PDF Document (1)', 'JPEG Image (1)'];
+ const expectedCreators = [`${user1} ${user1} (1)`, `${user2} ${user2} (1)`];
+ const expectedModifiers = [`${user1} ${user1} (1)`, `${user2} ${user2} (1)`];
+ const expectedLocations = ['_REPOSITORY_ (1)', `${site} (1)`];
+
+ const apis = {
+ admin: new RepoClient(),
+ user1: new RepoClient(user1, user1),
+ user2: new RepoClient(user2, user2)
+ };
+
+ const loginPage = new LoginPage();
+ const page = new SearchResultsPage();
+ const { searchInput } = page.header;
+ const { dataTable, filters } = page;
+
+ const sizeFilter = filters.size;
+ const fileTypeFilter = filters.fileType;
+ const createdDateFilter = filters.createdDate;
+ const creatorFilter = filters.creator;
+ const locationFilter = filters.location;
+ const modifierFilter = filters.modifier;
+ const modifiedDateFilter = filters.modifiedDate;
+
+ beforeAll(async (done) => {
+ await apis.admin.people.createUser({ username: user1 });
+ await apis.admin.people.createUser({ username: user2 });
+ parentId = (await apis.user1.nodes.createFolder(parent)).entry.id;
+ await apis.user1.sites.createSite(site, SITE_VISIBILITY.PUBLIC);
+ await apis.user1.sites.addSiteMember(site, user2, SITE_ROLES.SITE_MANAGER.ROLE);
+ docLibId = await apis.admin.sites.getDocLibId(site);
+
+ await apis.user1.nodes.setGranularPermission(parentId, true, user2, 'Collaborator');
+
+ await apis.user1.upload.uploadFileWithRename(fileJpgUser1.source, docLibId, fileJpgUser1.name);
+ await apis.user2.upload.uploadFileWithRename(filePdfUser2.source, parentId, filePdfUser2.name, filePdfUser2.title, filePdfUser2.description);
+
+ await apis.user1.search.waitForNodes('search-filters', { expect: 2 });
+
+ await loginPage.loginWith(user1);
+ done();
+ });
+
+ beforeEach(async (done) => {
+ await Utils.pressEscape();
+ await page.clickPersonalFilesAndWait();
+
+ await searchInput.clickSearchButton();
+ await searchInput.searchFor('search filters');
+ await dataTable.waitForBody();
+ done();
+ });
+
+ afterAll(async (done) => {
+ await Promise.all([
+ apis.user1.nodes.deleteNodeById(parentId),
+ apis.user1.sites.deleteSite(site)
+ ]);
+ done();
+ });
+
+ it('Filters are displayed - [C279186]', async () => {
+ expect(await sizeFilter.isPanelDisplayed()).toBe(true, 'Size filter panel not displayed');
+ expect(await createdDateFilter.isPanelDisplayed()).toBe(true, 'Created date filter panel not displayed');
+ expect(await fileTypeFilter.isPanelDisplayed()).toBe(true, 'File type filter panel not displayed');
+ expect(await creatorFilter.isPanelDisplayed()).toBe(true, 'Creator filter panel not displayed');
+ expect(await modifierFilter.isPanelDisplayed()).toBe(true, 'Modifier filter panel not displayed');
+ expect(await locationFilter.isPanelDisplayed()).toBe(true, 'Location filter panel not displayed');
+ expect(await modifiedDateFilter.isPanelDisplayed()).toBe(true, 'Modified date filter panel not displayed');
+ });
+
+ describe('Filter by Size', () => {
+ afterEach(async (done) => {
+ await sizeFilter.resetPanel();
+ done();
+ });
+
+ it('Expand / Collapse the Size filter panel - [C279197]', async () => {
+ expect(await sizeFilter.isPanelExpanded()).toBe(false, 'Size filter panel is expanded');
+
+ await sizeFilter.expandPanel();
+ expect(await sizeFilter.isPanelExpanded()).toBe(true, 'Size filter panel not expanded');
+
+ const expectedSizes = ['Small', 'Medium', 'Large', 'Huge'];
+ expect(await sizeFilter.getFiltersValues()).toEqual(expectedSizes, 'Incorrect Size filters facets');
+ expect(await sizeFilter.isClearButtonEnabled()).toBe(true, 'Size filter Clear button not enabled');
+
+ await sizeFilter.collapsePanel();
+ expect(await sizeFilter.isPanelExpanded()).toBe(false, 'Size filter panel is expanded');
+ });
+
+ it('Filter by Small - [C279199]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeSmall();
+
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, `${fileJpgUser1.name} not in the list`);
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, `${filePdfUser2.name} not in the list`);
+ });
+
+ it('Filter by Huge - [C279202]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeHuge();
+
+ expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
+ });
+
+ it('Filter by multiple size categories - [C279203]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeSmall();
+ await sizeFilter.checkSizeMedium();
+ await sizeFilter.checkSizeLarge();
+
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, `${fileJpgUser1.name} not in the list`);
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, `${filePdfUser2.name} not in the list`);
+ });
+
+ it('Clear the Size filter options - [C279198]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeSmall();
+ await sizeFilter.checkSizeMedium();
+ expect(await sizeFilter.getFiltersCheckedValues()).toEqual(['Small', 'Medium'], 'Incorrect checked Size filters');
+
+ await sizeFilter.clickClearButton();
+ expect(await sizeFilter.getFiltersCheckedValues()).toEqual([], 'Size filters not cleared');
+ });
+ });
+
+ describe('Filter by Created date', () => {
+ const yesterday = moment().subtract(1, 'day').format('DD-MMM-YY');
+ const today = moment().format('DD-MMM-YY');
+ const future = moment().add(1, 'month').format('DD-MMM-YY');
+
+ afterEach(async (done) => {
+ await createdDateFilter.resetPanel();
+ done();
+ });
+
+ it('Expand / Collapse the Created date filter panel - [C279211]', async () => {
+ expect(await createdDateFilter.isPanelExpanded()).toBe(false, 'Created date filter panel is expanded');
+
+ await createdDateFilter.expandPanel();
+ expect(await createdDateFilter.isPanelExpanded()).toBe(true, 'Created date filter panel not expanded');
+
+ expect(await createdDateFilter.isClearButtonEnabled()).toBe(true, 'Created date CLEAR button not enabled');
+ expect(await createdDateFilter.isApplyButtonEnabled()).toBe(false, 'Created date APPLY button not disabled');
+
+ await createdDateFilter.collapsePanel();
+ expect(await createdDateFilter.isPanelExpanded()).toBe(false, 'Created date filter panel is expanded');
+ });
+
+ it('Results are filtered by Created date - [C279217]', async () => {
+ await createdDateFilter.expandPanel();
+ await createdDateFilter.enterFromDate(yesterday);
+ await createdDateFilter.enterToDate(yesterday);
+
+ expect(await createdDateFilter.isApplyButtonEnabled()).toBe(true, 'Created date filter Apply button not enabled');
+
+ await createdDateFilter.clickApplyButton();
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(false, 'JPG file is displayed');
+
+ await createdDateFilter.enterFromDate(yesterday);
+ await createdDateFilter.enterToDate(today);
+
+ expect(await createdDateFilter.isApplyButtonEnabled()).toBe(true, 'Created date filter Apply button not enabled');
+
+ await createdDateFilter.clickApplyButton();
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ });
+
+ it('Clear the Created date filter options - [C279216]', async () => {
+ await createdDateFilter.expandPanel();
+ await createdDateFilter.enterFromDate(yesterday);
+ await createdDateFilter.enterToDate(yesterday);
+ await createdDateFilter.clickApplyButton();
+
+ expect(await createdDateFilter.getFromValue()).toContain(yesterday);
+ expect(await createdDateFilter.getToValue()).toContain(yesterday);
+
+ await createdDateFilter.clickClearButton();
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file is displayed');
+ expect(await createdDateFilter.getFromValue()).toEqual('', 'From field not empty');
+ expect(await createdDateFilter.getToValue()).toEqual('', 'To field not empty');
+ });
+
+ it('From and To values are required - [C279212]', async () => {
+ await createdDateFilter.expandPanel();
+ await createdDateFilter.enterFromDate('');
+ await createdDateFilter.enterToDate('');
+
+ expect(await createdDateFilter.isFromErrorDisplayed()).toBe(true, 'Error missing for From field');
+ expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field');
+ expect(await createdDateFilter.getFromError()).toEqual('Required value');
+ expect(await createdDateFilter.getToError()).toEqual('Required value');
+ });
+
+ it('Error message is displayed when entering an incorrect date format - [C279213]', async () => {
+ await createdDateFilter.expandPanel();
+ await createdDateFilter.enterFromDate('03.31.2019');
+ await createdDateFilter.enterToDate('invalid text');
+
+ expect(await createdDateFilter.isFromErrorDisplayed()).toBe(true, 'Error missing for From field');
+ expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field');
+ expect(await createdDateFilter.getFromError()).toEqual(`Invalid date. The date must be in the format 'DD-MMM-YY'`);
+ expect(await createdDateFilter.getToError()).toEqual(`Invalid date. The date must be in the format 'DD-MMM-YY'`);
+ });
+
+ it('Error message is displayed when entering a date from the future - [C279214]', async () => {
+ await createdDateFilter.expandPanel();
+ await createdDateFilter.enterFromDate(future);
+ await createdDateFilter.enterToDate(future);
+
+ expect(await createdDateFilter.isFromErrorDisplayed()).toBe(true, 'Error missing for From field');
+ expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field');
+ expect(await createdDateFilter.getFromError()).toEqual('The date is beyond the maximum date.');
+ expect(await createdDateFilter.getToError()).toEqual('The date is beyond the maximum date.');
+ });
+
+ it('Error message is displayed when From value is bigger than To value - [C279215]', async () => {
+ await createdDateFilter.expandPanel();
+ await createdDateFilter.enterFromDate(today);
+ await createdDateFilter.enterToDate(yesterday);
+
+ expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field');
+ expect(await createdDateFilter.getToError()).toEqual('No days selected.');
+ });
+ });
+
+ describe('Filter by File type', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the File type filter panel - [C279191]', async () => {
+ expect(await fileTypeFilter.isPanelExpanded()).toBe(true, 'File type filter panel not expanded');
+ expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes, 'Incorrect File type filters facets');
+ expect(await fileTypeFilter.isFilterCategoryInputDisplayed()).toBe(true, 'File type filter categories not displayed');
+
+ await fileTypeFilter.collapsePanel();
+ expect(await fileTypeFilter.isPanelExpanded()).toBe(false, 'File type filter panel is expanded');
+ });
+
+ it('Results are filtered by File type - [C279192]', async () => {
+ await fileTypeFilter.expandPanel();
+ await fileTypeFilter.checkCategory('Adobe PDF Document');
+
+ expect(await fileTypeFilter.isClearButtonEnabled()).toBe(true, 'File type filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(false, 'JPG file is displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['Adobe PDF Document']);
+
+ await fileTypeFilter.checkCategory('JPEG Image');
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['Adobe PDF Document', 'JPEG Image']);
+ });
+
+ it('Clear the File type filter options - [C279193]', async () => {
+ await fileTypeFilter.expandPanel();
+ await fileTypeFilter.checkCategory('Adobe PDF Document');
+
+ expect(await fileTypeFilter.getFiltersCheckedValues()).toEqual(['Adobe PDF Document (1)']);
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(false, 'JPG file is displayed');
+
+ await fileTypeFilter.clickClearButton();
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await fileTypeFilter.getFiltersCheckedValues()).toEqual([], 'File types selection not cleared');
+ });
+
+ it('Search for a specific file type - [C279195]', async () => {
+ await fileTypeFilter.expandPanel();
+ expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes, 'Incorrect File type filters facets');
+ await fileTypeFilter.filterCategoriesBy('PDF');
+ expect(await fileTypeFilter.getFiltersValues()).toEqual(['Adobe PDF Document (1)'], 'Incorrect File type filters facets');
+ });
+ });
+
+ describe('Filter by Creator', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the Creator filter panel - [C279205]', async () => {
+ expect(await creatorFilter.isPanelExpanded()).toBe(true, 'Creator filter panel not expanded');
+
+ expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators, 'Incorrect Creator filters facets');
+ expect(await creatorFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Creator filter categories not displayed');
+
+ await creatorFilter.collapsePanel();
+ expect(await creatorFilter.isPanelExpanded()).toBe(false, 'Creator filter panel is expanded');
+ });
+
+ it('Results are filtered by Creator - [C279206]', async () => {
+ await creatorFilter.expandPanel();
+ await creatorFilter.checkCategory(user1);
+
+ expect(await creatorFilter.isClearButtonEnabled()).toBe(true, 'Creator filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`]);
+
+ await creatorFilter.checkCategory(user2);
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`, `${user2} ${user2}`]);
+ });
+
+ it('Clear the Creator filter options - [C279207]', async () => {
+ await creatorFilter.expandPanel();
+ await creatorFilter.checkCategory(user1);
+
+ expect(await creatorFilter.getFiltersCheckedValues()).toEqual([`${user1} ${user1} (1)`]);
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+
+ await creatorFilter.clickClearButton();
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await creatorFilter.getFiltersCheckedValues()).toEqual([], 'Creator selection not cleared');
+ });
+
+ it('Search for a specific creator - [C279208]', async () => {
+ await creatorFilter.expandPanel();
+ expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators, 'Incorrect Creator filters facets');
+ await creatorFilter.filterCategoriesBy(user1);
+ expect(await creatorFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`], 'Incorrect Creator filters facets');
+ });
+ });
+
+ describe('Filter by Modifier', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the Modifier filter panel - [C279224]', async () => {
+ expect(await modifierFilter.isPanelExpanded()).toBe(true, 'Modifier filter panel not expanded');
+
+ expect(await modifierFilter.getFiltersValues()).toEqual(expectedModifiers, 'Incorrect Modifier filters facets');
+ expect(await modifierFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Modifier filter categories not displayed');
+
+ await modifierFilter.collapsePanel();
+ expect(await modifierFilter.isPanelExpanded()).toBe(false, 'Modifier filter panel is expanded');
+ });
+
+ it('Results are filtered by Modifier - [C279225]', async () => {
+ await modifierFilter.expandPanel();
+ await modifierFilter.checkCategory(user1);
+
+ expect(await modifierFilter.isClearButtonEnabled()).toBe(true, 'Modifier filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`]);
+
+ await modifierFilter.checkCategory(user2);
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`, `${user2} ${user2}`]);
+ });
+
+ it('Clear the Modifier filter options - [C279226]', async () => {
+ await modifierFilter.expandPanel();
+ await modifierFilter.checkCategory(user1);
+
+ expect(await modifierFilter.getFiltersCheckedValues()).toEqual([`${user1} ${user1} (1)`]);
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+
+ await modifierFilter.clickClearButton();
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await modifierFilter.getFiltersCheckedValues()).toEqual([], 'Modifier selection not cleared');
+ });
+
+ it('Search for a specific modifier - [C279227]', async () => {
+ await modifierFilter.expandPanel();
+ expect(await modifierFilter.getFiltersValues()).toEqual(expectedModifiers, 'Incorrect Modifier filters facets');
+ await modifierFilter.filterCategoriesBy(user1);
+ expect(await modifierFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`], 'Incorrect Modifier filters facets');
+ });
+ });
+
+ describe('Filter by Location', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the Location filter panel - [C279230]', async () => {
+ expect(await locationFilter.isPanelExpanded()).toBe(true, 'Location filter panel not expanded');
+
+ expect(await locationFilter.getFiltersValues()).toEqual(expectedLocations, 'Incorrect Location filters facets');
+ expect(await locationFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Location filter categories not displayed');
+
+ await locationFilter.collapsePanel();
+ expect(await locationFilter.isPanelExpanded()).toBe(false, 'Location filter panel is expanded');
+ });
+
+ it('Results are filtered by Location - [C279231]', async () => {
+ await locationFilter.expandPanel();
+ await locationFilter.checkCategory(site);
+
+ expect(await locationFilter.isClearButtonEnabled()).toBe(true, 'Location filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([site]);
+
+ await locationFilter.checkCategory('_REPOSITORY_');
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([site, '_REPOSITORY_']);
+ });
+
+ it('Clear the Location filter options - [C279232]', async () => {
+ await locationFilter.expandPanel();
+ await locationFilter.checkCategory(site);
+
+ expect(await locationFilter.getFiltersCheckedValues()).toEqual([`${site} (1)`]);
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+
+ await locationFilter.clickClearButton();
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await locationFilter.getFiltersCheckedValues()).toEqual([], 'Location selection not cleared');
+ });
+
+ it('Search for a specific location - [C279233]', async () => {
+ await locationFilter.expandPanel();
+ expect(await locationFilter.getFiltersValues()).toEqual(expectedLocations, 'Incorrect Location filters facets');
+ await locationFilter.filterCategoriesBy(site);
+ expect(await locationFilter.getFiltersValues()).toEqual([`${site} (1)`], 'Incorrect Location filters facets');
+ });
+ });
+
+ describe('Filter by Modified date', () => {
+ const expectedDateFilters = ['Today (2)', 'This week (2)', 'This month (2)', 'In the last 6 months (2)', 'This year (2)'];
+
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the Modified date filter panel - [C279219]', async () => {
+ expect(await modifiedDateFilter.isPanelExpanded()).toBe(true, 'Modified Date filter panel not expanded');
+
+ expect(await modifiedDateFilter.getFiltersValues()).toEqual(expectedDateFilters, 'Incorrect Modified Date filters facets');
+ expect(await modifiedDateFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Modified Date filter categories not displayed');
+
+ await modifiedDateFilter.collapsePanel();
+ expect(await modifiedDateFilter.isPanelExpanded()).toBe(false, 'Modified Date filter panel is expanded');
+ });
+
+ it('Results are filtered by Modified date - [C279221]', async () => {
+ await modifiedDateFilter.expandPanel();
+ await modifiedDateFilter.checkCategory('Today');
+
+ expect(await modifiedDateFilter.isClearButtonEnabled()).toBe(true, 'Modified date filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['Today']);
+
+ await modifiedDateFilter.checkCategory('This week');
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['Today', 'This week']);
+ });
+
+ it('Clear the Modified date filter options - [C279220]', async () => {
+ await modifiedDateFilter.expandPanel();
+ await modifiedDateFilter.checkCategory('Today');
+ await modifiedDateFilter.checkCategory('This week');
+ await modifiedDateFilter.checkCategory('This month');
+ await modifiedDateFilter.checkCategory('In the last 6 months');
+ await modifiedDateFilter.checkCategory('This year');
+
+ expect(await modifiedDateFilter.getFiltersCheckedValues()).toEqual(expectedDateFilters, 'Incorrect checked Modified date filters');
+
+ await modifiedDateFilter.clickClearButton();
+ expect(await modifiedDateFilter.getFiltersCheckedValues()).toEqual([], 'Modified date selection not cleared');
+ });
+
+ it('Search for a specific modified date option - [C325006]', async () => {
+ await modifiedDateFilter.expandPanel();
+ expect(await modifiedDateFilter.getFiltersValues()).toEqual(expectedDateFilters, 'Incorrect Modified date filters facets');
+ await modifiedDateFilter.filterCategoriesBy('This');
+ expect(await modifiedDateFilter.getFiltersValues()).toEqual(['This week (2)', 'This month (2)', 'This year (2)'], 'Incorrect Modified date filters facets');
+ });
+ });
+
+ describe('Multiple filters', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ await sizeFilter.resetPanel();
+ await createdDateFilter.resetPanel();
+ done();
+ });
+
+ it('Multiple filters can be applied - [C280051]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeSmall();
+
+ await fileTypeFilter.expandPanel();
+ await fileTypeFilter.checkCategory('JPEG Image');
+ await creatorFilter.checkCategory(user1);
+ await locationFilter.checkCategory(site);
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['JPEG Image', `${user1} ${user1}`, site]);
+
+ await page.removeChip('JPEG Image');
+ await page.removeChip(`${user1} ${user1}`);
+ await page.removeChip(site);
+
+ expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([]);
+ });
+
+ it('Total results is updated correctly - [C280052]', async () => {
+ await fileTypeFilter.expandPanel();
+ await fileTypeFilter.checkCategory('JPEG Image');
+ await creatorFilter.checkCategory(user1);
+
+ expect(await page.getResultsFoundText()).toEqual('1 result found');
+
+ await page.removeChip('JPEG Image');
+ await page.removeChip(`${user1} ${user1}`);
+
+ expect(await page.getResultsFoundText()).toEqual('2 results found');
+ });
+
+ it('Pagination is correct when search results are filtered - [C279188]', async () => {
+ await fileTypeFilter.expandPanel();
+ await fileTypeFilter.checkCategory('JPEG Image');
+ await creatorFilter.checkCategory(user1);
+
+ expect(await page.pagination.getRange()).toEqual('Showing 1-1 of 1');
+
+ await page.removeChip('JPEG Image');
+ await page.removeChip(`${user1} ${user1}`);
+
+ expect(await page.pagination.getRange()).toEqual('Showing 1-2 of 2');
+ });
+
+ it('The filter facets display is updated when making a new query - [C308042]', async () => {
+ expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes);
+ expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators);
+ expect(await modifierFilter.getFiltersValues()).toEqual(expectedModifiers);
+ expect(await locationFilter.getFiltersValues()).toEqual(expectedLocations);
+
+ await searchInput.clickSearchButton();
+ await searchInput.searchFor(fileJpgUser1.name);
+ await dataTable.waitForBody();
+
+ expect(await fileTypeFilter.getFiltersValues()).toEqual(['JPEG Image (1)']);
+ expect(await creatorFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`]);
+ expect(await modifierFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`]);
+ expect(await locationFilter.getFiltersValues()).toEqual([`${site} (1)`]);
+ });
+ });
+});
diff --git a/e2e/suites/search/search-input.test.ts b/e2e/suites/search/search-input.test.ts
index ac57d4d98..d692d5569 100644
--- a/e2e/suites/search/search-input.test.ts
+++ b/e2e/suites/search/search-input.test.ts
@@ -48,13 +48,13 @@ describe('Search input', () => {
it('Search options are displayed when clicking in the search input - [C289848]', async () => {
await searchInput.clickSearchButton();
- expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, '1. Search options not displayed');
- expect(await searchInput.isFilesOptionEnabled()).toBe(true, '2. Files option not enabled');
- expect(await searchInput.isFoldersOptionEnabled()).toBe(true, '3. Folders option not enabled');
- expect(await searchInput.isLibrariesOptionEnabled()).toBe(true, '4. Libraries option not enabled');
- expect(await searchInput.isFilesOptionChecked()).toBe(false, '5. Files option is checked');
- expect(await searchInput.isFoldersOptionChecked()).toBe(false, '6. Folders option is checked');
- expect(await searchInput.isLibrariesOptionChecked()).toBe(false, '7. Libraries option is checked');
+ expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, 'Search options not displayed');
+ expect(await searchInput.isFilesOptionEnabled()).toBe(true, 'Files option not enabled');
+ expect(await searchInput.isFoldersOptionEnabled()).toBe(true, 'Folders option not enabled');
+ expect(await searchInput.isLibrariesOptionEnabled()).toBe(true, 'Libraries option not enabled');
+ expect(await searchInput.isFilesOptionChecked()).toBe(false, 'Files option is checked');
+ expect(await searchInput.isFoldersOptionChecked()).toBe(false, 'Folders option is checked');
+ expect(await searchInput.isLibrariesOptionChecked()).toBe(false, 'Libraries option is checked');
});
it('Search options are correctly enabled / disabled - [C289849]', async () => {
diff --git a/e2e/suites/search/search-results-files-folders.test.ts b/e2e/suites/search/search-results-files-folders.test.ts
index db589b197..bad389200 100644
--- a/e2e/suites/search/search-results-files-folders.test.ts
+++ b/e2e/suites/search/search-results-files-folders.test.ts
@@ -60,19 +60,9 @@ describe('Search results - files and folders', () => {
beforeAll(async done => {
await apis.admin.people.createUser({ username });
- fileId = (await apis.user.nodes.createFile(
- file,
- '-my-',
- fileTitle,
- fileDescription
- )).entry.id;
+ fileId = (await apis.user.nodes.createFile(file, '-my-', fileTitle, fileDescription)).entry.id;
await apis.user.nodes.editNodeContent(fileId, 'edited by user');
- folderId = (await apis.user.nodes.createFolder(
- folder,
- '-my-',
- folderTitle,
- folderDescription
- )).entry.id;
+ folderId = (await apis.user.nodes.createFolder(folder, '-my-', folderTitle, folderDescription)).entry.id;
fileRussianId = (await apis.user.nodes.createFile(fileRussian)).entry.id;
await apis.user.sites.createSite(site);
@@ -83,6 +73,11 @@ describe('Search results - files and folders', () => {
done();
});
+ beforeEach(async done => {
+ await page.refresh();
+ done();
+ });
+
afterAll(async done => {
await Promise.all([
apis.user.nodes.deleteNodeById(fileId),
@@ -93,20 +88,13 @@ describe('Search results - files and folders', () => {
done();
});
- beforeEach(async done => {
- await page.refresh();
- done();
- });
-
it('Results page title - [C307002]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('test-');
await dataTable.waitForBody();
- expect(await page.breadcrumb.getCurrentItemName()).toEqual(
- 'Search Results'
- );
+ expect(await page.breadcrumb.getCurrentItemName()).toEqual('Search Results');
});
it('File information - [C279183]', async () => {
@@ -116,38 +104,17 @@ describe('Search results - files and folders', () => {
await dataTable.waitForBody();
const fileEntry = await apis.user.nodes.getNodeById(fileId);
- const modifiedDate = moment(fileEntry.entry.modifiedAt).format(
- 'MMM D, YYYY, h:mm:ss A'
- );
+ const modifiedDate = moment(fileEntry.entry.modifiedAt).format('MMM D, YYYY, h:mm:ss A');
const modifiedBy = fileEntry.entry.modifiedByUser.displayName;
const size = fileEntry.entry.content.sizeInBytes;
- expect(await dataTable.isItemPresent(file)).toBe(
- true,
- `${file} is not displayed`
- );
-
- expect(await dataTable.getRowCellsCount(file)).toEqual(
- 2,
- 'incorrect number of columns'
- );
-
- expect(await dataTable.getSearchResultLinesCount(file)).toEqual(
- 4,
- 'incorrect number of lines for search result'
- );
- expect(await dataTable.getSearchResultNameAndTitle(file)).toBe(
- `${file} ( ${fileTitle} )`
- );
- expect(await dataTable.getSearchResultDescription(file)).toBe(
- fileDescription
- );
- expect(await dataTable.getSearchResultModified(file)).toBe(
- `Modified: ${modifiedDate} by ${modifiedBy} | Size: ${size} Bytes`
- );
- expect(await dataTable.getSearchResultLocation(file)).toMatch(
- /Location:\s+Personal Files/
- );
+ expect(await dataTable.isItemPresent(file)).toBe(true, `${file} is not displayed`);
+ expect(await dataTable.getRowCellsCount(file)).toEqual(2, 'incorrect number of columns');
+ expect(await dataTable.getSearchResultLinesCount(file)).toEqual(4, 'incorrect number of lines for search result');
+ expect(await dataTable.getSearchResultNameAndTitle(file)).toBe(`${file} ( ${fileTitle} )`);
+ expect(await dataTable.getSearchResultDescription(file)).toBe(fileDescription);
+ expect(await dataTable.getSearchResultModified(file)).toBe(`Modified: ${modifiedDate} by ${modifiedBy} | Size: ${size} Bytes`);
+ expect(await dataTable.getSearchResultLocation(file)).toMatch(/Location:\s+Personal Files/);
});
it('Folder information - [C306867]', async () => {
@@ -157,37 +124,16 @@ describe('Search results - files and folders', () => {
await dataTable.waitForBody();
const folderEntry = await apis.user.nodes.getNodeById(folderId);
- const modifiedDate = moment(folderEntry.entry.modifiedAt).format(
- 'MMM D, YYYY, h:mm:ss A'
- );
+ const modifiedDate = moment(folderEntry.entry.modifiedAt).format('MMM D, YYYY, h:mm:ss A');
const modifiedBy = folderEntry.entry.modifiedByUser.displayName;
- expect(await dataTable.isItemPresent(folder)).toBe(
- true,
- `${folder} is not displayed`
- );
-
- expect(await dataTable.getRowCellsCount(folder)).toEqual(
- 2,
- 'incorrect number of columns'
- );
-
- expect(await dataTable.getSearchResultLinesCount(folder)).toEqual(
- 4,
- 'incorrect number of lines for search result'
- );
- expect(await dataTable.getSearchResultNameAndTitle(folder)).toBe(
- `${folder} ( ${folderTitle} )`
- );
- expect(await dataTable.getSearchResultDescription(folder)).toBe(
- folderDescription
- );
- expect(await dataTable.getSearchResultModified(folder)).toBe(
- `Modified: ${modifiedDate} by ${modifiedBy}`
- );
- expect(await dataTable.getSearchResultLocation(folder)).toMatch(
- /Location:\s+Personal Files/
- );
+ expect(await dataTable.isItemPresent(folder)).toBe(true, `${folder} is not displayed`);
+ expect(await dataTable.getRowCellsCount(folder)).toEqual(2, 'incorrect number of columns');
+ expect(await dataTable.getSearchResultLinesCount(folder)).toEqual(4, 'incorrect number of lines for search result');
+ expect(await dataTable.getSearchResultNameAndTitle(folder)).toBe(`${folder} ( ${folderTitle} )`);
+ expect(await dataTable.getSearchResultDescription(folder)).toBe(folderDescription);
+ expect(await dataTable.getSearchResultModified(folder)).toBe(`Modified: ${modifiedDate} by ${modifiedBy}`);
+ expect(await dataTable.getSearchResultLocation(folder)).toMatch(/Location:\s+Personal Files/);
});
it('Search file with special characters - [C290029]', async () => {
@@ -196,10 +142,7 @@ describe('Search results - files and folders', () => {
await searchInput.searchFor(fileRussian);
await dataTable.waitForBody();
- expect(await dataTable.isItemPresent(fileRussian)).toBe(
- true,
- `${fileRussian} is not displayed`
- );
+ expect(await dataTable.isItemPresent(fileRussian)).toBe(true, `${fileRussian} is not displayed`);
});
it('Location column redirect - file in user Home - [C279177]', async () => {
diff --git a/e2e/suites/search/search-results-libraries.test.ts b/e2e/suites/search/search-results-libraries.test.ts
index a40ed84f7..f958fdc03 100644
--- a/e2e/suites/search/search-results-libraries.test.ts
+++ b/e2e/suites/search/search-results-libraries.test.ts
@@ -63,7 +63,6 @@ describe('Search results - libraries', () => {
const adminSite2 = `admin-site-${Utils.random()}`;
const adminSite3 = `admin-site-${Utils.random()}`;
const adminSite4 = `admin-site-${Utils.random()}`;
-
const adminPrivate = `admin-site-${Utils.random()}`;
const apis = {
diff --git a/e2e/suites/search/search-sorting.test.ts b/e2e/suites/search/search-sorting.test.ts
new file mode 100644
index 000000000..3e34c1e2d
--- /dev/null
+++ b/e2e/suites/search/search-sorting.test.ts
@@ -0,0 +1,202 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { LoginPage, SearchResultsPage } from '../../pages/pages';
+import { RepoClient } from '../../utilities/repo-client/repo-client';
+import { Utils } from '../../utilities/utils';
+import { FILES } from '../../configs';
+
+describe('Search sorting', () => {
+ const random = Utils.random();
+
+ const user1 = `user1-${random}`;
+ const user2 = `user2-${random}`;
+
+ const parent = `parent-${random}`;
+ let parentId: string;
+
+ const fileJpg = {
+ name: `search-sort-file-1-${random}.jpg`,
+ source: FILES.jpgFile
+ };
+
+ const filePdf = {
+ name: `search-sort-file-2-${random}.pdf`,
+ title: 'search sort title',
+ description: 'search sort',
+ source: FILES.pdfFile
+ };
+
+ const apis = {
+ admin: new RepoClient(),
+ user1: new RepoClient(user1, user1),
+ user2: new RepoClient(user2, user2)
+ };
+
+ const loginPage = new LoginPage();
+ const page = new SearchResultsPage();
+ const { searchInput } = page.header;
+ const { dataTable } = page;
+
+ beforeAll(async (done) => {
+ await apis.admin.people.createUser({ username: user1 });
+ await apis.admin.people.createUser({ username: user2 });
+ parentId = (await apis.user1.nodes.createFolder(parent)).entry.id;
+
+ await apis.user1.nodes.setGranularPermission(parentId, true, user2, 'Collaborator');
+
+ await apis.user1.upload.uploadFileWithRename(fileJpg.source, parentId, fileJpg.name);
+ await apis.user2.upload.uploadFileWithRename(filePdf.source, parentId, filePdf.name, filePdf.title, filePdf.description);
+
+ await apis.user1.search.waitForNodes('search-sort', { expect: 2 });
+
+ await loginPage.loginWith(user1);
+ done();
+ });
+
+ beforeEach(async (done) => {
+ await Utils.pressEscape();
+ await page.clickPersonalFilesAndWait();
+
+ await searchInput.clickSearchButton();
+ await searchInput.searchFor('search sort');
+ await dataTable.waitForBody();
+ done();
+ });
+
+ afterAll(async () => {
+ await apis.user1.nodes.deleteNodeById(parentId);
+ });
+
+ it('Sorting options are displayed - [C277722]', async () => {
+ expect(await page.sortingPicker.isSortOrderButtonDisplayed()).toBe(true, 'Sort order button not displayed');
+ expect(await page.sortingPicker.isSortByOptionDisplayed()).toBe(true, 'Sort options not displayed');
+ expect(await page.sortingPicker.getSortOrder()).toBe('DESC', 'Incorrect default sort order');
+ expect(await page.sortingPicker.getSelectedSortByOption()).toBe('Relevance', 'Incorrect selected sort option');
+
+ await page.sortingPicker.clickSortByDropdown();
+
+ const expectedOptions = [ 'Relevance', 'Filename', 'Title', 'Modified date', 'Modifier', 'Created date', 'Size', 'Type' ];
+ expect(await page.sortingPicker.getSortByOptionsList()).toEqual(expectedOptions, 'Incorrect sort options list');
+ });
+
+ it('Sort by Name - [C277728]', async () => {
+ await page.sortingPicker.sortByName();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByName();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+
+ it('Sort by Type - [C277740]', async () => {
+ await page.sortingPicker.sortByType();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+
+ await page.sortingPicker.sortByType();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+ });
+
+ it('Sort by Size - [C277738]', async () => {
+ await page.sortingPicker.sortBySize();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+
+ await page.sortingPicker.sortBySize();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+ });
+
+ it('Sort by Created date - [C277734]', async () => {
+ await page.sortingPicker.sortByCreatedDate();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByCreatedDate();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+
+ it('Sort by Modified date - [C277736]', async () => {
+ await page.sortingPicker.sortByModifiedDate();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByModifiedDate();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+
+ it('Sort by Relevance - [C277727]', async () => {
+ await page.sortingPicker.sortByRelevance();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByRelevance();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+
+ it('Sort by Modifier - [C277732]', async () => {
+ await page.sortingPicker.sortByModifier();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByModifier();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+});
diff --git a/e2e/utilities/repo-client/apis/upload/upload-api.ts b/e2e/utilities/repo-client/apis/upload/upload-api.ts
index 2e9bcaea8..e9db895e9 100644
--- a/e2e/utilities/repo-client/apis/upload/upload-api.ts
+++ b/e2e/utilities/repo-client/apis/upload/upload-api.ts
@@ -51,8 +51,15 @@ export class UploadApi extends RepoApi {
}
}
- async uploadFileWithRename(fileName: string, parentFolderId: string = '-my-', newName: string) {
+ async uploadFileWithRename(fileName: string, parentId: string = '-my-', newName: string, title: string = '', description: string = '') {
const file = fs.createReadStream(`${E2E_ROOT_PATH}/resources/test-files/${fileName}`);
+ const nodeProps = {
+ properties: {
+ 'cm:title': title,
+ 'cm:description': description
+ }
+ };
+
const opts = {
name: newName,
nodeType: 'cm:content'
@@ -60,7 +67,7 @@ export class UploadApi extends RepoApi {
try {
await this.apiAuth();
- return await this.upload.uploadFile(file, '', parentFolderId, null, opts);
+ return await this.upload.uploadFile(file, '', parentId, nodeProps, opts);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error);
}
diff --git a/e2e/utilities/utils.ts b/e2e/utilities/utils.ts
index 886b57507..fba5052fd 100755
--- a/e2e/utilities/utils.ts
+++ b/e2e/utilities/utils.ts
@@ -92,6 +92,13 @@ export class Utils {
}
}
+ static async clearFieldWithBackspace(elem: ElementFinder): Promise {
+ const text = await elem.getAttribute('value');
+ for (let i = 0; i < text.length; i++) {
+ await elem.sendKeys(protractor.Key.BACK_SPACE);
+ }
+ }
+
static async fileExistsOnOS(fileName: string, folderName: string = '', subFolderName: string = '') {
const config = await browser.getProcessedConfig();
const filePath = path.join(config.params.downloadFolder, folderName, subFolderName, fileName);