mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3715]Refactor search filters page (#3933)
* Add tests for text widget * Propose refactor search filters component * Fix lint errors * [ADF-3715]Refactor searchFiltersPage * Change describe * Replaced use of searchDialog with browser.get * Added a test case * Modifications to enterConfiguration method * Create a new method enterBigConfigurationText * Fix lint issues * no message
This commit is contained in:
committed by
Eugenio Romano
parent
ca3e1035fa
commit
a6cd910466
123
e2e/content-services/search/components/search-text.e2e.ts
Normal file
123
e2e/content-services/search/components/search-text.e2e.ts
Normal file
@@ -0,0 +1,123 @@
|
||||
/*!
|
||||
* @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 { browser } from 'protractor';
|
||||
|
||||
import AcsUserModel = require('../../../models/ACS/acsUserModel');
|
||||
import FolderModel = require('../../../models/ACS/folderModel');
|
||||
|
||||
import TestConfig = require('../../../test.config');
|
||||
|
||||
import AlfrescoApi = require('alfresco-js-api-node');
|
||||
|
||||
import { LoginPage } from '../../../pages/adf/loginPage';
|
||||
import SearchDialog = require('../../../pages/adf/dialog/searchDialog');
|
||||
import { SearchResultsPage } from '../../../pages/adf/searchResultsPage';
|
||||
import { SearchFiltersPage } from '../../../pages/adf/searchFiltersPage';
|
||||
import { ConfigEditorPage } from '../../../pages/adf/configEditorPage';
|
||||
import { NavigationBarPage } from '../../../pages/adf/navigationBarPage';
|
||||
import path = require('path');
|
||||
|
||||
describe('Search component - Text widget', () => {
|
||||
|
||||
const configEditorPage = new ConfigEditorPage();
|
||||
const navigationBarPage = new NavigationBarPage();
|
||||
const searchFiltersPage = new SearchFiltersPage();
|
||||
|
||||
let loginPage = new LoginPage();
|
||||
let searchDialog = new SearchDialog();
|
||||
let searchResultPage = new SearchResultsPage();
|
||||
|
||||
let acsUser = new AcsUserModel();
|
||||
let newFolderModel = new FolderModel({ 'name': 'newFolder' , 'description': 'newDescription' });
|
||||
|
||||
beforeAll(async (done) => {
|
||||
|
||||
this.alfrescoJsApi = new AlfrescoApi({
|
||||
provider: 'ECM',
|
||||
hostEcm: TestConfig.adf.url
|
||||
});
|
||||
|
||||
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||
|
||||
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
|
||||
|
||||
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
|
||||
|
||||
await this.alfrescoJsApi.nodes.addNode('-my-', {
|
||||
'name': newFolderModel.name,
|
||||
'nodeType': 'cm:folder',
|
||||
'properties':
|
||||
{
|
||||
'cm:description': newFolderModel.description
|
||||
}
|
||||
}, {}, {});
|
||||
|
||||
await browser.driver.sleep(10000);
|
||||
|
||||
loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('[C289329] Placeholder should be displayed in the widget when the input string is empty', () => {
|
||||
browser.get(TestConfig.adf.url + '/search;q=*');
|
||||
searchResultPage.tableIsLoaded();
|
||||
|
||||
searchFiltersPage.checkNameFilterIsDisplayed();
|
||||
expect(searchFiltersPage.textFiltersPage().getNamePlaceholder()).toEqual('Enter the name');
|
||||
});
|
||||
|
||||
it('[C289330] Should be able to change the Field setting', () => {
|
||||
browser.get(TestConfig.adf.url + '/search;q=*');
|
||||
searchResultPage.tableIsLoaded();
|
||||
|
||||
searchFiltersPage.checkCheckListFilterIsDisplayed();
|
||||
searchFiltersPage.clickCheckListFilter();
|
||||
searchFiltersPage.checkListFiltersPage().clickCheckListOption('Folder');
|
||||
|
||||
searchFiltersPage.checkNameFilterIsDisplayed();
|
||||
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.name);
|
||||
searchResultPage.checkContentIsDisplayed(newFolderModel.name);
|
||||
|
||||
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.description);
|
||||
searchResultPage.checkContentIsNotDisplayed(newFolderModel.name);
|
||||
|
||||
let json = JSON.parse(require('fs').readFileSync(path.join(TestConfig.main.rootPath, '/content-services/search/search.config.json'), 'utf8'));
|
||||
json.categories[0].component.settings.field = 'cm:description';
|
||||
|
||||
navigationBarPage.clickConfigEditorButton();
|
||||
configEditorPage.clickSearchConfiguration();
|
||||
configEditorPage.clickClearButton();
|
||||
configEditorPage.enterBigConfigurationText(JSON.stringify(json));
|
||||
configEditorPage.clickSaveButton();
|
||||
|
||||
searchDialog.clickOnSearchIcon().enterTextAndPressEnter('*');
|
||||
searchResultPage.tableIsLoaded();
|
||||
|
||||
searchFiltersPage.checkCheckListFilterIsDisplayed();
|
||||
searchFiltersPage.clickCheckListFilter();
|
||||
searchFiltersPage.checkListFiltersPage().clickCheckListOption('Folder');
|
||||
|
||||
searchFiltersPage.checkNameFilterIsDisplayed();
|
||||
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.name);
|
||||
searchResultPage.checkContentIsNotDisplayed(newFolderModel.name);
|
||||
|
||||
searchFiltersPage.textFiltersPage().searchByName(newFolderModel.description);
|
||||
searchResultPage.checkContentIsDisplayed(newFolderModel.name);
|
||||
});
|
||||
});
|
135
e2e/content-services/search/search.config.json
Normal file
135
e2e/content-services/search/search.config.json
Normal file
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"include": ["path", "allowableOperations"],
|
||||
"sorting": {
|
||||
"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 }
|
||||
],
|
||||
"defaults": [
|
||||
{ "key": "name", "type": "FIELD", "field": "cm:name", "ascending": true }
|
||||
]
|
||||
},
|
||||
"filterQueries": [
|
||||
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
|
||||
{ "query": "NOT cm:creator:System" }
|
||||
],
|
||||
"facetFields": {
|
||||
"expanded": true,
|
||||
"fields": [
|
||||
{ "field": "content.mimetype", "mincount": 1, "label": "1:Type" },
|
||||
{ "field": "content.size", "mincount": 1, "label": "2:Size" },
|
||||
{ "field": "creator", "mincount": 1, "label": "3:Creator" },
|
||||
{ "field": "modifier", "mincount": 1, "label": "4:Modifier" },
|
||||
{ "field": "created", "mincount": 1, "label": "5:Created" }
|
||||
]
|
||||
},
|
||||
"facetQueries": {
|
||||
"label": "My facet queries",
|
||||
"pageSize": 5,
|
||||
"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:[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:[134217728 TO MAX]", "label": "8.Size: XX large" }
|
||||
]
|
||||
},
|
||||
"categories": [
|
||||
{
|
||||
"id": "queryName",
|
||||
"name": "Name",
|
||||
"enabled": true,
|
||||
"expanded": true,
|
||||
"component": {
|
||||
"selector": "text",
|
||||
"settings": {
|
||||
"pattern": "cm:name:'(.*?)'",
|
||||
"field": "cm:name",
|
||||
"placeholder": "Enter the name"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "checkList",
|
||||
"name": "Check List",
|
||||
"enabled": true,
|
||||
"component": {
|
||||
"selector": "check-list",
|
||||
"settings": {
|
||||
"pageSize": 5,
|
||||
"operator": "OR",
|
||||
"options": [
|
||||
{ "name": "Folder", "value": "TYPE:'cm:folder'" },
|
||||
{ "name": "Document", "value": "TYPE:'cm:content'" }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "contentSize",
|
||||
"name": "Content Size",
|
||||
"enabled": true,
|
||||
"component": {
|
||||
"selector": "slider",
|
||||
"settings": {
|
||||
"field": "cm:content.size",
|
||||
"min": 0,
|
||||
"max": 18,
|
||||
"step": 1,
|
||||
"thumbLabel": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "contentSizeRange",
|
||||
"name": "Content Size (range)",
|
||||
"enabled": true,
|
||||
"component": {
|
||||
"selector": "number-range",
|
||||
"settings": {
|
||||
"field": "cm:content.size",
|
||||
"format": "[{FROM} TO {TO}]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "createdDateRange",
|
||||
"name": "Created Date (range)",
|
||||
"enabled": true,
|
||||
"component": {
|
||||
"selector": "date-range",
|
||||
"settings": {
|
||||
"field": "cm:created",
|
||||
"dateFormat": "DD-MMM-YY"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "queryType",
|
||||
"name": "Type",
|
||||
"enabled": true,
|
||||
"component": {
|
||||
"selector": "radio",
|
||||
"settings": {
|
||||
"field": null,
|
||||
"pageSize": 5,
|
||||
"options": [
|
||||
{ "name": "APP.SEARCH.RADIO.NONE", "value": "", "default": true },
|
||||
{ "name": "APP.SEARCH.RADIO.ALL", "value": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
|
||||
{ "name": "APP.SEARCH.RADIO.FOLDER", "value": "TYPE:'cm:folder'" },
|
||||
{ "name": "APP.SEARCH.RADIO.DOCUMENT", "value": "TYPE:'cm:content'" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
@@ -20,6 +20,7 @@ import SearchDialog = require('../../pages/adf/dialog/searchDialog');
|
||||
import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage';
|
||||
import PaginationPage = require('../../pages/adf/paginationPage');
|
||||
import ContentList = require('../../pages/adf/dialog/contentList');
|
||||
import { SearchCategoriesPage } from '../../pages/adf/content_services/search/search-categories';
|
||||
|
||||
import AcsUserModel = require('../../models/ACS/acsUserModel');
|
||||
import FileModel = require('../../models/ACS/fileModel');
|
||||
@@ -37,6 +38,7 @@ describe('Search Filters', () => {
|
||||
let loginPage = new LoginPage();
|
||||
let searchDialog = new SearchDialog();
|
||||
let searchFiltersPage = new SearchFiltersPage();
|
||||
const searchCategoriesPage = new SearchCategoriesPage();
|
||||
let uploadActions = new UploadActions();
|
||||
let paginationPage = new PaginationPage();
|
||||
let contentList = new ContentList();
|
||||
@@ -98,44 +100,43 @@ describe('Search Filters', () => {
|
||||
});
|
||||
|
||||
it('[C286298] Should be able to cancel a filter using "x" button from the toolbar', () => {
|
||||
searchFiltersPage.filterByCreator(acsUser.firstName, acsUser.lastName);
|
||||
searchFiltersPage.checkCreatorChipIsDisplayed(acsUser.firstName, acsUser.lastName);
|
||||
searchFiltersPage.removeCreatorFilter(acsUser.firstName, acsUser.lastName);
|
||||
searchFiltersPage.checkCreatorChipIsNotDisplayed(acsUser.firstName, acsUser.lastName);
|
||||
let userOption = `${acsUser.firstName} ${acsUser.lastName}`;
|
||||
searchFiltersPage.creatorCheckListFiltersPage().filterBy(userOption)
|
||||
.checkChipIsDisplayed(userOption)
|
||||
.removeFilterOption(userOption)
|
||||
.checkChipIsNotDisplayed(userOption);
|
||||
});
|
||||
|
||||
it('[C277146] Should Show more/less buttons be hidden when inactive', () => {
|
||||
browser.get(TestConfig.adf.url + '/search;q=*');
|
||||
|
||||
searchFiltersPage.checkCreatedShowLessButtonIsNotDisplayed();
|
||||
searchFiltersPage.checkCreatedShowMoreButtonIsDisplayed();
|
||||
|
||||
searchFiltersPage.clickCreatedShowMoreButtonUntilIsNotDisplayed();
|
||||
searchFiltersPage.checkCreatedShowLessButtonIsDisplayed();
|
||||
|
||||
searchFiltersPage.clickCreatedShowLessButtonUntilIsNotDisplayed();
|
||||
searchFiltersPage.creatorCheckListFiltersPage().checkShowLessButtonIsNotDisplayed()
|
||||
.checkShowMoreButtonIsDisplayed()
|
||||
.clickShowMoreButtonUntilIsNotDisplayed()
|
||||
.checkShowLessButtonIsDisplayed()
|
||||
.clickShowLessButtonUntilIsNotDisplayed();
|
||||
});
|
||||
|
||||
it('[C286556] Search categories should preserve their collapsed/expanded state after the search', () => {
|
||||
browser.get(TestConfig.adf.url + '/search;q=*');
|
||||
|
||||
searchFiltersPage.clickFileTypeFilterHeader();
|
||||
searchFiltersPage.checkFileTypeFilterIsCollapsed();
|
||||
searchFiltersPage.clickFileSizeFilterHeader();
|
||||
searchFiltersPage.checkFileSizeFilterIsCollapsed();
|
||||
searchFiltersPage.clickFileTypeListFilter()
|
||||
.checkFileTypeFilterIsCollapsed()
|
||||
.clickFileSizeFilterHeader()
|
||||
.checkFileSizeFilterIsCollapsed();
|
||||
|
||||
searchFiltersPage.selectCreator('Administrator');
|
||||
searchFiltersPage.creatorCheckListFiltersPage().clickCheckListOption('Administrator');
|
||||
|
||||
searchFiltersPage.checkFileTypeFilterIsCollapsed();
|
||||
searchFiltersPage.checkFileSizeFilterIsCollapsed();
|
||||
searchFiltersPage.checkFileTypeFilterIsCollapsed()
|
||||
.checkFileSizeFilterIsCollapsed();
|
||||
});
|
||||
|
||||
it('[C287796] Should be able to display the correct bucket number after selecting a filter', () => {
|
||||
browser.get(TestConfig.adf.url + '/search;q=*');
|
||||
|
||||
searchFiltersPage.clickPngImageType();
|
||||
searchFiltersPage.fileTypeCheckListFiltersPage().clickCheckListOption('PNG Image');
|
||||
|
||||
let bucketNumberForFilter = searchFiltersPage.getBucketNumberOfFilterType(filter.type);
|
||||
let bucketNumberForFilter = searchFiltersPage.fileTypeCheckListFiltersPage().getBucketNumberOfFilterType(filter.type);
|
||||
|
||||
let resultFileNames = contentList.getAllRowsNameColumn();
|
||||
|
||||
|
@@ -38,7 +38,7 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
let searchResultsPage = new SearchResultsPage();
|
||||
let uploadActions = new UploadActions();
|
||||
let searchFiltersPage = new SearchFiltersPage();
|
||||
let site;
|
||||
let site, userOption;
|
||||
|
||||
beforeAll(() => {
|
||||
this.alfrescoJsApi = new AlfrescoApi({
|
||||
@@ -89,8 +89,10 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
searchDialog.clickOnSearchIcon();
|
||||
searchDialog.enterTextAndPressEnter(`${randomName}`);
|
||||
|
||||
userOption = `${acsUser.firstName} ${acsUser.lastName}`;
|
||||
|
||||
searchFiltersPage.checkSearchFiltersIsDisplayed();
|
||||
searchFiltersPage.filterByCreator(acsUser.firstName, acsUser.lastName);
|
||||
searchFiltersPage.creatorCheckListFiltersPage().filterBy(userOption);
|
||||
|
||||
done();
|
||||
});
|
||||
@@ -109,13 +111,13 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
});
|
||||
|
||||
it('[C280054] Should be able to select multiple items from a search facet filter', () => {
|
||||
searchFiltersPage.filterByFileType('Plain Text');
|
||||
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('Plain Text');
|
||||
|
||||
expect(searchResultsPage.numberOfResultsDisplayed()).toBe(2);
|
||||
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
|
||||
searchResultsPage.checkContentIsDisplayed(txtFileSite.entry.name);
|
||||
|
||||
searchFiltersPage.filterByFileType('JPEG Image');
|
||||
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('JPEG Image');
|
||||
|
||||
expect(searchResultsPage.numberOfResultsDisplayed()).toBe(4);
|
||||
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
|
||||
@@ -176,17 +178,18 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
});
|
||||
|
||||
it('[C280056] Should be able to select multiple items from multiple search facet filters', () => {
|
||||
|
||||
searchFiltersPage.checkSearchFiltersIsDisplayed();
|
||||
|
||||
searchFiltersPage.filterByCreator(userUploadingTxt.firstName, userUploadingTxt.lastName);
|
||||
searchFiltersPage.creatorCheckListFiltersPage().filterBy(`${userUploadingTxt.firstName} ${userUploadingTxt.lastName}`);
|
||||
|
||||
searchFiltersPage.filterByCreator(userUploadingImg.firstName, userUploadingImg.lastName);
|
||||
searchFiltersPage.creatorCheckListFiltersPage().filterBy(`${userUploadingImg.firstName} ${userUploadingImg.lastName}`);
|
||||
|
||||
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
|
||||
searchResultsPage.checkContentIsDisplayed(jpgFile.entry.name);
|
||||
|
||||
searchFiltersPage.filterByFileType('Plain Text');
|
||||
searchFiltersPage.filterByFileType('JPEG Image');
|
||||
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('Plain Text');
|
||||
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('JPEG Image');
|
||||
|
||||
expect(searchResultsPage.numberOfResultsDisplayed()).toBe(2);
|
||||
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
|
||||
@@ -237,9 +240,8 @@ describe('Search Component - Multi-Select Facet', () => {
|
||||
});
|
||||
|
||||
it('[C280058] Should update filter facets items number when another filter facet item is selected', () => {
|
||||
searchFiltersPage.filterByFileType('Plain Text');
|
||||
|
||||
searchFiltersPage.filterByCreator(acsUser.firstName, acsUser.lastName);
|
||||
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('Plain Text');
|
||||
searchFiltersPage.creatorCheckListFiltersPage().filterBy(`${acsUser.firstName} ${acsUser.lastName}`);
|
||||
|
||||
expect(searchResultsPage.numberOfResultsDisplayed()).toBe(1);
|
||||
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
|
||||
|
@@ -24,6 +24,7 @@ var FolderModel = function (details) {
|
||||
this.shortName = this.name;
|
||||
this.tooltip = this.name;
|
||||
this.location = "";
|
||||
this.description= "";
|
||||
|
||||
this.getName = function () {
|
||||
return this.name;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { element, by } from 'protractor';
|
||||
import { element, by, browser } from 'protractor';
|
||||
import Util = require('../../util/util');
|
||||
|
||||
export class ConfigEditorPage {
|
||||
@@ -27,6 +27,13 @@ export class ConfigEditorPage {
|
||||
return this;
|
||||
}
|
||||
|
||||
enterBigConfigurationText(text) {
|
||||
let textField = element(by.css('#adf-code-configuration-editor div.overflow-guard > textarea'));
|
||||
Util.waitUntilElementIsVisible(textField);
|
||||
browser.executeScript('this.monaco.editor.getModels()[0].setValue(`' + text + '`)');
|
||||
return this;
|
||||
}
|
||||
|
||||
clickSaveButton() {
|
||||
let saveButton = element(by.id('adf-configuration-save'));
|
||||
Util.waitUntilElementIsVisible(saveButton);
|
||||
@@ -47,4 +54,11 @@ export class ConfigEditorPage {
|
||||
Util.waitUntilElementIsClickable(button);
|
||||
return button.click();
|
||||
}
|
||||
|
||||
clickSearchConfiguration() {
|
||||
let button = element(by.id('adf-search-conf'));
|
||||
Util.waitUntilElementIsVisible(button);
|
||||
Util.waitUntilElementIsClickable(button);
|
||||
return button.click();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,128 @@
|
||||
/*!
|
||||
* @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 { element, by } from 'protractor';
|
||||
|
||||
export class SearchCheckListPage {
|
||||
|
||||
filter;
|
||||
inputBy = by.css('div[class*="mat-expansion-panel-content"] input');
|
||||
showMoreBy = by.css('button[title="Show more"]');
|
||||
showLessBy = by.css('button[title="Show less"]');
|
||||
|
||||
constructor(filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
clickCheckListOption(option) {
|
||||
Util.waitUntilElementIsVisible(this.filter);
|
||||
let result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}'] .mat-checkbox-inner-container`));
|
||||
Util.waitUntilElementIsVisible(result);
|
||||
Util.waitUntilElementIsClickable(result);
|
||||
result.click();
|
||||
}
|
||||
|
||||
checkChipIsDisplayed(option) {
|
||||
Util.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
|
||||
return this;
|
||||
}
|
||||
|
||||
checkChipIsNotDisplayed(option) {
|
||||
Util.waitUntilElementIsNotOnPage(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
|
||||
return this;
|
||||
}
|
||||
|
||||
removeFilterOption(option) {
|
||||
let cancelChipButton = element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon'));
|
||||
Util.waitUntilElementIsClickable(cancelChipButton);
|
||||
cancelChipButton.click();
|
||||
return this;
|
||||
}
|
||||
|
||||
filterBy(option) {
|
||||
this.checkSearchFilterInputIsDisplayed();
|
||||
this.searchInFilter(option);
|
||||
this.clickCheckListOption(option);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkSearchFilterInputIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.filter.element(this.inputBy));
|
||||
}
|
||||
|
||||
searchInFilter(option) {
|
||||
let inputElement = this.filter.element(this.inputBy);
|
||||
Util.waitUntilElementIsClickable(this.filter);
|
||||
Util.waitUntilElementIsClickable(inputElement);
|
||||
|
||||
inputElement.clear();
|
||||
this.filter.element(this.inputBy).sendKeys(option);
|
||||
}
|
||||
|
||||
checkShowLessButtonIsNotDisplayed() {
|
||||
Util.waitUntilElementIsNotVisible(this.filter.element(this.showLessBy));
|
||||
return this;
|
||||
}
|
||||
|
||||
checkShowLessButtonIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.filter.element(this.showLessBy));
|
||||
return this;
|
||||
}
|
||||
|
||||
checkShowMoreButtonIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.filter.element(this.showMoreBy));
|
||||
return this;
|
||||
}
|
||||
|
||||
clickShowMoreButtonUntilIsNotDisplayed() {
|
||||
this.filter.element(this.showMoreBy).isDisplayed().then(async (visible) => {
|
||||
if (visible) {
|
||||
this.filter.element(this.showMoreBy).click();
|
||||
|
||||
this.clickShowMoreButtonUntilIsNotDisplayed();
|
||||
}
|
||||
}, err => {
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
clickShowLessButtonUntilIsNotDisplayed() {
|
||||
this.filter.element(this.showLessBy).isDisplayed().then(async (visible) => {
|
||||
if (visible) {
|
||||
this.filter.element(this.showLessBy).click();
|
||||
|
||||
this.clickShowLessButtonUntilIsNotDisplayed();
|
||||
}
|
||||
}, err => {
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
getBucketNumberOfFilterType(option) {
|
||||
let fileTypeFilter = this.filter.element(by.css('mat-checkbox[data-automation-id*=".' + option + '"] span'));
|
||||
Util.waitUntilElementIsVisible(fileTypeFilter);
|
||||
let bucketNumber = fileTypeFilter.getText().then((valueOfBucket) => {
|
||||
let numberOfBucket = valueOfBucket.split('(')[1];
|
||||
let totalNumberOfBucket = numberOfBucket.split(')')[0];
|
||||
return totalNumberOfBucket;
|
||||
});
|
||||
|
||||
return bucketNumber;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
/*!
|
||||
* @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 { element, by } from 'protractor';
|
||||
|
||||
export class SearchTextPage {
|
||||
|
||||
filter;
|
||||
inputBy = by.css('input');
|
||||
|
||||
constructor(filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
getNamePlaceholder() {
|
||||
Util.waitUntilElementIsVisible(this.filter);
|
||||
return this.filter.element(this.inputBy).getAttribute('placeholder');
|
||||
}
|
||||
|
||||
searchByName(name) {
|
||||
Util.waitUntilElementIsVisible(this.filter);
|
||||
this.filter.element(this.inputBy).clear();
|
||||
this.filter.element(this.inputBy).sendKeys(name).sendKeys(protractor.Key.ENTER);
|
||||
}
|
||||
|
||||
}
|
58
e2e/pages/adf/content_services/search/search-categories.ts
Normal file
58
e2e/pages/adf/content_services/search/search-categories.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* @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 { element, by } from 'protractor';
|
||||
import { SearchTextPage } from './components/search-text';
|
||||
import { SearchCheckListPage } from './components/search-checkList';
|
||||
|
||||
export class SearchCategoriesPage {
|
||||
|
||||
checkListFiltersPage(filter) {
|
||||
return new SearchCheckListPage(filter);
|
||||
}
|
||||
|
||||
textFiltersPage(filter) {
|
||||
return new SearchTextPage(filter);
|
||||
}
|
||||
|
||||
checkFilterIsDisplayed(filter) {
|
||||
Util.waitUntilElementIsVisible(filter);
|
||||
return this;
|
||||
}
|
||||
|
||||
clickFilter(filter) {
|
||||
Util.waitUntilElementIsVisible(filter);
|
||||
filter.element(by.css('mat-expansion-panel-header')).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
clickFilterHeader(filter) {
|
||||
let fileSizeFilterHeader = filter.element(by.css('mat-expansion-panel-header'));
|
||||
Util.waitUntilElementIsClickable(fileSizeFilterHeader);
|
||||
fileSizeFilterHeader.click();
|
||||
return this;
|
||||
}
|
||||
|
||||
checkFilterIsCollapsed(filter) {
|
||||
filter.getAttribute('class').then((elementClass) => {
|
||||
expect(elementClass).not.toContain('mat-expanded');
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@@ -17,171 +17,86 @@
|
||||
|
||||
import Util = require('../../util/util');
|
||||
import { element, by } from 'protractor';
|
||||
import { SearchCategoriesPage } from './content_services/search/search-categories';
|
||||
|
||||
export class SearchFiltersPage {
|
||||
|
||||
searchCategoriesPage = new SearchCategoriesPage();
|
||||
|
||||
searchFilters = element(by.css('adf-search-filter'));
|
||||
fileTypeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]'));
|
||||
searchFileTypeFilter = element(by.css('input[data-automation-id="facet-result-filter-SEARCH.FACET_FIELDS.TYPE"]'));
|
||||
creatorFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.CREATOR"]'));
|
||||
searchCreatorFilter = element(by.css('input[data-automation-id="facet-result-filter-SEARCH.FACET_FIELDS.CREATOR"]'));
|
||||
fileSizeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]'));
|
||||
createdFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.CREATED"'));
|
||||
showMoreButtonForCreated = this.createdFilter.element(by.css('button[title="Show more"]'));
|
||||
showLessButtonForCreated = this.createdFilter.element(by.css('button[title="Show less"]'));
|
||||
pngImageFileType = element(by.css('mat-checkbox[data-automation-id="checkbox-SEARCH.FACET_FIELDS.TYPE-PNG Image"]'));
|
||||
nameFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Name"]'));
|
||||
checkListFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Check List"]'));
|
||||
|
||||
checkSearchFiltersIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.searchFilters);
|
||||
}
|
||||
|
||||
checkFileTypeFilterIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.fileTypeFilter);
|
||||
textFiltersPage() {
|
||||
return this.searchCategoriesPage.textFiltersPage(this.nameFilter);
|
||||
}
|
||||
|
||||
checkSearchFileTypeFilterIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.fileTypeFilter);
|
||||
checkListFiltersPage() {
|
||||
return this.searchCategoriesPage.checkListFiltersPage(this.checkListFilter);
|
||||
}
|
||||
|
||||
creatorCheckListFiltersPage() {
|
||||
return this.searchCategoriesPage.checkListFiltersPage(this.creatorFilter);
|
||||
}
|
||||
|
||||
fileTypeCheckListFiltersPage() {
|
||||
return this.searchCategoriesPage.checkListFiltersPage(this.fileTypeFilter);
|
||||
}
|
||||
|
||||
checkFileTypeFilterIsDisplayed() {
|
||||
this.searchCategoriesPage.checkFilterIsDisplayed(this.fileTypeFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkCreatorFilterIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.creatorFilter);
|
||||
this.searchCategoriesPage.checkFilterIsDisplayed(this.creatorFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkSearchCreatorFilterIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.searchCreatorFilter);
|
||||
checkCheckListFilterIsDisplayed() {
|
||||
this.searchCategoriesPage.checkFilterIsDisplayed(this.checkListFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
searchInFileTypeFilter(fileType) {
|
||||
Util.waitUntilElementIsClickable(this.searchFileTypeFilter);
|
||||
this.searchFileTypeFilter.clear();
|
||||
this.searchFileTypeFilter.sendKeys(fileType);
|
||||
checkNameFilterIsDisplayed() {
|
||||
this.searchCategoriesPage.checkFilterIsDisplayed(this.nameFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
searchInCreatorFilter(creatorName) {
|
||||
Util.waitUntilElementIsClickable(this.searchCreatorFilter);
|
||||
this.searchCreatorFilter.clear();
|
||||
this.searchCreatorFilter.sendKeys(creatorName);
|
||||
clickCheckListFilter() {
|
||||
this.searchCategoriesPage.clickFilter(this.checkListFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
selectFileType(fileType) {
|
||||
let result = element(by.css(`mat-checkbox[data-automation-id='checkbox-SEARCH.FACET_FIELDS.TYPE-${fileType}'] .mat-checkbox-inner-container`));
|
||||
Util.waitUntilElementIsClickable(result);
|
||||
result.click();
|
||||
}
|
||||
|
||||
selectCreator(creatorName) {
|
||||
let result = element(by.css(`mat-checkbox[data-automation-id='checkbox-SEARCH.FACET_FIELDS.CREATOR-${creatorName}'] .mat-checkbox-inner-container`));
|
||||
Util.waitUntilElementIsClickable(result);
|
||||
result.click();
|
||||
clickFileTypeListFilter() {
|
||||
this.searchCategoriesPage.clickFilter(this.fileTypeFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
clickFileSizeFilterHeader() {
|
||||
let fileSizeFilterHeader = this.fileSizeFilter.element(by.css('mat-expansion-panel-header'));
|
||||
Util.waitUntilElementIsClickable(fileSizeFilterHeader);
|
||||
return fileSizeFilterHeader.click();
|
||||
this.searchCategoriesPage.clickFilterHeader(this.fileSizeFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
clickFileTypeFilterHeader() {
|
||||
let fileTypeFilterHeader = this.fileTypeFilter.element(by.css('mat-expansion-panel-header'));
|
||||
Util.waitUntilElementIsClickable(fileTypeFilterHeader);
|
||||
return fileTypeFilterHeader.click();
|
||||
this.searchCategoriesPage.clickFilterHeader(this.fileTypeFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkFileTypeFilterIsCollapsed() {
|
||||
this.fileTypeFilter.getAttribute('class').then((elementClass) => {
|
||||
expect(elementClass).not.toContain('mat-expanded');
|
||||
});
|
||||
this.searchCategoriesPage.checkFilterIsCollapsed(this.fileTypeFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkFileSizeFilterIsCollapsed() {
|
||||
this.fileSizeFilter.getAttribute('class').then((elementClass) => {
|
||||
expect(elementClass).not.toContain('mat-expanded');
|
||||
});
|
||||
this.searchCategoriesPage.checkFilterIsCollapsed(this.fileSizeFilter);
|
||||
return this;
|
||||
}
|
||||
|
||||
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')));
|
||||
}
|
||||
|
||||
clickCreatedShowMoreButtonUntilIsNotDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.createdFilter);
|
||||
|
||||
this.showMoreButtonForCreated.isDisplayed().then(async (visible) => {
|
||||
if (visible) {
|
||||
this.showMoreButtonForCreated.click();
|
||||
|
||||
this.clickCreatedShowMoreButtonUntilIsNotDisplayed();
|
||||
}
|
||||
}, err => {
|
||||
});
|
||||
}
|
||||
|
||||
checkCreatedShowMoreButtonIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.showMoreButtonForCreated);
|
||||
}
|
||||
|
||||
clickCreatedShowLessButtonUntilIsNotDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.createdFilter);
|
||||
|
||||
this.showLessButtonForCreated.isDisplayed().then(async (visible) => {
|
||||
if (visible) {
|
||||
this.showLessButtonForCreated.click();
|
||||
|
||||
this.clickCreatedShowLessButtonUntilIsNotDisplayed();
|
||||
}
|
||||
}, err => {
|
||||
});
|
||||
}
|
||||
|
||||
checkCreatedShowLessButtonIsNotDisplayed() {
|
||||
Util.waitUntilElementIsNotVisible(this.showLessButtonForCreated);
|
||||
}
|
||||
|
||||
checkCreatedShowLessButtonIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.showLessButtonForCreated);
|
||||
}
|
||||
|
||||
clickPngImageType() {
|
||||
Util.waitUntilElementIsVisible(this.pngImageFileType);
|
||||
return this.pngImageFileType.click();
|
||||
}
|
||||
|
||||
getBucketNumberOfFilterType(fileType) {
|
||||
let fileTypeFilter = element(by.css('mat-checkbox[data-automation-id="checkbox-SEARCH.FACET_FIELDS.' + fileType + '"] span'));
|
||||
Util.waitUntilElementIsVisible(fileTypeFilter);
|
||||
let bucketNumber = fileTypeFilter.getText().then((valueOfBucket) => {
|
||||
let numberOfBucket = valueOfBucket.split('(')[1];
|
||||
let totalNumberOfBucket = numberOfBucket.split(')')[0];
|
||||
return totalNumberOfBucket;
|
||||
});
|
||||
|
||||
return bucketNumber;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -29,6 +29,10 @@ export class SearchResultsPage {
|
||||
sortArrowLocator = by.css('adf-sorting-picker button mat-icon');
|
||||
sortingArrow = element(by.css('adf-sorting-picker div[class="mat-select-arrow"]'));
|
||||
|
||||
tableIsLoaded() {
|
||||
this.contentList.tableIsLoaded();
|
||||
}
|
||||
|
||||
closeActionButton() {
|
||||
let container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
|
||||
Util.waitUntilElementIsVisible(container);
|
||||
|
@@ -2,6 +2,7 @@
|
||||
<mat-checkbox
|
||||
*ngFor="let option of options"
|
||||
[checked]="option.checked"
|
||||
[attr.data-automation-id]="'checkbox-' + (option.name)"
|
||||
(change)="changeHandler($event, option)">
|
||||
{{ option.name | translate }}
|
||||
</mat-checkbox>
|
||||
|
Reference in New Issue
Block a user