alfresco-ng2-components/e2e/pages/adf/searchResultsPage.ts
Eugenio Romano 990fa4625b
fix ordering e2e failing test (#4825)
* ordering fix use common method in datatable

* ordering fix use common method in datatable

* fix sorting ps e2e

* fix ordering

* move search page in testing and fix sorting boolean flag

* fix import

* fix moment

* use common sort method in document list test

* use common sort method in document list test

* remove unnecesary sort control

* remove duplicate test

* remove e2e suspended removed status

* documentation
2019-06-11 07:34:16 +01:00

101 lines
3.1 KiB
TypeScript

/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { ContentServicesPage } from './contentServicesPage';
import { BrowserVisibility, SearchSortingPickerPage } from '@alfresco/adf-testing';
export class SearchResultsPage {
noResultsMessage = element(by.css('div[class="adf-no-result-message"]'));
dataTable = new DataTableComponentPage();
searchSortingPicker = new SearchSortingPickerPage();
contentServices = new ContentServicesPage();
getNodeHighlight(content) {
return this.dataTable.getCellByRowContentAndColumn('Display name', content, 'Search');
}
tableIsLoaded() {
this.dataTable.tableIsLoaded();
}
checkContentIsDisplayed(content) {
this.dataTable.checkContentIsDisplayed('Display name', content);
return this;
}
numberOfResultsDisplayed() {
return this.dataTable.numberOfRows();
}
checkContentIsNotDisplayed(content) {
this.dataTable.checkContentIsNotDisplayed('Display name', content);
return this;
}
checkNoResultMessageIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.noResultsMessage);
return this;
}
checkNoResultMessageIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.noResultsMessage);
return this;
}
navigateToFolder(content) {
this.dataTable.doubleClickRow('Display name', content);
return this;
}
deleteContent(content) {
this.contentServices.deleteContent(content);
}
sortByName(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Name');
}
sortByAuthor(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Author');
}
sortByCreated(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Created');
}
sortBySize(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Size');
return this;
}
async checkListIsOrderedByNameAsc() {
return this.contentServices.contentList.dataTablePage().checkListIsSorted('ASC', 'Display name');
}
async checkListIsOrderedByNameDesc() {
return this.contentServices.contentList.dataTablePage().checkListIsSorted('DESC', 'Display name');
}
async checkListIsOrderedByAuthorAsc() {
return this.contentServices.contentList.dataTablePage().checkListIsSorted('ASC', 'Created by');
}
}