mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3381][ADF-3492] search results improvements (#3727)
* search results improvements * fix search term formatting * rollback the query change * fix search test * lint fix * lint fix * search page component to ts
This commit is contained in:
committed by
Eugenio Romano
parent
0fc504b69e
commit
415d2185b1
@@ -73,12 +73,17 @@
|
||||
"options": [
|
||||
{ "key": "name", "label": "Name", "type": "FIELD", "field": "cm:name", "ascending": true },
|
||||
{ "key": "content.sizeInBytes", "label": "Size", "type": "FIELD", "field": "content.size", "ascending": true },
|
||||
{ "key": "description", "label": "Description", "type": "FIELD", "field": "cm:description", "ascending": true },
|
||||
{ "key": "createdByUser", "label": "Author", "type": "FIELD", "field": "cm:creator", "ascending": true },
|
||||
{ "key": "createdAt", "label": "Created", "type": "FIELD", "field": "cm:created", "ascending": true }
|
||||
{ "key": "createdAt", "label": "Created", "type": "FIELD", "field": "cm:created", "ascending": true },
|
||||
{ "key": "score", "label": "Relevance", "type": "FIELD", "field": "score", "ascending": false}
|
||||
],
|
||||
"defaults": [
|
||||
{ "key": "name", "type": "FIELD", "field": "cm:name", "ascending": true }
|
||||
{
|
||||
"key": "score",
|
||||
"type": "FIELD",
|
||||
"field": "score",
|
||||
"ascending": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"filterQueries": [
|
||||
@@ -101,11 +106,11 @@
|
||||
"queries": [
|
||||
{ "query": "created:2018", "label": "1.Created This Year" },
|
||||
{ "query": "content.mimetype", "label": "2.Type" },
|
||||
{ "query": "content.size:[0 TO 10240]", "label": "3.Size: xtra small"},
|
||||
{ "query": "content.size:[0 TO 10240]", "label": "3.Size: Extra small"},
|
||||
{ "query": "content.size:[10240 TO 102400]", "label": "4.Size: small"},
|
||||
{ "query": "content.size:[102400 TO 1048576]", "label": "5.Size: medium" },
|
||||
{ "query": "content.size:[1048576 TO 16777216]", "label": "6.Size: large" },
|
||||
{ "query": "content.size:[16777216 TO 134217728]", "label": "7.Size: xtra large" },
|
||||
{ "query": "content.size:[16777216 TO 134217728]", "label": "7.Size: Extra large" },
|
||||
{ "query": "content.size:[134217728 TO MAX]", "label": "8.Size: XX large" }
|
||||
]
|
||||
},
|
||||
|
@@ -1,11 +1,3 @@
|
||||
|
||||
<adf-search [searchTerm]="searchedWord"
|
||||
[maxResults]="maxItems"
|
||||
[skipResults]="skipCount"
|
||||
(resultLoaded)="onSearchResultLoaded($event)"
|
||||
#searchResult>
|
||||
</adf-search>
|
||||
|
||||
<div class="adf-search-results__facets">
|
||||
<adf-search-chip-list [searchFilter]="searchFilter"></adf-search-chip-list>
|
||||
</div>
|
||||
@@ -14,6 +6,7 @@
|
||||
<adf-search-filter #searchFilter></adf-search-filter>
|
||||
|
||||
<div class="adf-search-results__content">
|
||||
<mat-progress-bar *ngIf="isLoading" color="primary" mode="indeterminate"></mat-progress-bar>
|
||||
<div class="adf-search-results__sorting">
|
||||
<adf-search-sorting-picker></adf-search-sorting-picker>
|
||||
</div>
|
||||
@@ -25,7 +18,7 @@
|
||||
[showSitePicker]="false"
|
||||
[showSettingsPanel]="false"
|
||||
[currentFolderId]="null"
|
||||
[nodeResult]="resultNodePageList"
|
||||
[nodeResult]="data"
|
||||
[disableDragArea]="true"
|
||||
[pagination]="pagination"
|
||||
(changedPageSize)="onRefreshPagination($event)"
|
||||
@@ -33,7 +26,7 @@
|
||||
(turnedNextPage)="onRefreshPagination($event)"
|
||||
(loadNext)="onRefreshPagination($event)"
|
||||
(turnedPreviousPage)="onRefreshPagination($event)"
|
||||
(deleteElementSuccess)="onDeleteElementSuccess($event)">
|
||||
(deleteElementSuccess)="onDeleteElementSuccess()">
|
||||
</app-files-component>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -15,11 +15,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit, Optional, ViewChild, OnDestroy } from '@angular/core';
|
||||
import { Component, OnInit, Optional, OnDestroy } from '@angular/core';
|
||||
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||
import { NodePaging, Pagination } from 'alfresco-js-api';
|
||||
import { SearchComponent, SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { UserPreferencesService, SearchService, SearchConfigurationService } from '@alfresco/adf-core';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { UserPreferencesService, SearchService } from '@alfresco/adf-core';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
@@ -30,15 +30,11 @@ import { Subscription } from 'rxjs';
|
||||
})
|
||||
export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
|
||||
@ViewChild('searchResult')
|
||||
searchResult: SearchComponent;
|
||||
|
||||
queryParamName = 'q';
|
||||
searchedWord = '';
|
||||
resultNodePageList: NodePaging;
|
||||
data: NodePaging;
|
||||
pagination: Pagination;
|
||||
maxItems: number;
|
||||
skipCount = 0;
|
||||
isLoading = true;
|
||||
|
||||
sorting = ['name', 'asc'];
|
||||
|
||||
@@ -47,9 +43,7 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
constructor(public router: Router,
|
||||
private preferences: UserPreferencesService,
|
||||
private queryBuilder: SearchQueryBuilderService,
|
||||
private searchConfiguration: SearchConfigurationService,
|
||||
@Optional() private route: ActivatedRoute) {
|
||||
this.maxItems = this.preferences.paginationSize;
|
||||
queryBuilder.paging = {
|
||||
maxItems: this.preferences.paginationSize,
|
||||
skipCount: 0
|
||||
@@ -63,36 +57,55 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
this.subscriptions.push(
|
||||
this.queryBuilder.updated.subscribe(() => {
|
||||
this.sorting = this.getSorting();
|
||||
this.isLoading = true;
|
||||
}),
|
||||
|
||||
this.queryBuilder.executed.subscribe(data => {
|
||||
this.onSearchResultLoaded(data);
|
||||
this.isLoading = false;
|
||||
})
|
||||
);
|
||||
|
||||
if (this.route) {
|
||||
this.route.params.forEach((params: Params) => {
|
||||
this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null;
|
||||
if (this.searchedWord) {
|
||||
const queryBody = this.searchConfiguration.generateQueryBody(this.searchedWord, 0, 100);
|
||||
const query = this.formatSearchQuery(this.searchedWord);
|
||||
|
||||
this.queryBuilder.userQuery = queryBody.query.query;
|
||||
if (query) {
|
||||
this.queryBuilder.userQuery = query;
|
||||
this.queryBuilder.update();
|
||||
} else {
|
||||
this.queryBuilder.userQuery = null;
|
||||
this.queryBuilder.executed.next({ list: { pagination: { totalItems: 0 }, entries: [] } });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private formatSearchQuery(userInput: string) {
|
||||
if (!userInput) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const suffix = userInput.lastIndexOf('*') >= 0 ? '' : '*';
|
||||
const query = `cm:name:${userInput}${suffix} OR cm:title:${userInput}${suffix} OR cm:description:${userInput}${suffix}
|
||||
OR ia:whatEvent:${userInput}${suffix} OR ia:descriptionEvent:${userInput}${suffix} OR lnk:title:${userInput}${suffix}
|
||||
OR lnk:description:${userInput}${suffix} OR TEXT:${userInput}${suffix} OR TAG:${userInput}${suffix}`;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => subscription.unsubscribe());
|
||||
this.subscriptions = [];
|
||||
}
|
||||
|
||||
onSearchResultLoaded(nodePaging: NodePaging) {
|
||||
this.resultNodePageList = nodePaging;
|
||||
this.pagination = {...nodePaging.list.pagination };
|
||||
this.data = nodePaging;
|
||||
this.pagination = { ...nodePaging.list.pagination };
|
||||
}
|
||||
|
||||
onRefreshPagination(pagination: Pagination) {
|
||||
this.maxItems = pagination.maxItems;
|
||||
this.skipCount = pagination.skipCount;
|
||||
|
||||
this.queryBuilder.paging = {
|
||||
maxItems: pagination.maxItems,
|
||||
skipCount: pagination.skipCount
|
||||
@@ -100,8 +113,8 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
this.queryBuilder.update();
|
||||
}
|
||||
|
||||
onDeleteElementSuccess(element: any) {
|
||||
this.searchResult.reload();
|
||||
onDeleteElementSuccess() {
|
||||
this.queryBuilder.execute();
|
||||
}
|
||||
|
||||
private getSorting(): string[] {
|
||||
|
@@ -21,7 +21,7 @@ import { LoginPage } from '../../pages/adf/loginPage';
|
||||
import SearchDialog = require('../../pages/adf/dialog/searchDialog');
|
||||
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
|
||||
import filePreviewPage = require('../../pages/adf/filePreviewPage');
|
||||
import SearchResultPage = require('../../pages/adf/searchResultsPage');
|
||||
import { SearchResultsPage } from '../../pages/adf/searchResultsPage';
|
||||
|
||||
import AcsUserModel = require('../../models/ACS/acsUserModel');
|
||||
import FileModel = require('../../models/ACS/fileModel');
|
||||
@@ -47,7 +47,7 @@ describe('Search component - Search Bar', () => {
|
||||
let loginPage = new LoginPage();
|
||||
let contentServicesPage = new ContentServicesPage();
|
||||
let searchDialog = new SearchDialog();
|
||||
let searchResultPage = new SearchResultPage();
|
||||
let searchResultPage = new SearchResultsPage();
|
||||
|
||||
let acsUser = new AcsUserModel();
|
||||
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { LoginPage } from '../../pages/adf/loginPage';
|
||||
import SearchDialog = require('../../pages/adf/dialog/searchDialog');
|
||||
import SearchFiltersPage = require('../../pages/adf/searchFiltersPage');
|
||||
import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage';
|
||||
|
||||
import AcsUserModel = require('../../models/ACS/acsUserModel');
|
||||
import FileModel = require('../../models/ACS/fileModel');
|
||||
|
@@ -26,8 +26,8 @@ import { browser } from 'protractor';
|
||||
|
||||
import { LoginPage } from '../../pages/adf/loginPage';
|
||||
import SearchDialog = require('../../pages/adf/dialog/searchDialog');
|
||||
import SearchResultPage = require('../../pages/adf/searchResultsPage');
|
||||
import SearchFiltersPage = require('../../pages/adf/searchFiltersPage');
|
||||
import { SearchResultsPage } from '../../pages/adf/searchResultsPage';
|
||||
import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage';
|
||||
|
||||
import AcsUserModel = require('../../models/ACS/acsUserModel');
|
||||
import FileModel = require('../../models/ACS/fileModel');
|
||||
@@ -35,7 +35,7 @@ import FileModel = require('../../models/ACS/fileModel');
|
||||
describe('Search Component - Multi-Select Facet', () => {
|
||||
let loginPage = new LoginPage();
|
||||
let searchDialog = new SearchDialog();
|
||||
let searchResultsPage = new SearchResultPage();
|
||||
let searchResultsPage = new SearchResultsPage();
|
||||
let uploadActions = new UploadActions();
|
||||
let searchFiltersPage = new SearchFiltersPage();
|
||||
let site;
|
||||
@@ -51,13 +51,14 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
let jpgFile, jpgFileSite, txtFile, txtFileSite;
|
||||
let acsUser = new AcsUserModel();
|
||||
|
||||
let randomName = Util.generateRandomString();
|
||||
let jpgFileInfo = new FileModel({
|
||||
'location': resources.Files.ADF_DOCUMENTS.JPG.file_location,
|
||||
'name': resources.Files.ADF_DOCUMENTS.JPG.file_name
|
||||
'name': `${randomName}.jpg`
|
||||
});
|
||||
let txtFileInfo = new FileModel({
|
||||
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location,
|
||||
'name': resources.Files.ADF_DOCUMENTS.TXT_0B.file_name
|
||||
'name': `${randomName}.txt`
|
||||
});
|
||||
|
||||
beforeAll(async (done) => {
|
||||
@@ -80,13 +81,13 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
|
||||
txtFileSite = await uploadActions.uploadFile(this.alfrescoJsApi, txtFileInfo.location, txtFileInfo.name, site.entry.guid);
|
||||
|
||||
await browser.driver.sleep(30000);
|
||||
await browser.driver.sleep(10000);
|
||||
|
||||
loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||
|
||||
searchDialog.checkSearchIconIsVisible();
|
||||
searchDialog.clickOnSearchIcon();
|
||||
searchDialog.enterTextAndPressEnter('file');
|
||||
searchDialog.enterTextAndPressEnter(`${randomName}`);
|
||||
|
||||
searchFiltersPage.checkSearchFiltersIsDisplayed();
|
||||
searchFiltersPage.filterByCreator(acsUser.firstName, acsUser.lastName);
|
||||
@@ -129,13 +130,14 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
let userUploadingTxt = new AcsUserModel();
|
||||
let userUploadingImg = new AcsUserModel();
|
||||
|
||||
let randomName = Util.generateRandomString();
|
||||
let jpgFileInfo = new FileModel({
|
||||
'location': resources.Files.ADF_DOCUMENTS.JPG.file_location,
|
||||
'name': resources.Files.ADF_DOCUMENTS.JPG.file_name
|
||||
'name': `${randomName}.jpg`
|
||||
});
|
||||
let txtFileInfo = new FileModel({
|
||||
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location,
|
||||
'name': resources.Files.ADF_DOCUMENTS.TXT_0B.file_name
|
||||
'name': `${randomName}.txt`
|
||||
});
|
||||
|
||||
beforeAll(async (done) => {
|
||||
@@ -162,26 +164,13 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
|
||||
jpgFile = await uploadActions.uploadFile(this.alfrescoJsApi, jpgFileInfo.location, jpgFileInfo.name, site.entry.guid);
|
||||
|
||||
await browser.driver.sleep(30000);
|
||||
await browser.driver.sleep(10000);
|
||||
|
||||
loginPage.loginToContentServicesUsingUserModel(userUploadingImg);
|
||||
|
||||
searchDialog.checkSearchIconIsVisible();
|
||||
searchDialog.clickOnSearchIcon();
|
||||
searchDialog.enterTextAndPressEnter('file');
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||
|
||||
Promise.all([
|
||||
uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, jpgFile.entry.id),
|
||||
uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, txtFile.entry.id)
|
||||
]);
|
||||
|
||||
await this.alfrescoJsApi.core.sitesApi.deleteSite(site.entry.id);
|
||||
searchDialog.enterTextAndPressEnter(`*${randomName}*`);
|
||||
|
||||
done();
|
||||
});
|
||||
@@ -190,6 +179,7 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
searchFiltersPage.checkSearchFiltersIsDisplayed();
|
||||
|
||||
searchFiltersPage.filterByCreator(userUploadingTxt.firstName, userUploadingTxt.lastName);
|
||||
|
||||
searchFiltersPage.filterByCreator(userUploadingImg.firstName, userUploadingImg.lastName);
|
||||
|
||||
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
|
||||
@@ -208,9 +198,10 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
let txtFile;
|
||||
let acsUser = new AcsUserModel();
|
||||
|
||||
let randomName = Util.generateRandomString();
|
||||
let txtFileInfo = new FileModel({
|
||||
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location,
|
||||
'name': resources.Files.ADF_DOCUMENTS.TXT_0B.file_name
|
||||
'name': `${randomName}.txt`
|
||||
});
|
||||
|
||||
beforeAll(async (done) => {
|
||||
@@ -226,13 +217,13 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
});
|
||||
|
||||
txtFile = await uploadActions.uploadFile(this.alfrescoJsApi, txtFileInfo.location, txtFileInfo.name, '-my-');
|
||||
await browser.driver.sleep(30000);
|
||||
await browser.driver.sleep(10000);
|
||||
|
||||
loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||
|
||||
searchDialog.checkSearchIconIsVisible();
|
||||
searchDialog.clickOnSearchIcon();
|
||||
searchDialog.enterTextAndPressEnter('file');
|
||||
searchDialog.enterTextAndPressEnter(`*${randomName}*`);
|
||||
|
||||
searchFiltersPage.checkSearchFiltersIsDisplayed();
|
||||
|
||||
|
@@ -21,7 +21,7 @@ import { LoginPage } from '../../pages/adf/loginPage';
|
||||
|
||||
import SearchDialog = require('../../pages/adf/dialog/searchDialog');
|
||||
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
|
||||
import SearchResultPage = require('../../pages/adf/searchResultsPage');
|
||||
import { SearchResultsPage } from '../../pages/adf/searchResultsPage';
|
||||
import filePreviewPage = require('../../pages/adf/filePreviewPage');
|
||||
|
||||
import AcsUserModel = require('../../models/ACS/acsUserModel');
|
||||
@@ -40,7 +40,7 @@ describe('Search component - Search Page', () => {
|
||||
active: {
|
||||
firstFile: null,
|
||||
secondFile: null,
|
||||
base: Util.generateRandomString(3),
|
||||
base: Util.generateRandomString(7),
|
||||
extension: '.txt'
|
||||
},
|
||||
no_permission: {
|
||||
@@ -52,7 +52,7 @@ describe('Search component - Search Page', () => {
|
||||
let loginPage = new LoginPage();
|
||||
let contentServicesPage = new ContentServicesPage();
|
||||
let searchDialog = new SearchDialog();
|
||||
let searchResultPage = new SearchResultPage();
|
||||
let searchResultPage = new SearchResultsPage();
|
||||
|
||||
let acsUser = new AcsUserModel();
|
||||
let emptyFolderModel = new FolderModel({ 'name': Util.generateRandomString() });
|
||||
@@ -206,6 +206,7 @@ describe('Search component - Search Page', () => {
|
||||
.checkSearchIconIsVisible()
|
||||
.clickOnSearchIcon()
|
||||
.enterTextAndPressEnter(search.active.base);
|
||||
|
||||
searchResultPage.checkContentIsDisplayed(search.active.secondFile);
|
||||
searchResultPage.sortAndCheckListIsOrderedByName(true).then((result) => {
|
||||
expect(result).toEqual(true);
|
||||
@@ -215,7 +216,8 @@ describe('Search component - Search Page', () => {
|
||||
it('[C272804] Should be able to sort results by name (Descending)', () => {
|
||||
contentServicesPage.goToDocumentList();
|
||||
|
||||
searchDialog.checkSearchBarIsNotVisible()
|
||||
searchDialog
|
||||
.checkSearchBarIsNotVisible()
|
||||
.checkSearchIconIsVisible()
|
||||
.clickOnSearchIcon()
|
||||
.enterTextAndPressEnter(search.active.base);
|
||||
@@ -228,8 +230,13 @@ describe('Search component - Search Page', () => {
|
||||
|
||||
it('[C272805] Should be able to sort results by author (Ascending)', () => {
|
||||
contentServicesPage.goToDocumentList();
|
||||
searchDialog.checkSearchBarIsNotVisible().checkSearchIconIsVisible().clickOnSearchIcon()
|
||||
|
||||
searchDialog
|
||||
.checkSearchBarIsNotVisible()
|
||||
.checkSearchIconIsVisible()
|
||||
.clickOnSearchIcon()
|
||||
.enterTextAndPressEnter(search.active.base);
|
||||
|
||||
searchResultPage.checkContentIsDisplayed(search.active.secondFile);
|
||||
searchResultPage.sortAndCheckListIsOrderedByAuthor(true).then((result) => {
|
||||
expect(result).toEqual(true);
|
||||
@@ -238,8 +245,13 @@ describe('Search component - Search Page', () => {
|
||||
|
||||
it('[C272806] Should be able to sort results by author (Descending)', () => {
|
||||
contentServicesPage.goToDocumentList();
|
||||
searchDialog.checkSearchBarIsNotVisible().checkSearchIconIsVisible().clickOnSearchIcon()
|
||||
|
||||
searchDialog
|
||||
.checkSearchBarIsNotVisible()
|
||||
.checkSearchIconIsVisible()
|
||||
.clickOnSearchIcon()
|
||||
.enterTextAndPressEnter(search.active.base);
|
||||
|
||||
searchResultPage.checkContentIsDisplayed(search.active.secondFile);
|
||||
searchResultPage.sortAndCheckListIsOrderedByAuthor(false).then((result) => {
|
||||
expect(result).toEqual(true);
|
||||
@@ -248,8 +260,13 @@ describe('Search component - Search Page', () => {
|
||||
|
||||
it('[C272807] Should be able to sort results by date (Ascending)', () => {
|
||||
contentServicesPage.goToDocumentList();
|
||||
searchDialog.checkSearchBarIsNotVisible().checkSearchIconIsVisible().clickOnSearchIcon()
|
||||
|
||||
searchDialog
|
||||
.checkSearchBarIsNotVisible()
|
||||
.checkSearchIconIsVisible()
|
||||
.clickOnSearchIcon()
|
||||
.enterTextAndPressEnter(search.active.base);
|
||||
|
||||
searchResultPage.checkContentIsDisplayed(search.active.secondFile);
|
||||
searchResultPage.sortAndCheckListIsOrderedByCreated(true).then((result) => {
|
||||
expect(result).toEqual(true);
|
||||
@@ -258,8 +275,13 @@ describe('Search component - Search Page', () => {
|
||||
|
||||
it('[C260260] Should be able to sort results by date (Descending)', () => {
|
||||
contentServicesPage.goToDocumentList();
|
||||
searchDialog.checkSearchBarIsNotVisible().checkSearchIconIsVisible().clickOnSearchIcon()
|
||||
|
||||
searchDialog
|
||||
.checkSearchBarIsNotVisible()
|
||||
.checkSearchIconIsVisible()
|
||||
.clickOnSearchIcon()
|
||||
.enterTextAndPressEnter(search.active.base);
|
||||
|
||||
searchResultPage.checkContentIsDisplayed(search.active.secondFile);
|
||||
searchResultPage.sortAndCheckListIsOrderedByCreated(false).then((result) => {
|
||||
expect(result).toEqual(true);
|
||||
|
@@ -1,168 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 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.
|
||||
*/
|
||||
|
||||
var Util = require('../../util/util');
|
||||
|
||||
var SearchFiltersPage = function () {
|
||||
|
||||
var searchFilters = element(by.css("adf-search-filter"));
|
||||
var fileTypeFilter = element(by.css("mat-expansion-panel[data-automation-id='expansion-panel-1:Type'"));
|
||||
var searchFileTypeFilter = element(by.css("input[data-automation-id='facet-result-filter-1:Type'"));
|
||||
var creatorFilter = element(by.css("mat-expansion-panel[data-automation-id='expansion-panel-3:Creator'"));
|
||||
var searchCreatorFilter = element(by.css("input[data-automation-id='facet-result-filter-3:Creator'"));
|
||||
var fileSizeFilter = element(by.css("mat-expansion-panel[data-automation-id='expansion-panel-2:Size'"));
|
||||
var showMoreButtonForSize = fileSizeFilter.element(by.css('button[title="Show more"]'));
|
||||
var showLessButtonForSize = fileSizeFilter.element(by.css('button[title="Show less"]'));
|
||||
var numberOfCheckboxesforSize = element.all(by.css('mat-checkbox[data-automation-id*="checkbox-2:Size"]'));
|
||||
|
||||
this.checkSearchFiltersIsDisplayed = function () {
|
||||
Util.waitUntilElementIsVisible(searchFilters);
|
||||
};
|
||||
|
||||
this.checkFileTypeFilterIsDisplayed = function () {
|
||||
Util.waitUntilElementIsVisible(fileTypeFilter);
|
||||
};
|
||||
|
||||
this.checkSearchFileTypeFilterIsDisplayed = function () {
|
||||
Util.waitUntilElementIsVisible(fileTypeFilter);
|
||||
};
|
||||
|
||||
this.checkCreatorFilterIsDisplayed = function () {
|
||||
Util.waitUntilElementIsVisible(creatorFilter);
|
||||
};
|
||||
|
||||
this.checkSearchCreatorFilterIsDisplayed = function () {
|
||||
Util.waitUntilElementIsVisible(searchCreatorFilter);
|
||||
};
|
||||
|
||||
this.clickFileTypeFilter = function () {
|
||||
Util.waitUntilElementIsClickable(fileTypeFilter);
|
||||
return fileTypeFilter.click();
|
||||
};
|
||||
|
||||
this.clickCreatorFilter = function () {
|
||||
Util.waitUntilElementIsClickable(creatorFilter);
|
||||
return creatorFilter.click();
|
||||
};
|
||||
|
||||
this.searchInFileTypeFilter = function (fileType) {
|
||||
Util.waitUntilElementIsClickable(searchFileTypeFilter);
|
||||
searchFileTypeFilter.clear();
|
||||
searchFileTypeFilter.sendKeys(fileType);
|
||||
};
|
||||
|
||||
this.searchInCreatorFilter = function (creatorName) {
|
||||
Util.waitUntilElementIsClickable(searchCreatorFilter);
|
||||
searchCreatorFilter.clear();
|
||||
searchCreatorFilter.sendKeys(creatorName);
|
||||
};
|
||||
|
||||
this.selectFileType = function (fileType) {
|
||||
let result = element(by.css(`mat-checkbox[data-automation-id='checkbox-1:Type-${fileType}'] .mat-checkbox-inner-container`));
|
||||
Util.waitUntilElementIsClickable(result);
|
||||
result.click();
|
||||
};
|
||||
|
||||
this.selectCreator = function (creatorName) {
|
||||
let result = element(by.css(`mat-checkbox[data-automation-id='checkbox-3:Creator-${creatorName}'] .mat-checkbox-inner-container`));
|
||||
Util.waitUntilElementIsClickable(result);
|
||||
result.click();
|
||||
};
|
||||
|
||||
this.filterByFileType = function (fileType) {
|
||||
this.checkFileTypeFilterIsDisplayed();
|
||||
|
||||
this.checkSearchFileTypeFilterIsDisplayed();
|
||||
this.searchInFileTypeFilter(fileType);
|
||||
this.selectFileType(fileType);
|
||||
};
|
||||
|
||||
this.filterByCreator = function (creatorFirstName, creatorLastName) {
|
||||
this.checkCreatorFilterIsDisplayed();
|
||||
|
||||
this.checkSearchCreatorFilterIsDisplayed();
|
||||
this.searchInCreatorFilter(`${creatorFirstName} ${creatorLastName}`);
|
||||
this.selectCreator(`${creatorFirstName} ${creatorLastName}`);
|
||||
};
|
||||
|
||||
this.removeCreatorFilter = function (creatorFirstName, creatorLastName) {
|
||||
let cancelChipButton = element(by.cssContainingText('mat-chip',` ${creatorFirstName} ${creatorLastName} `)).element(by.css('mat-icon'));
|
||||
Util.waitUntilElementIsClickable(cancelChipButton);
|
||||
return cancelChipButton.click();
|
||||
};
|
||||
|
||||
this.checkCreatorChipIsDisplayed = function (creatorFirstName, creatorLastName) {
|
||||
return Util.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip',` ${creatorFirstName} ${creatorLastName} `)).element(by.css('mat-icon')));
|
||||
};
|
||||
|
||||
this.checkCreatorChipIsNotDisplayed = function (creatorFirstName, creatorLastName) {
|
||||
return Util.waitUntilElementIsNotOnPage(element(by.cssContainingText('mat-chip',` ${creatorFirstName} ${creatorLastName} `)).element(by.css('mat-icon')));
|
||||
};
|
||||
|
||||
this.clickSizeShowMoreButtonUntilIsNotDisplayed = function () {
|
||||
Util.waitUntilElementIsVisible(fileSizeFilter);
|
||||
|
||||
showMoreButtonForSize.isDisplayed().then(async (visible) => {
|
||||
if (visible) {
|
||||
for (var checkboxes = 5; checkboxes <= totalNumberOfCheckboxes; checkboxes + 5) {
|
||||
var totalNumberOfCheckboxes = await numberOfCheckboxesforSize.count();
|
||||
|
||||
expect(totalNumberOfCheckboxes).toEqual(checkboxes);
|
||||
}
|
||||
showMoreButtonForSize.click();
|
||||
|
||||
this.clickSizeShowMoreButtonUntilIsNotDisplayed();
|
||||
}
|
||||
}, err => {})
|
||||
};
|
||||
|
||||
this.checkSizeShowMoreButtonIsNotDisplayed = function () {
|
||||
Util.waitUntilElementIsNotVisible(showMoreButtonForSize);
|
||||
};
|
||||
|
||||
this.checkSizeShowMoreButtonIsDisplayed = function () {
|
||||
Util.waitUntilElementIsVisible(showMoreButtonForSize);
|
||||
};
|
||||
|
||||
this.clickSizeShowLessButtonUntilIsNotDisplayed = function () {
|
||||
Util.waitUntilElementIsVisible(fileSizeFilter);
|
||||
|
||||
showLessButtonForSize.isDisplayed().then(async (visible) => {
|
||||
if (visible) {
|
||||
var totalNumberOfCheckboxes = await numberOfCheckboxesforSize.count();
|
||||
|
||||
for (var checkboxes = totalNumberOfCheckboxes; checkboxes > 10; checkboxes = totalNumberOfCheckboxes - checkboxes){
|
||||
expect(totalNumberOfCheckboxes).toEqual(checkboxes);
|
||||
}
|
||||
|
||||
showLessButtonForSize.click();
|
||||
|
||||
this.clickSizeShowLessButtonUntilIsNotDisplayed();
|
||||
}
|
||||
}, err => {})
|
||||
};
|
||||
|
||||
this.checkShowLessButtonIsNotDisplayed = function () {
|
||||
Util.waitUntilElementIsNotVisible(showLessButtonForSize);
|
||||
};
|
||||
|
||||
this.checkShowLessButtonIsDisplayed = function () {
|
||||
Util.waitUntilElementIsVisible(showLessButtonForSize);
|
||||
}
|
||||
|
||||
};
|
||||
module.exports = SearchFiltersPage;
|
155
e2e/pages/adf/searchFiltersPage.ts
Normal file
155
e2e/pages/adf/searchFiltersPage.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 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 Util = require('../../util/util');
|
||||
|
||||
export class SearchFiltersPage {
|
||||
|
||||
searchFilters = element(by.css('adf-search-filter'));
|
||||
fileTypeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-1:Type"'));
|
||||
searchFileTypeFilter = element(by.css('input[data-automation-id="facet-result-filter-1:Type"'));
|
||||
creatorFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-3:Creator"'));
|
||||
searchCreatorFilter = element(by.css('input[data-automation-id="facet-result-filter-3:Creator"'));
|
||||
fileSizeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-2:Size"'));
|
||||
showMoreButtonForSize = this.fileSizeFilter.element(by.css('button[title="Show more"]'));
|
||||
showLessButtonForSize = this.fileSizeFilter.element(by.css('button[title="Show less"]'));
|
||||
numberOfCheckboxesforSize = element.all(by.css('mat-checkbox[data-automation-id*="checkbox-2:Size"]'));
|
||||
|
||||
checkSearchFiltersIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.searchFilters);
|
||||
}
|
||||
|
||||
checkFileTypeFilterIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.fileTypeFilter);
|
||||
}
|
||||
|
||||
checkSearchFileTypeFilterIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.fileTypeFilter);
|
||||
}
|
||||
|
||||
checkCreatorFilterIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.creatorFilter);
|
||||
}
|
||||
|
||||
checkSearchCreatorFilterIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.searchCreatorFilter);
|
||||
}
|
||||
|
||||
searchInFileTypeFilter(fileType) {
|
||||
Util.waitUntilElementIsClickable(this.searchFileTypeFilter);
|
||||
this.searchFileTypeFilter.clear();
|
||||
this.searchFileTypeFilter.sendKeys(fileType);
|
||||
}
|
||||
|
||||
searchInCreatorFilter(creatorName) {
|
||||
Util.waitUntilElementIsClickable(this.searchCreatorFilter);
|
||||
this.searchCreatorFilter.clear();
|
||||
this.searchCreatorFilter.sendKeys(creatorName);
|
||||
}
|
||||
|
||||
selectFileType(fileType) {
|
||||
let result = element(by.css(`mat-checkbox[data-automation-id='checkbox-1:Type-${fileType}'] .mat-checkbox-inner-container`));
|
||||
Util.waitUntilElementIsClickable(result);
|
||||
result.click();
|
||||
}
|
||||
|
||||
selectCreator(creatorName) {
|
||||
let result = element(by.css(`mat-checkbox[data-automation-id='checkbox-3:Creator-${creatorName}'] .mat-checkbox-inner-container`));
|
||||
Util.waitUntilElementIsClickable(result);
|
||||
result.click();
|
||||
}
|
||||
|
||||
filterByFileType(fileType) {
|
||||
this.checkFileTypeFilterIsDisplayed();
|
||||
|
||||
this.checkSearchFileTypeFilterIsDisplayed();
|
||||
this.searchInFileTypeFilter(fileType);
|
||||
this.selectFileType(fileType);
|
||||
}
|
||||
|
||||
filterByCreator(creatorFirstName, creatorLastName) {
|
||||
this.checkCreatorFilterIsDisplayed();
|
||||
|
||||
this.checkSearchCreatorFilterIsDisplayed();
|
||||
this.searchInCreatorFilter(`${creatorFirstName} ${creatorLastName}`);
|
||||
this.selectCreator(`${creatorFirstName} ${creatorLastName}`);
|
||||
}
|
||||
|
||||
removeCreatorFilter(creatorFirstName, creatorLastName) {
|
||||
let cancelChipButton = element(by.cssContainingText('mat-chip', ` ${creatorFirstName} ${creatorLastName} `)).element(by.css('mat-icon'));
|
||||
Util.waitUntilElementIsClickable(cancelChipButton);
|
||||
return cancelChipButton.click();
|
||||
}
|
||||
|
||||
checkCreatorChipIsDisplayed(creatorFirstName, creatorLastName) {
|
||||
return Util.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip', ` ${creatorFirstName} ${creatorLastName} `)).element(by.css('mat-icon')));
|
||||
}
|
||||
|
||||
checkCreatorChipIsNotDisplayed(creatorFirstName, creatorLastName) {
|
||||
return Util.waitUntilElementIsNotOnPage(element(by.cssContainingText('mat-chip', ` ${creatorFirstName} ${creatorLastName} `)).element(by.css('mat-icon')));
|
||||
}
|
||||
|
||||
clickSizeShowMoreButtonUntilIsNotDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.fileSizeFilter);
|
||||
|
||||
this.showMoreButtonForSize.isDisplayed().then(async (visible) => {
|
||||
if (visible) {
|
||||
for (let checkboxes = 5; checkboxes <= totalNumberOfCheckboxes; checkboxes + 5) {
|
||||
let totalNumberOfCheckboxes = await numberOfCheckboxesforSize.count();
|
||||
|
||||
expect(totalNumberOfCheckboxes).toEqual(checkboxes);
|
||||
}
|
||||
this.showMoreButtonForSize.click();
|
||||
|
||||
this.clickSizeShowMoreButtonUntilIsNotDisplayed();
|
||||
}
|
||||
}, err => {
|
||||
});
|
||||
}
|
||||
|
||||
checkSizeShowMoreButtonIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.showMoreButtonForSize);
|
||||
}
|
||||
|
||||
clickSizeShowLessButtonUntilIsNotDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.fileSizeFilter);
|
||||
|
||||
this.showLessButtonForSize.isDisplayed().then(async (visible) => {
|
||||
if (visible) {
|
||||
let totalNumberOfCheckboxes = await this.numberOfCheckboxesforSize.count();
|
||||
|
||||
for (let checkboxes = totalNumberOfCheckboxes; checkboxes > 10; checkboxes = totalNumberOfCheckboxes - checkboxes) {
|
||||
expect(totalNumberOfCheckboxes).toEqual(checkboxes);
|
||||
}
|
||||
|
||||
this.showLessButtonForSize.click();
|
||||
|
||||
this.clickSizeShowLessButtonUntilIsNotDisplayed();
|
||||
}
|
||||
}, err => {
|
||||
});
|
||||
}
|
||||
|
||||
checkShowLessButtonIsNotDisplayed() {
|
||||
Util.waitUntilElementIsNotVisible(this.showLessButtonForSize);
|
||||
}
|
||||
|
||||
checkShowLessButtonIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.showLessButtonForSize);
|
||||
}
|
||||
|
||||
}
|
@@ -1,210 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 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.
|
||||
*/
|
||||
|
||||
var Util = require('../../util/util');
|
||||
var ContentList = require('./dialog/contentList');
|
||||
var DatatablePage = require('./dataTablePage');
|
||||
|
||||
var SearchResultsPage = function () {
|
||||
|
||||
var noResultsMessage = element(by.css("div[class='adf-no-result-message']"));
|
||||
var noResultsMessageBy = by.css("div[class='adf-no-result-message']");
|
||||
var contentList = new ContentList();
|
||||
var dataTable = new DatatablePage();
|
||||
var sortArrowLocator = by.css("adf-sorting-picker button mat-icon");
|
||||
var sortDropdownLocator = by.css("mat-option span");
|
||||
var sortingArrow = element(by.css("adf-sorting-picker div[class='mat-select-arrow']"));
|
||||
|
||||
this.closeActionButton = function () {
|
||||
let container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
|
||||
Util.waitUntilElementIsVisible(container);
|
||||
container.click();
|
||||
Util.waitUntilElementIsNotVisible(container);
|
||||
return this;
|
||||
}
|
||||
|
||||
this.checkContentIsDisplayed = function (content) {
|
||||
contentList.checkContentIsDisplayed(content);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.numberOfResultsDisplayed = function () {
|
||||
return contentList.getAllDisplayedRows();
|
||||
};
|
||||
|
||||
this.checkContentIsNotDisplayed = function (content) {
|
||||
Util.waitUntilElementIsNotOnPage(element(by.css("span[title='" + content +"']")));
|
||||
};
|
||||
|
||||
this.checkNoResultMessageIsDisplayed = function() {
|
||||
Util.waitUntilElementIsPresent(element(noResultsMessageBy));
|
||||
Util.waitUntilElementIsVisible(element(noResultsMessageBy));
|
||||
return this;
|
||||
};
|
||||
|
||||
this.checkNoResultMessageIsNotDisplayed = function () {
|
||||
Util.waitUntilElementIsNotOnPage(noResultsMessage);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.navigateToFolder = function(content) {
|
||||
dataTable.navigateToContent(content);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.deleteContent = function(content) {
|
||||
contentList.deleteContent(content);
|
||||
};
|
||||
|
||||
this.checkDeleteIsDisabled = function(content) {
|
||||
contentList.checkDeleteIsDisabled(content);
|
||||
this.closeActionButton();
|
||||
};
|
||||
|
||||
this.copyContent = function(content) {
|
||||
contentList.copyContent(content);
|
||||
};
|
||||
|
||||
this.moveContent = function(content) {
|
||||
contentList.moveContent(content);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sort the list by name column.
|
||||
*
|
||||
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
|
||||
*/
|
||||
this.sortByName = function (sortOrder) {
|
||||
this.sortBy(sortOrder, "Name");
|
||||
};
|
||||
|
||||
/**
|
||||
* Sort the list by any option.
|
||||
*
|
||||
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
|
||||
* @param option
|
||||
*/
|
||||
this.sortBy = function (sortOrder, option) {
|
||||
|
||||
let selectedSortingOption = element(by.css("adf-sorting-picker div[class='mat-select-value'] span span"));
|
||||
|
||||
Util.waitUntilElementIsVisible(selectedSortingOption);
|
||||
|
||||
selectedSortingOption.getText().then((selectedOption) => {
|
||||
|
||||
if(selectedOption !== option)
|
||||
{
|
||||
Util.waitUntilElementIsVisible(sortingArrow);
|
||||
sortingArrow.click();
|
||||
|
||||
element.all(sortDropdownLocator).each(function(element) {
|
||||
element.getText().then(function(text) {
|
||||
if (text === option) {
|
||||
element.click();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.sortByOrder(sortOrder);
|
||||
};
|
||||
|
||||
this.sortByOrder = function(sortOrder) {
|
||||
Util.waitUntilElementIsVisible(element(sortArrowLocator));
|
||||
return element(sortArrowLocator).getText().then(function (result) {
|
||||
if(sortOrder===true) {
|
||||
if(result !== 'arrow_upward') {
|
||||
element(sortArrowLocator).click();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(result === 'arrow_upward') {
|
||||
element(sortArrowLocator).click();
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Sort the list by author column.
|
||||
*
|
||||
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
|
||||
*/
|
||||
this.sortByAuthor = function (sortOrder) {
|
||||
this.sortBy(sortOrder, "Author");
|
||||
};
|
||||
|
||||
/**
|
||||
* Sort the list by created column.
|
||||
*
|
||||
* @param sortOrder: 'true' to sort the list ascendant and 'false' for descendant
|
||||
*/
|
||||
this.sortByCreated = function (sortOrder) {
|
||||
this.sortBy(sortOrder, "Created");
|
||||
};
|
||||
|
||||
/**
|
||||
* Sort by name and check the list is sorted.
|
||||
*
|
||||
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
|
||||
* @return result : 'true' if the list is sorted as expected and 'false' if it isn't
|
||||
*/
|
||||
this.sortAndCheckListIsOrderedByName = function (sortOrder) {
|
||||
this.sortByName(sortOrder);
|
||||
dataTable.waitForTableBody();
|
||||
var deferred = protractor.promise.defer();
|
||||
contentList.checkListIsOrderedByNameColumn(sortOrder).then(function(result) {
|
||||
deferred.fulfill(result);
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sort by author and check the list is sorted.
|
||||
*
|
||||
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
|
||||
* @return result : 'true' if the list is sorted as expected and 'false' if it isn't
|
||||
*/
|
||||
this.sortAndCheckListIsOrderedByAuthor = function (sortOrder) {
|
||||
this.sortByAuthor(sortOrder);
|
||||
var deferred = protractor.promise.defer();
|
||||
contentList.checkListIsOrderedByAuthorColumn(sortOrder).then(function(result) {
|
||||
deferred.fulfill(result);
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sort by created and check the list is sorted.
|
||||
*
|
||||
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
|
||||
* @return result : 'true' if the list is sorted as expected and 'false' if it isn't
|
||||
*/
|
||||
this.sortAndCheckListIsOrderedByCreated = function (sortOrder) {
|
||||
this.sortByCreated(sortOrder);
|
||||
var deferred = protractor.promise.defer();
|
||||
contentList.checkListIsOrderedByCreatedColumn(sortOrder).then(function(result) {
|
||||
deferred.fulfill(result);
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
};
|
||||
module.exports = SearchResultsPage;
|
153
e2e/pages/adf/searchResultsPage.ts
Normal file
153
e2e/pages/adf/searchResultsPage.ts
Normal file
@@ -0,0 +1,153 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 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 Util = require('../../util/util');
|
||||
import ContentList = require('./dialog/contentList');
|
||||
import DatatablePage = require('./dataTablePage');
|
||||
|
||||
export class SearchResultsPage {
|
||||
|
||||
noResultsMessage = element(by.css('div[class="adf-no-result-message"]'));
|
||||
noResultsMessageBy = by.css('div[class="adf-no-result-message"]');
|
||||
contentList = new ContentList();
|
||||
dataTable = new DatatablePage();
|
||||
sortArrowLocator = by.css('adf-sorting-picker button mat-icon');
|
||||
sortingArrow = element(by.css('adf-sorting-picker div[class="mat-select-arrow"]'));
|
||||
|
||||
closeActionButton() {
|
||||
let container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
|
||||
Util.waitUntilElementIsVisible(container);
|
||||
container.click();
|
||||
Util.waitUntilElementIsNotVisible(container);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkContentIsDisplayed(content) {
|
||||
this.contentList.checkContentIsDisplayed(content);
|
||||
return this;
|
||||
}
|
||||
|
||||
numberOfResultsDisplayed() {
|
||||
return this.contentList.getAllDisplayedRows();
|
||||
}
|
||||
|
||||
checkContentIsNotDisplayed(content) {
|
||||
Util.waitUntilElementIsNotOnPage(element(by.css("span[title='" + content + "']")));
|
||||
}
|
||||
|
||||
checkNoResultMessageIsDisplayed() {
|
||||
Util.waitUntilElementIsPresent(element(this.noResultsMessageBy));
|
||||
Util.waitUntilElementIsVisible(element(this.noResultsMessageBy));
|
||||
return this;
|
||||
}
|
||||
|
||||
checkNoResultMessageIsNotDisplayed() {
|
||||
Util.waitUntilElementIsNotOnPage(this.noResultsMessage);
|
||||
return this;
|
||||
}
|
||||
|
||||
navigateToFolder(content) {
|
||||
this.dataTable.navigateToContent(content);
|
||||
return this;
|
||||
}
|
||||
|
||||
deleteContent(content) {
|
||||
this.contentList.deleteContent(content);
|
||||
}
|
||||
|
||||
checkDeleteIsDisabled(content) {
|
||||
this.contentList.checkDeleteIsDisabled(content);
|
||||
this.closeActionButton();
|
||||
}
|
||||
|
||||
copyContent(content) {
|
||||
this.contentList.copyContent(content);
|
||||
}
|
||||
|
||||
moveContent(content) {
|
||||
this.contentList.moveContent(content);
|
||||
}
|
||||
|
||||
sortByName(sortOrder) {
|
||||
this.sortBy(sortOrder, 'Name');
|
||||
}
|
||||
|
||||
sortBy(sortOrder) {
|
||||
|
||||
this.sortingArrow.click();
|
||||
|
||||
let selectedSortingOption = element(by.xpath('//span [contains(text(), \"Name\")]'));
|
||||
|
||||
selectedSortingOption.click();
|
||||
|
||||
this.sortByOrder(sortOrder);
|
||||
}
|
||||
|
||||
sortByOrder(sortOrder) {
|
||||
Util.waitUntilElementIsVisible(element(this.sortArrowLocator));
|
||||
return element(this.sortArrowLocator).getText().then((result) => {
|
||||
if (sortOrder === true) {
|
||||
if (result !== 'arrow_upward') {
|
||||
element(this.sortArrowLocator).click();
|
||||
}
|
||||
} else {
|
||||
if (result === 'arrow_upward') {
|
||||
element(this.sortArrowLocator).click();
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
});
|
||||
}
|
||||
|
||||
sortByAuthor(sortOrder) {
|
||||
this.sortBy(sortOrder, 'Author');
|
||||
}
|
||||
|
||||
sortByCreated(sortOrder) {
|
||||
this.sortBy(sortOrder, 'Created');
|
||||
}
|
||||
|
||||
sortAndCheckListIsOrderedByName(sortOrder) {
|
||||
this.sortByName(sortOrder);
|
||||
this.dataTable.waitForTableBody();
|
||||
let deferred = protractor.promise.defer();
|
||||
this.contentList.checkListIsOrderedByNameColumn(sortOrder).then((result) => {
|
||||
deferred.fulfill(result);
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
sortAndCheckListIsOrderedByAuthor(sortOrder) {
|
||||
this.sortByAuthor(sortOrder);
|
||||
let deferred = protractor.promise.defer();
|
||||
this.contentList.checkListIsOrderedByAuthorColumn(sortOrder).then((result) => {
|
||||
deferred.fulfill(result);
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
sortAndCheckListIsOrderedByCreated(sortOrder) {
|
||||
this.sortByCreated(sortOrder);
|
||||
let deferred = protractor.promise.defer();
|
||||
this.contentList.checkListIsOrderedByCreatedColumn(sortOrder).then((result) => {
|
||||
deferred.fulfill(result);
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
}
|
@@ -267,7 +267,11 @@ exports.config = {
|
||||
|
||||
}
|
||||
|
||||
rimraf(`${projectRoot}/e2e-output/screenshots/`, function () { console.log('done delete screenshot'); });
|
||||
if (saveScreenshot === 'true') {
|
||||
rimraf(`${projectRoot}/e2e-output/screenshots/`, function () {
|
||||
console.log('done delete screenshot');
|
||||
});
|
||||
}
|
||||
|
||||
return retry.afterLaunch(3);
|
||||
}
|
||||
|
Reference in New Issue
Block a user