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
@@ -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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user