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..942524e9c
--- /dev/null
+++ b/e2e/components/search/filters/facet-filter.ts
@@ -0,0 +1,94 @@
+/*!
+ * @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 } 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 option.click();
+ }
+
+ 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..ba75bbf41 100755
--- a/e2e/pages/search-results-page.ts
+++ b/e2e/pages/search-results-page.ts
@@ -23,37 +23,54 @@
* 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();
}
}