ACS-8614: Remove old search layout protractor e2e (#10104)

This commit is contained in:
Denys Vuika 2024-08-20 08:36:36 -04:00 committed by GitHub
parent 4807f10827
commit 04e2b16f66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 0 additions and 3735 deletions

View File

@ -1,365 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, LocalStorageUtil, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { SearchResultsPage } from '../pages/search-results.page';
import { SearchFiltersPage } from '../pages/search-filters.page';
import { SearchBarPage } from '../pages/search-bar.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { SearchConfiguration } from '../search.config';
import { browser } from 'protractor';
import { NodesApi } from '@alfresco/js-api';
describe('Search Checklist Component', () => {
const loginPage = new LoginPage();
const searchFiltersPage = new SearchFiltersPage();
const searchBarPage = new SearchBarPage();
const searchResults = new SearchResultsPage();
const navigationBarPage = new NavigationBarPage();
const acsUser = new UserModel();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const nodesApi = new NodesApi(apiService.getInstance());
const filterType = {
folder: 'Folder',
document: 'Document',
custom: 'TEST_NAME'
};
const randomName = StringUtil.generateRandomString();
const nodeNames = {
document: `${randomName}.txt`,
folder: `${randomName}Folder`
};
let createdFile;
let createdFolder;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
createdFolder = await nodesApi.createNode('-my-', {
name: nodeNames.folder,
nodeType: 'cm:folder'
});
createdFile = await nodesApi.createNode('-my-', {
name: nodeNames.document,
nodeType: 'cm:content'
});
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await loginPage.login(acsUser.username, acsUser.password);
});
beforeEach(async () => {
await navigationBarPage.navigateToContentServices();
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
});
afterAll(async () => {
await apiService.login(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
await uploadActions.deleteFileOrFolder(createdFile.entry.id);
await uploadActions.deleteFileOrFolder(createdFolder.entry.id);
await navigationBarPage.clickLogoutButton();
});
it('[C276991] Should be able to click between options and Clear All button', async () => {
await searchFiltersPage.checkCheckListFilterIsDisplayed();
await searchFiltersPage.checkCheckListFilterIsCollapsed();
await searchFiltersPage.clickCheckListFilter();
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsDisplayed(filterType.folder);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsDisplayed(filterType.document);
await searchFiltersPage.checkListFiltersPage().checkClearAllButtonIsDisplayed();
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsNotSelected(filterType.folder);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsNotSelected(filterType.document);
await searchFiltersPage.checkListFiltersPage().clickCheckListOption(filterType.folder);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsSelected(filterType.folder);
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(nodeNames.folder);
await searchResults.checkContentIsNotDisplayed(nodeNames.document);
await searchFiltersPage.checkListFiltersPage().clickClearAllButton();
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsNotSelected(filterType.folder);
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(nodeNames.folder);
await searchResults.checkContentIsDisplayed(nodeNames.document);
await searchFiltersPage.checkListFiltersPage().clickCheckListOption(filterType.folder);
await searchFiltersPage.checkListFiltersPage().clickCheckListOption(filterType.document);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsSelected(filterType.folder);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsSelected(filterType.document);
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(nodeNames.folder);
await searchResults.checkContentIsDisplayed(nodeNames.document);
await searchFiltersPage.checkListFiltersPage().clickCheckListOption(filterType.folder);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsSelected(filterType.document);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsNotSelected(filterType.folder);
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(nodeNames.document);
await searchResults.checkContentIsNotDisplayed(nodeNames.folder);
});
describe('configuration change', () => {
let jsonFile;
beforeEach(() => {
jsonFile = SearchConfiguration.getConfiguration();
});
it('[C277143] Should be able to click show more/less button with pageSize set as default', async () => {
await navigationBarPage.navigateToContentServices();
for (let numberOfOptions = 0; numberOfOptions < 8; numberOfOptions++) {
jsonFile.categories[1].component.settings.options.push({
name: 'Folder',
value: `TYPE:'cm:folder'`
});
}
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickCheckListFilter();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(5);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsDisplayed();
await searchFiltersPage.checkListFiltersPage().checkShowLessButtonIsNotDisplayed();
await searchFiltersPage.checkListFiltersPage().clickShowMoreButton();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(10);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsNotDisplayed();
await searchFiltersPage.checkListFiltersPage().checkShowLessButtonIsDisplayed();
await searchFiltersPage.checkListFiltersPage().clickShowLessButton();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(5);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsDisplayed();
await searchFiltersPage.checkListFiltersPage().checkShowLessButtonIsNotDisplayed();
});
it('[C277144] Should be able to click show more/less button with pageSize set with a custom value', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile.categories[1].component.settings.pageSize = 10;
for (let numberOfOptions = 0; numberOfOptions < 8; numberOfOptions++) {
jsonFile.categories[1].component.settings.options.push({
name: 'Folder',
value: `TYPE:'cm:folder'`
});
}
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickCheckListFilter();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(10);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsNotDisplayed();
await navigationBarPage.navigateToContentServices();
jsonFile.categories[1].component.settings.pageSize = 11;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickCheckListFilter();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(10);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsNotDisplayed();
await navigationBarPage.navigateToContentServices();
jsonFile.categories[1].component.settings.pageSize = 9;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchFiltersPage.clickCheckListFilter();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(9);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsDisplayed();
});
it('[C277145] Should be able to click show more/less button with pageSize set to zero', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile.categories[1].component.settings.pageSize = 0;
for (let numberOfOptions = 0; numberOfOptions < 8; numberOfOptions++) {
jsonFile.categories[1].component.settings.options.push({
name: 'Folder',
value: `TYPE:'cm:folder'`
});
}
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickCheckListFilter();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(5);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsDisplayed();
await searchFiltersPage.checkListFiltersPage().checkShowLessButtonIsNotDisplayed();
await searchFiltersPage.checkListFiltersPage().clickShowMoreButton();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(10);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsNotDisplayed();
await searchFiltersPage.checkListFiltersPage().checkShowLessButtonIsDisplayed();
await navigationBarPage.navigateToContentServices();
delete jsonFile.categories[1].component.settings.pageSize;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickCheckListFilter();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(5);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsDisplayed();
await searchFiltersPage.checkListFiltersPage().checkShowLessButtonIsNotDisplayed();
await searchFiltersPage.checkListFiltersPage().clickShowMoreButton();
expect(await searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(10);
await searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsNotDisplayed();
await searchFiltersPage.checkListFiltersPage().checkShowLessButtonIsDisplayed();
});
});
describe('Properties', () => {
let jsonFile;
beforeEach(async () => {
jsonFile = SearchConfiguration.getConfiguration();
await navigationBarPage.navigateToContentServices();
});
it('[C277018] Should be able to change the operator', async () => {
jsonFile.categories[1].component.settings.operator = 'AND';
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickCheckListFilter();
await searchFiltersPage.checkListFiltersPage().clickCheckListOption(filterType.folder);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsSelected(filterType.folder);
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(nodeNames.folder);
await searchResults.checkContentIsNotDisplayed(nodeNames.document);
await searchFiltersPage.checkListFiltersPage().clickCheckListOption(filterType.document);
await searchResults.checkContentIsNotDisplayed(nodeNames.folder);
await searchResults.checkContentIsNotDisplayed(nodeNames.document);
});
it('[C277019] Should be able to add new properties with different types', async () => {
jsonFile.categories[1].component.settings.options.push({
name: filterType.custom,
value: `TYPE:'cm:auditable'`
});
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickCheckListFilter();
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsDisplayed(filterType.folder);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsDisplayed(filterType.document);
await searchFiltersPage.checkListFiltersPage().checkCheckListOptionIsDisplayed(filterType.custom);
await searchFiltersPage.checkListFiltersPage().clickCheckListOption(filterType.custom);
await searchResults.checkContentIsNotDisplayed(nodeNames.folder);
await searchResults.checkContentIsNotDisplayed(nodeNames.document);
await searchFiltersPage.checkListFiltersPage().clickCheckListOption(filterType.document);
await searchFiltersPage.checkListFiltersPage().clickCheckListOption(filterType.folder);
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(nodeNames.folder);
await searchResults.checkContentIsDisplayed(nodeNames.document);
});
});
});

View File

@ -1,501 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
BrowserActions,
DataTableComponentPage,
LocalStorageUtil,
LoginPage,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { SearchBarPage } from '../pages/search-bar.page';
import { SearchResultsPage } from '../pages/search-results.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { SearchFiltersPage } from '../pages/search-filters.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser, ElementFinder } from 'protractor';
import { SearchConfiguration } from '../search.config';
import { parse } from 'date-fns';
import { NodeEntry } from '@alfresco/js-api';
describe('Search Number Range Filter', () => {
const loginPage = new LoginPage();
const searchBarPage = new SearchBarPage();
const searchFilters = new SearchFiltersPage();
const sizeRangeFilter = searchFilters.sizeRangeFilterPage();
const searchResults = new SearchResultsPage();
const navigationBarPage = new NavigationBarPage();
const dataTable = new DataTableComponentPage();
const acsUser = new UserModel();
const file2BytesModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.UNSUPPORTED.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.UNSUPPORTED.file_path
});
const file0BytesModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path
});
let file2Bytes: NodeEntry;
let file0Bytes: NodeEntry;
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
file2Bytes = await uploadActions.uploadFile(file2BytesModel.location, file2BytesModel.name, '-my-');
file0Bytes = await uploadActions.uploadFile(file0BytesModel.location, file0BytesModel.name, '-my-');
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await loginPage.login(acsUser.username, acsUser.password);
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
});
afterAll(async () => {
await apiService.login(acsUser.username, acsUser.password);
await uploadActions.deleteFileOrFolder(file2Bytes.entry.id);
await uploadActions.deleteFileOrFolder(file0Bytes.entry.id);
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await searchFilters.checkSizeRangeFilterIsDisplayed();
await searchFilters.clickSizeRangeFilterHeader();
await searchFilters.checkSizeRangeFilterIsExpanded();
});
afterEach(async () => {
await browser.refresh();
});
it('[C276921] Should display default values for Number Range widget', async () => {
await sizeRangeFilter.checkFromFieldIsDisplayed();
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.checkApplyButtonIsDisplayed();
await sizeRangeFilter.checkClearButtonIsDisplayed();
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(false);
});
it('[C276922] Should be keep value when Number Range widget is collapsed', async () => {
const size = 5;
await sizeRangeFilter.putFromNumber(size);
await sizeRangeFilter.putToNumber(size);
await searchFilters.clickSizeRangeFilterHeader();
await searchFilters.checkSizeRangeFilterIsCollapsed();
await searchFilters.clickSizeRangeFilterHeader();
await searchFilters.checkSizeRangeFilterIsExpanded();
expect(await sizeRangeFilter.getFromNumber()).toEqual(`${size}`);
expect(await sizeRangeFilter.getToNumber()).toEqual(`${size}`);
});
it('[C276924] Should display error message when input had an invalid format', async () => {
await sizeRangeFilter.checkFromFieldIsDisplayed();
await sizeRangeFilter.putFromNumber('a');
await sizeRangeFilter.putToNumber('A');
await sizeRangeFilter.checkFromErrorInvalidIsDisplayed();
await sizeRangeFilter.checkToErrorInvalidIsDisplayed();
expect(await sizeRangeFilter.getFromErrorInvalid()).toEqual('Invalid Format');
expect(await sizeRangeFilter.getToErrorInvalid()).toEqual('Invalid Format');
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(false);
await sizeRangeFilter.putFromNumber('@');
await sizeRangeFilter.putToNumber('£');
await sizeRangeFilter.checkFromErrorInvalidIsDisplayed();
await sizeRangeFilter.checkToErrorInvalidIsDisplayed();
expect(await sizeRangeFilter.getFromErrorInvalid()).toEqual('Invalid Format');
expect(await sizeRangeFilter.getToErrorInvalid()).toEqual('Invalid Format');
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(false);
await sizeRangeFilter.putFromNumber('4.5');
await sizeRangeFilter.putToNumber('4,5');
await sizeRangeFilter.checkFromErrorInvalidIsDisplayed();
await sizeRangeFilter.checkToErrorInvalidIsDisplayed();
expect(await sizeRangeFilter.getFromErrorInvalid()).toEqual('Invalid Format');
expect(await sizeRangeFilter.getToErrorInvalid()).toEqual('Invalid Format');
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(false);
await sizeRangeFilter.putFromNumber('01');
await sizeRangeFilter.putToNumber('-1');
expect(await sizeRangeFilter.getFromErrorInvalid()).toEqual('Invalid Format');
expect(await sizeRangeFilter.getToErrorInvalid()).toEqual('Invalid Format');
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(false);
await sizeRangeFilter.clearFromField();
await sizeRangeFilter.clearToField();
await sizeRangeFilter.checkFromErrorRequiredIsDisplayed();
await sizeRangeFilter.checkToErrorRequiredIsDisplayed();
expect(await sizeRangeFilter.getFromErrorRequired()).toEqual('Required value');
expect(await sizeRangeFilter.getToErrorRequired()).toEqual('Required value');
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(false);
});
it('[C276943] Should be able to put a big value in To field', async () => {
const toSize = 999999999;
const fromSize = 0;
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(toSize);
await sizeRangeFilter.putFromNumber(fromSize);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.sortBySize('DESC');
const results = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
for (const currentResult of results) {
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
}
});
it('[C276944] Should be able to filter by name when size range filter is applied', async () => {
const nameFilter = searchFilters.textFiltersPage();
const toSize = 40;
const fromSize = 0;
await searchFilters.checkNameFilterIsDisplayed();
await searchFilters.checkNameFilterIsExpanded();
await nameFilter.searchByName('*');
await searchResults.dataTable.waitTillContentLoaded();
await sizeRangeFilter.checkFromFieldIsDisplayed();
await sizeRangeFilter.putFromNumber(fromSize);
await sizeRangeFilter.putToNumber(toSize);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.sortBySize('DESC');
const results = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
for (const currentResult of results) {
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
}
await searchFilters.checkNameFilterIsDisplayed();
await searchFilters.checkNameFilterIsExpanded();
await nameFilter.searchByName('z*');
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.sortBySize('DESC');
const resultsSize = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
for (const currentResult of resultsSize) {
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
}
const resultsDisplay = (await dataTable.geCellElementDetail('Display name')) as ElementFinder[];
for (const currentResult of resultsDisplay) {
const name = await BrowserActions.getAttribute(currentResult, 'title');
if (name && name.trim() !== '') {
expect(/z*/i.test(name)).toBe(true);
}
}
});
it('[C276951] Should not display folders when Size range is applied', async () => {
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(99999999);
await sizeRangeFilter.putFromNumber(0);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchFilters.checkCheckListFilterIsDisplayed();
await searchFilters.clickCheckListFilter();
await searchFilters.checkCheckListFilterIsExpanded();
await searchFilters.checkListFiltersPage().clickCheckListOption('Folder');
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkNoResultMessageIsDisplayed();
});
it('[C276952] Should only display empty files when size range is set from 0 to 1', async () => {
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(1);
await sizeRangeFilter.putFromNumber(0);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.sortBySize('DESC');
const results = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
for (const currentResult of results) {
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
expect(currentSize === '0' || currentSize === '1').toBe(true);
}
}
});
it('[C277092] Should disable apply button when from field value equal/is bigger than to field value', async () => {
await sizeRangeFilter.checkFromFieldIsDisplayed();
await sizeRangeFilter.putFromNumber(10);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(false);
await sizeRangeFilter.putToNumber('5');
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(false);
await sizeRangeFilter.putToNumber('10');
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(false);
});
it('[C289930] Should be able to clear values in number range fields', async () => {
await sizeRangeFilter.checkFromFieldIsDisplayed();
await sizeRangeFilter.checkClearButtonIsDisplayed();
await sizeRangeFilter.checkNoErrorMessageIsDisplayed();
await sizeRangeFilter.clickClearButton();
await sizeRangeFilter.checkNoErrorMessageIsDisplayed();
await sizeRangeFilter.putFromNumber(0);
await sizeRangeFilter.putToNumber(1);
await sizeRangeFilter.clickClearButton();
expect(await sizeRangeFilter.getFromNumber()).toEqual('');
expect(await sizeRangeFilter.getToNumber()).toEqual('');
await sizeRangeFilter.putFromNumber(0);
await sizeRangeFilter.putToNumber(1);
await sizeRangeFilter.clickApplyButton();
await searchResults.sortBySize('DESC');
const results = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
for (const currentResult of results) {
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
expect(parseInt(currentSize, 10) <= 1000).toBe(true);
}
}
await sizeRangeFilter.clickClearButton();
expect(await sizeRangeFilter.getFromNumber()).toEqual('');
expect(await sizeRangeFilter.getToNumber()).toEqual('');
await dataTable.waitTillContentLoaded();
const resultsSize = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
for (const currentResult of resultsSize) {
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
expect(parseInt(currentSize, 10) >= 1000).toBe(true);
}
}
});
it('[C277137] Number Range should be inclusive', async () => {
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(2);
await sizeRangeFilter.putFromNumber(1);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(file2BytesModel.name);
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(1);
await sizeRangeFilter.putFromNumber(0);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsNotDisplayed(file2BytesModel.name);
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(3);
await sizeRangeFilter.putFromNumber(2);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(file2BytesModel.name);
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(4);
await sizeRangeFilter.putFromNumber(3);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsNotDisplayed(file2BytesModel.name);
});
describe('Configuration change', () => {
let jsonFile;
beforeEach(() => {
jsonFile = SearchConfiguration.getConfiguration();
});
it('[C276928] Should be able to change the field property for number range', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile.categories[3].component.settings.field = 'cm:created';
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFilters.checkSizeRangeFilterIsDisplayed();
await searchFilters.clickSizeRangeFilterHeader();
await searchFilters.checkSizeRangeFilterIsExpanded();
const fromYear = new Date().getFullYear();
const toYear = fromYear + 1;
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(toYear);
await sizeRangeFilter.putFromNumber(fromYear);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.sortByCreated('DESC');
const results = (await dataTable.geCellElementDetail('Created')) as ElementFinder[];
for (const currentResult of results) {
const currentDate = await BrowserActions.getAttribute(currentResult, 'title');
const currentDateFormatted = parse(currentDate, 'MMM dd, yyyy, h:mm:ss a', new Date());
expect(currentDateFormatted.getFullYear() <= toYear).toBe(true);
expect(currentDateFormatted.getFullYear() >= fromYear).toBe(true);
}
});
it('[C277139] Should be able to set To field to be exclusive', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile.categories[3].component.settings.format = '[{FROM} TO {TO}>';
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFilters.checkSizeRangeFilterIsDisplayed();
await searchFilters.clickSizeRangeFilterHeader();
await searchFilters.checkSizeRangeFilterIsExpanded();
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(2);
await sizeRangeFilter.putFromNumber(1);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsNotDisplayed(file2BytesModel.name);
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(3);
await sizeRangeFilter.putFromNumber(1);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(file2BytesModel.name);
});
it('[C277140] Should be able to set From field to be exclusive', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile.categories[3].component.settings.format = '<{FROM} TO {TO}]';
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFilters.checkSizeRangeFilterIsDisplayed();
await searchFilters.clickSizeRangeFilterHeader();
await searchFilters.checkSizeRangeFilterIsExpanded();
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(3);
await sizeRangeFilter.putFromNumber(1);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsDisplayed(file2BytesModel.name);
await sizeRangeFilter.checkToFieldIsDisplayed();
await sizeRangeFilter.putToNumber(3);
await sizeRangeFilter.putFromNumber(2);
expect(await sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
await sizeRangeFilter.clickApplyButton();
await searchResults.dataTable.waitTillContentLoaded();
await searchResults.checkContentIsNotDisplayed(file2BytesModel.name);
});
});
});

View File

@ -1,311 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
BrowserActions,
LocalStorageUtil,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { SearchFiltersPage } from '../pages/search-filters.page';
import { SearchResultsPage } from '../pages/search-results.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { SearchBarPage } from '../pages/search-bar.page';
import { SearchConfiguration } from '../search.config';
import { browser } from 'protractor';
import { NodesApi } from '@alfresco/js-api';
describe('Search Radio Component', () => {
const loginPage = new LoginPage();
const searchFiltersPage = new SearchFiltersPage();
const navigationBarPage = new NavigationBarPage();
const searchBarPage = new SearchBarPage();
const searchResults = new SearchResultsPage();
const acsUser = new UserModel();
const apiService = createApiService();
const nodesApi = new NodesApi(apiService.getInstance());
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const filterType = {
none: 'None',
all: 'All',
folder: 'Folder',
document: 'Document',
custom: 'TEST_NAME'
};
const randomName = StringUtil.generateRandomString();
const nodeNames = {
document: `${randomName}.txt`,
folder: `${randomName}Folder`
};
let createdFile;
let createdFolder;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
createdFolder = await nodesApi.createNode('-my-', {
name: nodeNames.folder,
nodeType: 'cm:folder'
});
createdFile = await nodesApi.createNode('-my-', {
name: nodeNames.document,
nodeType: 'cm:content'
});
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await loginPage.login(acsUser.username, acsUser.password);
await BrowserActions.getUrl(browser.baseUrl + '/search;q=' + randomName);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(createdFile.entry.id);
await uploadActions.deleteFileOrFolder(createdFolder.entry.id);
await navigationBarPage.clickLogoutButton();
});
it('[C277039] Should be able to choose only one option at a time', async () => {
await searchFiltersPage.checkTypeFilterIsDisplayed();
await searchFiltersPage.checkTypeFilterIsCollapsed();
await searchFiltersPage.clickTypeFilterHeader();
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.none);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.all);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.folder);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.document);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.none);
await searchResults.checkContentIsDisplayed(nodeNames.folder);
await searchResults.checkContentIsDisplayed(nodeNames.document);
await searchFiltersPage.typeFiltersPage().clickFilterRadioButton(filterType.folder);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.folder);
await searchResults.checkContentIsDisplayed(nodeNames.folder);
await searchResults.checkContentIsNotDisplayed(nodeNames.document);
await searchFiltersPage.typeFiltersPage().clickFilterRadioButton(filterType.document);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.document);
await searchResults.checkContentIsDisplayed(nodeNames.document);
await searchResults.checkContentIsNotDisplayed(nodeNames.folder);
await searchFiltersPage.typeFiltersPage().clickFilterRadioButton(filterType.all);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.all);
await searchResults.checkContentIsDisplayed(nodeNames.folder);
await searchResults.checkContentIsDisplayed(nodeNames.document);
});
describe('configuration change', () => {
let jsonFile;
beforeEach(() => {
jsonFile = SearchConfiguration.getConfiguration();
});
it('[C277147] Should be able to customise the pageSize value', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile.categories[5].component.settings.pageSize = 10;
for (let numberOfOptions = 0; numberOfOptions < 6; numberOfOptions++) {
jsonFile.categories[5].component.settings.options.push({
name: 'Folder',
value: `TYPE:'cm:folder'`
});
}
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickTypeFilterHeader();
expect(await searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(16);
await navigationBarPage.navigateToContentServices();
jsonFile.categories[5].component.settings.pageSize = 11;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickTypeFilterHeader();
expect(await searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(16);
await navigationBarPage.navigateToContentServices();
jsonFile.categories[5].component.settings.pageSize = 9;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickTypeFilterHeader();
expect(await searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(15);
await searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
await searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
await browser.refresh();
});
it('[C277148] Should be able to click show more/less button', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile.categories[5].component.settings.pageSize = 0;
for (let numberOfOptions = 0; numberOfOptions < 6; numberOfOptions++) {
jsonFile.categories[5].component.settings.options.push({
name: 'Folder',
value: `TYPE:'cm:folder'`
});
}
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickTypeFilterHeader();
expect(await searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(11);
await searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
await searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
await searchFiltersPage.typeFiltersPage().clickShowMoreButton();
expect(await searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(16);
await searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsNotDisplayed();
await searchFiltersPage.typeFiltersPage().checkShowLessButtonIsDisplayed();
await searchFiltersPage.typeFiltersPage().clickShowLessButton();
expect(await searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(11);
await searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
await searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
await navigationBarPage.navigateToContentServices();
delete jsonFile.categories[5].component.settings.pageSize;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickTypeFilterHeader();
expect(await searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(11);
await searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
await searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
await searchFiltersPage.typeFiltersPage().clickShowMoreButton();
expect(await searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(16);
await searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsNotDisplayed();
await searchFiltersPage.typeFiltersPage().checkShowLessButtonIsDisplayed();
await searchFiltersPage.typeFiltersPage().clickShowLessButton();
expect(await searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(11);
await searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed();
await searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed();
});
});
describe('Properties', () => {
let jsonFile;
beforeEach(() => {
jsonFile = SearchConfiguration.getConfiguration();
});
beforeAll(async () => {
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
});
it('[C277033] Should be able to add a new option', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile.categories[5].component.settings.options.push({
name: filterType.custom,
value: `TYPE:'cm:content'`
});
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterTextAndPressEnter(randomName);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.clickTypeFilterHeader();
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.none);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.all);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.folder);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.document);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsDisplayed(filterType.custom);
await searchFiltersPage.typeFiltersPage().checkFilterRadioButtonIsChecked(filterType.none);
await searchFiltersPage.typeFiltersPage().clickFilterRadioButton(filterType.custom);
await searchResults.checkContentIsDisplayed(nodeNames.document);
await searchResults.checkContentIsNotDisplayed(nodeNames.folder);
});
});
});

View File

@ -1,239 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
BrowserActions,
DataTableComponentPage,
LocalStorageUtil,
LoginPage,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { SearchBarPage } from '../pages/search-bar.page';
import { SearchResultsPage } from '../pages/search-results.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { SearchFiltersPage } from '../pages/search-filters.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser, ElementFinder } from 'protractor';
import { SearchConfiguration } from '../search.config';
describe('Search Slider Filter', () => {
const loginPage = new LoginPage();
const searchBarPage = new SearchBarPage();
const searchFilters = new SearchFiltersPage();
const sizeSliderFilter = searchFilters.sizeSliderFilterPage();
const searchResults = new SearchResultsPage();
const navigationBarPage = new NavigationBarPage();
const dataTable = new DataTableComponentPage();
const acsUser = new UserModel();
const file2BytesModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.UNSUPPORTED.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.UNSUPPORTED.file_path
});
let file2Bytes;
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
file2Bytes = await uploadActions.uploadFile(file2BytesModel.location, file2BytesModel.name, '-my-');
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await loginPage.login(acsUser.username, acsUser.password);
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
});
afterAll(async () => {
try {
await apiService.login(acsUser.username, acsUser.password);
await uploadActions.deleteFileOrFolder(file2Bytes.entry.id);
} catch (error) {}
await navigationBarPage.clickLogoutButton();
});
afterEach(async () => {
await browser.refresh();
});
it('[C276970] Should be able to expand/collapse Search Size Slider', async () => {
await searchFilters.checkSizeSliderFilterIsDisplayed();
await searchFilters.clickSizeSliderFilterHeader();
await sizeSliderFilter.checkSliderIsDisplayed();
await sizeSliderFilter.checkClearButtonIsDisplayed();
await sizeSliderFilter.checkClearButtonIsEnabled();
await searchFilters.clickSizeSliderFilterHeader();
await searchFilters.checkSizeSliderFilterIsCollapsed();
await sizeSliderFilter.checkSliderIsNotDisplayed();
await sizeSliderFilter.checkClearButtonIsNotDisplayed();
});
it('[C276972] Should be keep value when Search Size Slider is collapsed', async () => {
const size = 10;
await searchFilters.checkSizeSliderFilterIsDisplayed();
await searchFilters.clickSizeSliderFilterHeader();
await sizeSliderFilter.checkSliderIsDisplayed();
await sizeSliderFilter.setValue(size);
await searchFilters.clickSizeSliderFilterHeader();
await searchFilters.checkSizeSliderFilterIsCollapsed();
await searchFilters.checkSizeSliderFilterIsDisplayed();
await searchFilters.clickSizeSliderFilterHeader();
await searchFilters.checkSizeSliderFilterIsExpanded();
expect(await sizeSliderFilter.getValue()).toEqual(`${size}`);
});
it('[C276981] Should be able to clear value in Search Size Slider', async () => {
const size = 5;
await searchFilters.checkSizeSliderFilterIsDisplayed();
await searchFilters.clickSizeSliderFilterHeader();
await sizeSliderFilter.checkSliderIsDisplayed();
await sizeSliderFilter.setValue(size);
await searchResults.sortBySize('DESC');
const results = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
for (const currentResult of results) {
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
expect(parseInt(currentSize, 10) <= 5000).toBe(true);
}
}
await sizeSliderFilter.checkSliderIsDisplayed();
await sizeSliderFilter.clickClearButton();
await searchResults.sortBySize('DESC');
const resultsSize = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
for (const currentResult of resultsSize) {
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
expect(parseInt(currentSize, 10) >= 5000).toBe(true);
}
}
});
describe('Configuration change', () => {
let jsonFile;
beforeEach(async () => {
jsonFile = SearchConfiguration.getConfiguration();
await navigationBarPage.navigateToContentServices();
});
it('[C276983] Should be able to disable thumb label in Search Size Slider', async () => {
jsonFile.categories[2].component.settings.thumbLabel = false;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFilters.checkSizeSliderFilterIsDisplayed();
await searchFilters.clickSizeSliderFilterHeader();
await searchFilters.checkSizeSliderFilterIsExpanded();
await sizeSliderFilter.checkSliderWithThumbLabelIsNotDisplayed();
});
it('[C276985] Should be able to set min value for Search Size Slider', async () => {
const minSize = 3;
jsonFile.categories[2].component.settings.min = minSize;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFilters.checkSizeSliderFilterIsDisplayed();
await searchFilters.clickSizeSliderFilterHeader();
await searchFilters.checkSizeSliderFilterIsExpanded();
await sizeSliderFilter.checkSliderIsDisplayed();
expect(await sizeSliderFilter.getMinValue()).toEqual(`${minSize}`);
});
it('[C276986] Should be able to set max value for Search Size Slider', async () => {
const maxSize = 50;
jsonFile.categories[2].component.settings.max = maxSize;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFilters.checkSizeSliderFilterIsDisplayed();
await searchFilters.clickSizeSliderFilterHeader();
await searchFilters.checkSizeSliderFilterIsExpanded();
await sizeSliderFilter.checkSliderIsDisplayed();
expect(await sizeSliderFilter.getMaxValue()).toEqual(`${maxSize}`);
});
it('[C276987] Should be able to set steps for Search Size Slider', async () => {
const step = 10;
jsonFile.categories[2].component.settings.step = step;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFilters.checkSizeSliderFilterIsDisplayed();
await searchFilters.clickSizeSliderFilterHeader();
await searchFilters.checkSizeSliderFilterIsExpanded();
const randomValue = 5;
await sizeSliderFilter.checkSliderIsDisplayed();
await sizeSliderFilter.setValue(randomValue);
expect(await sizeSliderFilter.getValue()).toEqual(`0`);
await sizeSliderFilter.setValue(step);
expect(await sizeSliderFilter.getValue()).toEqual(`${step}`);
});
});
});

View File

@ -1,120 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { FolderModel } from '../../models/ACS/folder.model';
import { createApiService,
BrowserActions,
LocalStorageUtil,
LoginPage,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { SearchBarPage } from '../pages/search-bar.page';
import { SearchResultsPage } from '../pages/search-results.page';
import { SearchFiltersPage } from '../pages/search-filters.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { SearchConfiguration } from '../search.config';
import { NodesApi } from '@alfresco/js-api';
describe('Search component - Text widget', () => {
const navigationBarPage = new NavigationBarPage();
const searchFiltersPage = new SearchFiltersPage();
const loginPage = new LoginPage();
const searchBarPage = new SearchBarPage();
const searchResultPage = new SearchResultsPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const nodesApi = new NodesApi(apiService.getInstance());
const acsUser = new UserModel();
const newFolderModel = new FolderModel({ description: 'newDescription' });
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
await nodesApi.createNode('-my-', {
name: newFolderModel.name,
nodeType: 'cm:folder',
properties:
{
'cm:description': newFolderModel.description
}
}, {});
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await loginPage.login(acsUser.username, acsUser.password);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
describe('configuration change', () => {
it('[C289330] Should be able to change the Field setting', async () => {
await BrowserActions.getUrl(browser.baseUrl + '/search;q=*');
await searchResultPage.tableIsLoaded();
await searchFiltersPage.checkCheckListFilterIsDisplayed();
await searchFiltersPage.clickCheckListFilter();
await searchFiltersPage.checkListFiltersPage().clickCheckListOption('Folder');
await searchFiltersPage.checkNameFilterIsDisplayed();
await searchFiltersPage.textFiltersPage().searchByName(newFolderModel.name);
await searchResultPage.dataTable.waitTillContentLoaded();
await searchResultPage.checkContentIsDisplayed(newFolderModel.name);
await searchFiltersPage.textFiltersPage().searchByName(newFolderModel.description);
await searchResultPage.checkContentIsNotDisplayed(newFolderModel.name);
const jsonFile= SearchConfiguration.getConfiguration();
jsonFile.categories[0].component.settings.field = 'cm:description';
await navigationBarPage.navigateToContentServices();
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResultPage.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkCheckListFilterIsDisplayed();
await searchFiltersPage.clickCheckListFilter();
await searchFiltersPage.checkListFiltersPage().clickCheckListOption('Folder');
await searchFiltersPage.checkNameFilterIsDisplayed();
await searchFiltersPage.textFiltersPage().searchByName(newFolderModel.name);
await searchResultPage.checkContentIsNotDisplayed(newFolderModel.name);
await searchFiltersPage.textFiltersPage().searchByName(newFolderModel.description);
await searchResultPage.dataTable.waitTillContentLoaded();
await searchResultPage.checkContentIsDisplayed(newFolderModel.name);
});
});
});

View File

@ -1,94 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ElementFinder, protractor, $ } from 'protractor';
import { BrowserVisibility, BrowserActions, TestElement, materialLocators } from '@alfresco/adf-testing';
export class SearchBarPage {
searchIcon = $(`button[class*='adf-search-button']`);
searchBar = $(`adf-search-control input`);
searchBarExpanded = TestElement.byCss(`adf-search-control ${materialLocators.Form.field.root}[class*="${materialLocators.Focused.root}"] input`);
noResultMessage = $(`p[class*='adf-search-fixed-text']`);
rowsAuthor = `${materialLocators.List.content.class} p[class*='adf-search-fixed-text']`;
completeName = `h4[class*='adf-search-fixed-text']`;
highlightName = `.adf-highlight`;
searchBarPage = $(`${materialLocators.List.root}[id='autocomplete-search-result-list']`);
getRowByRowName = (name: string): ElementFinder => $(`[data-automation-id='autocomplete_for_${name}']`);
async clickOnSearchIcon(): Promise<void> {
await BrowserActions.click(this.searchIcon);
}
async checkSearchIconIsVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchIcon);
}
async checkSearchBarIsVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
}
async checkSearchBarIsNotVisible(): Promise<void> {
await this.searchBarExpanded.waitNotVisible();
}
async checkNoResultMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noResultMessage);
}
async checkNoResultMessageIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.noResultMessage);
}
async enterText(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
await BrowserActions.clearSendKeys(this.searchBar, text);
}
async enterTextAndPressEnter(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
await BrowserActions.clearSendKeys(this.searchBar, text);
await this.searchBar.sendKeys(protractor.Key.ENTER);
}
async resultTableContainsRow(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBarPage);
await BrowserVisibility.waitUntilElementIsVisible(this.getRowByRowName(name));
}
async clickOnSpecificRow(fileName: string): Promise<void> {
await this.resultTableContainsRow(fileName);
await BrowserActions.click(this.getRowByRowName(fileName));
}
async getSpecificRowsHighlightName(fileName: string): Promise<string> {
return BrowserActions.getText(this.getRowByRowName(fileName).$(this.highlightName));
}
async getSpecificRowsCompleteName(fileName: string): Promise<string> {
return BrowserActions.getText(this.getRowByRowName(fileName).$(this.completeName));
}
async getSpecificRowsAuthor(fileName: string): Promise<string> {
return BrowserActions.getText(this.getRowByRowName(fileName).$(this.rowsAuthor));
}
async clearText(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
await this.searchBar.clear();
}
}

View File

@ -1,228 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
BrowserVisibility,
NumberRangeFilterPage,
SearchCategoriesPage,
SearchCheckListPage,
SearchRadioPage,
SearchSliderPage,
SearchTextPage
} from '@alfresco/adf-testing';
import { $, by } from 'protractor';
export class SearchFiltersPage {
searchCategoriesPage: SearchCategoriesPage = new SearchCategoriesPage();
searchFilters = $('adf-search-filter');
fileTypeFilter = $('[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]');
creatorFilter = $('[data-automation-id="expansion-panel-SEARCH.FILTER.PEOPLE"]');
fileSizeFilter = $('[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]');
nameFilter = $('[data-automation-id="expansion-panel-Name"]');
checkListFilter = $('[data-automation-id="expansion-panel-Check List"]');
typeFilter = $('[data-automation-id="expansion-panel-Type"]');
sizeRangeFilter = $('[data-automation-id="expansion-panel-Content Size (range)"]');
sizeSliderFilter = $('[data-automation-id="expansion-panel-Content Size"]');
facetQueriesDefaultGroup = $(
'[data-automation-id="expansion-panel-SEARCH.FACET_QUERIES.MY_FACET_QUERIES"],' + '[data-automation-id="expansion-panel-My facet queries"]'
);
facetQueriesTypeGroup = $('[data-automation-id="expansion-panel-Type facet queries"]');
facetQueriesSizeGroup = $('[data-automation-id="expansion-panel-Size facet queries"]');
facetIntervalsByCreated = $('[data-automation-id="expansion-panel-The Created"]');
facetIntervalsByModified = $('[data-automation-id="expansion-panel-TheModified"]');
async checkSearchFiltersIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchFilters);
}
sizeRangeFilterPage(): NumberRangeFilterPage {
return SearchCategoriesPage.numberRangeFilter(this.sizeRangeFilter);
}
textFiltersPage(): SearchTextPage {
return SearchCategoriesPage.textFiltersPage(this.nameFilter);
}
checkListFiltersPage(): SearchCheckListPage {
return SearchCategoriesPage.checkListFiltersPage(this.checkListFilter);
}
creatorCheckListFiltersPage(): SearchCheckListPage {
return SearchCategoriesPage.checkListFiltersPage(this.creatorFilter);
}
fileTypeCheckListFiltersPage(): SearchCheckListPage {
return SearchCategoriesPage.checkListFiltersPage(this.fileTypeFilter);
}
typeFiltersPage(): SearchRadioPage {
return SearchCategoriesPage.radioFiltersPage(this.typeFilter);
}
async checkCustomFacetFieldLabelIsDisplayed(fieldLabel: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible($(`[data-automation-id="expansion-panel-${fieldLabel}"]`));
}
sizeSliderFilterPage(): SearchSliderPage {
return SearchCategoriesPage.sliderFilter(this.sizeSliderFilter);
}
async checkCheckListFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.checkListFilter);
}
async checkNameFilterIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.nameFilter);
}
async checkNameFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.nameFilter);
}
async checkDefaultFacetQueryGroupIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetQueriesDefaultGroup);
}
async checkTypeFacetQueryGroupIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetQueriesTypeGroup);
}
async checkSizeFacetQueryGroupIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetQueriesSizeGroup);
}
async checkFacetIntervalsByCreatedIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetIntervalsByCreated);
}
async checkFacetIntervalsByModifiedIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetIntervalsByModified);
}
async isTypeFacetQueryGroupPresent(): Promise<boolean> {
return this.facetQueriesTypeGroup.isPresent();
}
async isSizeFacetQueryGroupPresent(): Promise<boolean> {
return this.facetQueriesSizeGroup.isPresent();
}
async clickCheckListFilter(): Promise<void> {
await this.searchCategoriesPage.clickFilter(this.checkListFilter);
}
async clickFileTypeListFilter(): Promise<void> {
await this.searchCategoriesPage.clickFilter(this.fileTypeFilter);
}
async clickFileSizeFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.fileSizeFilter);
}
async checkFileSizeFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.fileSizeFilter);
}
async checkFileTypeFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.fileTypeFilter);
}
async checkCheckListFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.checkListFilter);
}
async checkCheckListFilterIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.checkListFilter);
}
async checkTypeFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.typeFilter);
}
async checkTypeFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.typeFilter);
}
async clickTypeFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.typeFilter);
}
async checkSizeRangeFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.sizeRangeFilter);
}
async clickSizeRangeFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.sizeRangeFilter);
}
async checkSizeRangeFilterIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.sizeRangeFilter);
}
async checkSizeRangeFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.sizeRangeFilter);
}
async checkSizeSliderFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.sizeSliderFilter);
}
async clickSizeSliderFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.sizeSliderFilter);
}
async checkSizeSliderFilterIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.sizeSliderFilter);
}
async checkSizeSliderFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.sizeSliderFilter);
}
async checkFacetIntervalsByCreatedIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.facetIntervalsByCreated);
}
async checkFacetIntervalsByCreatedIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.facetIntervalsByCreated);
}
async clickFacetIntervalsByCreatedFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.facetIntervalsByCreated);
}
async checkFacetIntervalsByModifiedIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.facetIntervalsByModified);
}
async checkFacetIntervalsByModifiedIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.facetIntervalsByModified);
}
async clickFacetIntervalsByModifiedFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.facetIntervalsByModified);
}
async checkFileTypeFacetLabelIsDisplayed(fileType: string | RegExp): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.fileTypeFilter.element(by.cssContainingText('.adf-facet-label', fileType)));
}
async checkFileTypeFacetLabelIsNotDisplayed(fileType: string | RegExp): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.fileTypeFilter.element(by.cssContainingText('.adf-facet-label', fileType)));
}
}

View File

@ -1,59 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserVisibility, DataTableComponentPage, SearchSortingPickerPage } from '@alfresco/adf-testing';
import { $ } from 'protractor';
export class SearchResultsPage {
noResultsMessage = $('.app-no-result-message');
dataTable = new DataTableComponentPage();
searchSortingPicker = new SearchSortingPickerPage();
getNodeHighlight(content: string) {
return this.dataTable.getCellByRowContentAndColumn('Display name', content, 'Search');
}
async tableIsLoaded(): Promise<void> {
await this.dataTable.tableIsLoaded();
}
async checkContentIsDisplayed(content: string): Promise<void> {
await this.dataTable.checkContentIsDisplayed('Display name', content);
}
async numberOfResultsDisplayed(): Promise<number> {
return this.dataTable.numberOfRows();
}
async checkContentIsNotDisplayed(content: string): Promise<void> {
await this.dataTable.checkContentIsNotDisplayed('Display name', content);
}
async checkNoResultMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noResultsMessage);
}
async sortByCreated(sortOrder: string): Promise<void> {
await this.searchSortingPicker.sortBy(sortOrder, 'Created');
await this.dataTable.waitTillContentLoaded();
}
async sortBySize(sortOrder: string): Promise<void> {
await this.searchSortingPicker.sortBy(sortOrder, 'Size');
await this.dataTable.waitTillContentLoaded();
}
}

View File

@ -1,295 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
BrowserActions,
LocalStorageUtil,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { SearchBarPage } from './pages/search-bar.page';
import { ContentServicesPage } from '../core/pages/content-services.page';
import { SearchResultsPage } from './pages/search-results.page';
import { FileModel } from '../models/ACS/file.model';
import { FolderModel } from '../models/ACS/folder.model';
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
import { SearchConfiguration } from './search.config';
import { NodeEntry, NodesApi } from '@alfresco/js-api';
describe('Search component - Search Bar', () => {
const search = {
inactive: {
firstChar: 'x',
secondChar: 'y',
thirdChar: 'z',
name: 'impossible-name-folder' + StringUtil.generateRandomString(8)
}
};
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBarPage = new NavigationBarPage();
const searchBarPage = new SearchBarPage();
const searchResultPage = new SearchResultsPage();
const viewerPage = new ViewerPage();
const acsUser = new UserModel();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const nodesApi = new NodesApi(apiService.getInstance());
const uploadActions = new UploadActions(apiService);
const filename = StringUtil.generateRandomString(16);
const firstFolderName = StringUtil.generateRandomString(16);
const secondFolderName = StringUtil.generateRandomString(16);
const thirdFolderName = StringUtil.generateRandomString(16);
const filesToDelete: NodeEntry[] = [];
const firstFileModel = new FileModel({
name: filename,
shortName: filename.substring(0, 8)
});
const firstFolderModel = new FolderModel({
name: firstFolderName,
shortName: firstFolderName.substring(0, 8)
});
const secondFolder = new FolderModel({
name: secondFolderName,
shortName: secondFolderName.substring(0, 8)
});
const thirdFolder = new FolderModel({
name: thirdFolderName,
shortName: thirdFolderName.substring(0, 8)
});
const term = 'Zoizo';
let fileHighlightUploaded: NodeEntry;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
const firstFileUploaded = await uploadActions.uploadFile(firstFileModel.location, firstFileModel.name, '-my-');
Object.assign(firstFileModel, firstFileUploaded.entry);
fileHighlightUploaded = await nodesApi.createNode('-my-', {
name: StringUtil.generateRandomString(16),
nodeType: 'cm:content',
properties: {
'cm:title': term,
'cm:description': 'Jadore les ' + term
}
});
filesToDelete.push(fileHighlightUploaded);
filesToDelete.push(firstFileUploaded);
filesToDelete.push(await uploadActions.createFolder(firstFolderModel.name, '-my-'));
filesToDelete.push(await uploadActions.createFolder(secondFolder.name, '-my-'));
filesToDelete.push(await uploadActions.createFolder(thirdFolder.name, '-my-'));
await browser.sleep(browser.params.testConfig.timeouts.index_search); // wait search index previous file/folder uploaded
await loginPage.login(acsUser.username, acsUser.password);
});
afterAll(async () => {
for (const currentNode of filesToDelete) {
await uploadActions.deleteFileOrFolder(currentNode.entry.id);
}
await navigationBarPage.clickLogoutButton();
});
afterEach(async () => {
await BrowserActions.getUrl(browser.baseUrl);
});
it('[C272798] Search bar should be visible', async () => {
await openSearchBar();
await searchBarPage.checkSearchIconIsVisible();
await BrowserActions.closeMenuAndDialogs();
await searchBarPage.checkSearchBarIsNotVisible();
await searchBarPage.checkSearchIconIsVisible();
});
it('[C272799] Should be possible to hide search bar after input', async () => {
await openSearchBar();
await searchBarPage.enterText(firstFolderModel.shortName);
});
it('[C260255] Should display message when searching for an inexistent file', async () => {
await openSearchBar();
await searchBarPage.checkNoResultMessageIsNotDisplayed();
await searchBarPage.enterText(search.inactive.name);
await searchResultPage.dataTable.waitTillContentLoaded();
await searchBarPage.checkNoResultMessageIsDisplayed();
});
it('[C260256] Should display file/folder in search suggestion when typing first characters', async () => {
await openSearchBar();
await searchBarPage.enterText(firstFolderModel.shortName);
await searchBarPage.resultTableContainsRow(firstFolderModel.name);
expect(await searchBarPage.getSpecificRowsHighlightName(firstFolderModel.name)).toEqual(firstFolderModel.shortName);
expect(await searchBarPage.getSpecificRowsAuthor(firstFolderModel.name)).toContain(acsUser.firstName);
expect(await searchBarPage.getSpecificRowsAuthor(firstFolderModel.name)).toContain(acsUser.lastName);
expect(await searchBarPage.getSpecificRowsCompleteName(firstFolderModel.name)).toEqual(firstFolderModel.name);
await searchBarPage.clearText();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterText(firstFileModel.shortName);
await searchBarPage.resultTableContainsRow(firstFileModel.name);
expect(await searchBarPage.getSpecificRowsHighlightName(firstFileModel.name)).toEqual(firstFileModel.shortName);
expect(await searchBarPage.getSpecificRowsAuthor(firstFileModel.name)).toContain(acsUser.firstName);
expect(await searchBarPage.getSpecificRowsAuthor(firstFileModel.name)).toContain(acsUser.lastName);
expect(await searchBarPage.getSpecificRowsCompleteName(firstFileModel.name)).toEqual(firstFileModel.name);
});
it('[C272800] Should display file/folder in search suggestion when typing name', async () => {
await openSearchBar();
await searchBarPage.enterText(firstFolderModel.name);
await searchBarPage.resultTableContainsRow(firstFolderModel.name);
expect(await searchBarPage.getSpecificRowsHighlightName(firstFolderModel.name)).toEqual(firstFolderModel.name);
expect(await searchBarPage.getSpecificRowsAuthor(firstFolderModel.name)).toContain(acsUser.firstName);
expect(await searchBarPage.getSpecificRowsAuthor(firstFolderModel.name)).toContain(acsUser.lastName);
expect(await searchBarPage.getSpecificRowsCompleteName(firstFolderModel.name)).toEqual(firstFolderModel.name);
await searchBarPage.clearText();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterText(firstFileModel.name);
await searchBarPage.resultTableContainsRow(firstFileModel.name);
expect(await searchBarPage.getSpecificRowsHighlightName(firstFileModel.name)).toEqual(firstFileModel.name);
expect(await searchBarPage.getSpecificRowsAuthor(firstFileModel.name)).toContain(acsUser.firstName);
expect(await searchBarPage.getSpecificRowsAuthor(firstFileModel.name)).toContain(acsUser.lastName);
expect(await searchBarPage.getSpecificRowsCompleteName(firstFileModel.name)).toEqual(firstFileModel.name);
});
it('[C260257] Should display content when clicking on folder from search suggestions', async () => {
await openSearchBar();
await searchBarPage.enterText(firstFolderModel.shortName);
await searchBarPage.resultTableContainsRow(firstFolderModel.name);
await searchBarPage.clickOnSpecificRow(firstFolderModel.name);
await searchResultPage.dataTable.waitTillContentLoaded();
expect(await contentServicesPage.currentFolderName()).toEqual(firstFolderModel.name);
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
await searchBarPage.enterText(firstFileModel.name);
await searchBarPage.resultTableContainsRow(firstFileModel.name);
await searchBarPage.clickOnSpecificRow(firstFileModel.name);
expect(await viewerPage.getDisplayedFileName()).toEqual(firstFileModel.name);
await viewerPage.clickCloseButton();
});
it('[C272801] Should display message when searching for non-existent folder', async () => {
await openSearchBar();
await searchBarPage.enterTextAndPressEnter(search.inactive.name);
await searchResultPage.dataTable.waitTillContentLoaded();
await searchResultPage.checkNoResultMessageIsDisplayed();
});
it('[C272802] Should be able to find an existent folder in search results', async () => {
await openSearchBar();
await searchBarPage.enterTextAndPressEnter(firstFolderModel.name);
await searchResultPage.dataTable.waitTillContentLoaded();
await searchResultPage.checkContentIsDisplayed(firstFolderModel.name);
});
it('[C260258] Should be able to find an existent file in search results', async () => {
await openSearchBar();
await searchBarPage.enterTextAndPressEnter(firstFileModel.name);
await searchResultPage.dataTable.waitTillContentLoaded();
await searchResultPage.checkContentIsDisplayed(firstFileModel.name);
});
it(`[C290137] Should be able to search by '%'`, async () => {
await openSearchBar();
await searchBarPage.enterTextAndPressEnter('%');
await searchResultPage.dataTable.waitTillContentLoaded();
});
describe('Highlight', () => {
const searchConfiguration = SearchConfiguration.getConfiguration();
beforeAll(async () => {
await navigationBarPage.navigateToContentServices();
await LocalStorageUtil.setConfigField('search', JSON.stringify(searchConfiguration));
await openSearchBar();
await searchBarPage.enterTextAndPressEnter(term);
await searchResultPage.dataTable.waitTillContentLoaded();
});
it('[C299212] Should be able to configure the highlight option for search results', async () => {
const text = await searchResultPage.getNodeHighlight(fileHighlightUploaded.entry.name).getText();
expect(text.includes(`¿${term}?`)).toBe(true);
expect(text.includes(`(${term})`)).toBe(true);
});
});
/**
* Open the search bar
*/
async function openSearchBar(): Promise<void> {
if (await searchBarPage.searchBarExpanded.isDisplayed()) {
await searchBarPage.clearText();
await searchBarPage.checkSearchBarIsNotVisible();
}
await searchBarPage.clickOnSearchIcon();
await searchBarPage.checkSearchBarIsVisible();
}
});

View File

@ -1,304 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { SearchBarPage } from './pages/search-bar.page';
import { SearchFiltersPage } from './pages/search-filters.page';
import { SearchResultsPage } from './pages/search-results.page';
import { FileModel } from '../models/ACS/file.model';
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
import {
createApiService,
BrowserActions,
DocumentListPage,
LocalStorageUtil,
LoginPage,
PaginationPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { SearchConfiguration } from './search.config';
import { getYear } from 'date-fns';
import { NodeEntry } from '@alfresco/js-api';
describe('Search Filters', () => {
const loginPage = new LoginPage();
const searchBarPage = new SearchBarPage();
const searchFiltersPage = new SearchFiltersPage();
const paginationPage = new PaginationPage();
const contentList = new DocumentListPage();
const searchResults = new SearchResultsPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const acsUser = new UserModel();
const filename = StringUtil.generateRandomString(16);
const fileNamePrefix = StringUtil.generateRandomString(5);
const uniqueFileName1 = fileNamePrefix + StringUtil.generateRandomString(5);
const uniqueFileName2 = fileNamePrefix + StringUtil.generateRandomString(5);
const uniqueFileName3 = fileNamePrefix + StringUtil.generateRandomString(5);
const fileModel = new FileModel({
name: filename,
shortName: filename.substring(0, 8)
});
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const txtFileModel1 = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path,
name: `${uniqueFileName1}.txt`
});
const jpgFileModel = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.JPG.file_path,
name: `${uniqueFileName2}.jpg`
});
const txtFileModel2 = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path,
name: `${uniqueFileName3}.txt`
});
let fileUploaded: NodeEntry;
let fileTypePng: NodeEntry;
let fileTypeTxt1: NodeEntry;
let fileTypeJpg: NodeEntry;
let fileTypeTxt2: NodeEntry;
const filter = { type: 'TYPE-PNG Image' };
let jsonFile;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
fileUploaded = await uploadActions.uploadFile(fileModel.location, fileModel.name, '-my-');
fileTypePng = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, '-my-');
fileTypeTxt1 = await uploadActions.uploadFile(txtFileModel1.location, txtFileModel1.name, '-my-');
fileTypeJpg = await uploadActions.uploadFile(jpgFileModel.location, jpgFileModel.name, '-my-');
fileTypeTxt2 = await uploadActions.uploadFile(txtFileModel2.location, txtFileModel2.name, '-my-');
await loginPage.login(acsUser.username, acsUser.password);
await browser.sleep(browser.params.testConfig.timeouts.index_search); // wait search index previous file/folder uploaded
});
beforeEach(async () => {
jsonFile = SearchConfiguration.getConfiguration();
});
afterAll(async () => {
await apiService.login(acsUser.username, acsUser.password);
await uploadActions.deleteFileOrFolder(fileUploaded.entry.id);
await uploadActions.deleteFileOrFolder(fileTypePng.entry.id);
await uploadActions.deleteFileOrFolder(fileTypeTxt1.entry.id);
await uploadActions.deleteFileOrFolder(fileTypeTxt2.entry.id);
await uploadActions.deleteFileOrFolder(fileTypeJpg.entry.id);
await navigationBarPage.clickLogoutButton();
});
it('[C291980] Should group search facets under specified labels', async () => {
const currentYear = getYear(new Date());
jsonFile.facetQueries.queries[0] = {
query: `created:${currentYear}`,
label: 'SEARCH.FACET_QUERIES.CREATED_THIS_YEAR'
};
jsonFile.facetQueries.queries[1] = {
query: `content.mimetype:text/html`,
label: 'SEARCH.FACET_QUERIES.MIMETYPE',
group: 'Type facet queries'
};
jsonFile.facetQueries.queries[2] = {
query: `content.size:[0 TO 10240]`,
label: 'SEARCH.FACET_QUERIES.XTRASMALL',
group: 'Size facet queries'
};
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkDefaultFacetQueryGroupIsDisplayed();
await searchFiltersPage.checkTypeFacetQueryGroupIsDisplayed();
await searchFiltersPage.checkSizeFacetQueryGroupIsDisplayed();
});
it('[C286298] Should be able to cancel a filter using "x" button from the toolbar', async () => {
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter(fileUploaded.entry.name);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkSearchFiltersIsDisplayed();
const userOption = `${acsUser.firstName} ${acsUser.lastName}`;
const searchCheckListPage = await searchFiltersPage.creatorCheckListFiltersPage().enterFilterInputValue(userOption);
await searchCheckListPage.checkChipIsDisplayed(userOption);
await searchCheckListPage.removeFilterOption(userOption);
await searchCheckListPage.checkChipIsNotDisplayed(userOption);
});
it('[C277146] Should Show more/less buttons be hidden when inactive', async () => {
await BrowserActions.getUrl(`${browser.baseUrl}/search;q=*`);
const searchCheckListPage = searchFiltersPage.fileTypeCheckListFiltersPage();
await searchCheckListPage.checkShowLessButtonIsNotDisplayed();
await searchCheckListPage.checkShowMoreButtonIsDisplayed();
await searchCheckListPage.clickShowMoreButtonUntilIsNotDisplayed();
await searchCheckListPage.checkShowLessButtonIsDisplayed();
await searchCheckListPage.clickShowLessButtonUntilIsNotDisplayed();
});
it('[C286556] Search categories should preserve their collapsed/expanded state after the search', async () => {
await BrowserActions.getUrl(`${browser.baseUrl}/search;q=*`);
await searchFiltersPage.clickFileTypeListFilter();
await searchFiltersPage.checkFileTypeFilterIsCollapsed();
await searchFiltersPage.clickFileSizeFilterHeader();
await searchFiltersPage.checkFileSizeFilterIsCollapsed();
await searchFiltersPage.creatorCheckListFiltersPage().enterFilterInputValue('Administrator');
await searchFiltersPage.checkFileTypeFilterIsCollapsed();
await searchFiltersPage.checkFileSizeFilterIsCollapsed();
});
it('[C287796] Should be able to display the correct bucket number after selecting a filter', async () => {
await BrowserActions.getUrl(`${browser.baseUrl}/search;q=*`);
await searchFiltersPage.fileTypeCheckListFiltersPage().clickCheckListOption('PNG');
const bucketNumberForFilter = await searchFiltersPage.fileTypeCheckListFiltersPage().getBucketNumberOfFilterType(filter.type);
const resultFileNames: any = await contentList.getAllRowsColumnValues('Display name');
expect(bucketNumberForFilter).not.toEqual('0');
expect(await paginationPage.getTotalNumberOfFiles()).toEqual(bucketNumberForFilter);
resultFileNames.map(async (nameOfResultFiles) => {
expect(nameOfResultFiles.toLowerCase()).toContain('.png');
});
});
it('[C297509] Should display search intervals under specified labels from config', async () => {
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkFacetIntervalsByCreatedIsDisplayed();
await searchFiltersPage.checkFacetIntervalsByCreatedIsExpanded();
await searchFiltersPage.clickFacetIntervalsByCreatedFilterHeader();
await searchFiltersPage.checkFacetIntervalsByCreatedIsCollapsed();
await searchFiltersPage.clickFacetIntervalsByCreatedFilterHeader();
await searchFiltersPage.checkFacetIntervalsByCreatedIsExpanded();
await searchFiltersPage.checkFacetIntervalsByModifiedIsDisplayed();
await searchFiltersPage.checkFacetIntervalsByModifiedIsExpanded();
await searchFiltersPage.clickFacetIntervalsByModifiedFilterHeader();
await searchFiltersPage.checkFacetIntervalsByModifiedIsCollapsed();
await searchFiltersPage.clickFacetIntervalsByModifiedFilterHeader();
await searchFiltersPage.checkFacetIntervalsByModifiedIsExpanded();
});
it('[C299200] Should reset the filters facet with search query', async () => {
await navigationBarPage.navigateToContentServices();
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter(fileTypeTxt1.entry.name);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkSearchFiltersIsDisplayed();
await searchResults.checkContentIsDisplayed(fileTypeTxt1.entry.name);
await searchFiltersPage.checkFileTypeFacetLabelIsDisplayed('Plain Text (1)');
await searchFiltersPage.checkFileTypeFacetLabelIsNotDisplayed('JPEG Image');
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter(fileNamePrefix);
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkSearchFiltersIsDisplayed();
await searchResults.checkContentIsDisplayed(fileTypeTxt1.entry.name);
await searchResults.checkContentIsDisplayed(fileTypeTxt2.entry.name);
await searchResults.checkContentIsDisplayed(fileTypeJpg.entry.name);
await searchFiltersPage.checkFileTypeFacetLabelIsDisplayed('Plain Text (2)');
await searchFiltersPage.checkFileTypeFacetLabelIsDisplayed('JPEG Image (1)');
});
describe('Change config', () => {
it('[C291802] Should be able to filter facet fields with "Contains"', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile['filterWithContains'] = true;
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.creatorCheckListFiltersPage().searchInFilter('dminis');
await searchFiltersPage.creatorCheckListFiltersPage().checkCheckListAutocompleteOptionIsDisplayed('Administrator');
});
it('[C291981] Should group search facets under the default label, by default', async () => {
await navigationBarPage.navigateToContentServices();
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkDefaultFacetQueryGroupIsDisplayed();
expect(await searchFiltersPage.isTypeFacetQueryGroupPresent()).toBe(false);
expect(await searchFiltersPage.isSizeFacetQueryGroupPresent()).toBe(false);
});
it('[C299124] Should be able to parse escaped empty spaced labels inside facetFields', async () => {
await navigationBarPage.navigateToContentServices();
jsonFile.facetFields.fields[0].label = 'My File Types';
jsonFile.facetFields.fields[1].label = 'My File Sizes';
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkCustomFacetFieldLabelIsDisplayed('My File Types');
await searchFiltersPage.checkCustomFacetFieldLabelIsDisplayed('My File Sizes');
});
});
});

View File

@ -1,241 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { SearchBarPage } from './pages/search-bar.page';
import { SearchResultsPage } from './pages/search-results.page';
import { SearchFiltersPage } from './pages/search-filters.page';
import { FileModel } from '../models/ACS/file.model';
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
import CONSTANTS = require('../util/constants');
import { NodeEntry, SiteEntry, SitesApi } from '@alfresco/js-api';
describe('Search Component - Multi-Select Facet', () => {
const loginPage = new LoginPage();
const searchBarPage = new SearchBarPage();
const searchResultsPage = new SearchResultsPage();
const searchFiltersPage = new SearchFiltersPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const createSite = async (user: UserModel) => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(user);
await apiService.login(user.username, user.password);
const sitesApi = new SitesApi(apiService.getInstance());
site = await sitesApi.createSite({
title: StringUtil.generateRandomString(8),
visibility: 'PUBLIC'
});
};
const randomName = StringUtil.generateRandomString();
const txtFileInfo = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path,
name: `${randomName}.txt`
});
let site: SiteEntry;
let userOption: string;
describe('', () => {
let jpgFile: NodeEntry;
let jpgFileSite: NodeEntry;
let txtFile: NodeEntry;
let txtFileSite: NodeEntry;
const acsUser = new UserModel();
const jpgFileInfo = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.JPG.file_path,
name: `${randomName}.jpg`
});
beforeAll(async () => {
await createSite(acsUser);
jpgFile = await uploadActions.uploadFile(jpgFileInfo.location, jpgFileInfo.name, '-my-');
jpgFileSite = await uploadActions.uploadFile(jpgFileInfo.location, jpgFileInfo.name, site.entry.guid);
txtFile = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, '-my-');
txtFileSite = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, site.entry.guid);
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await loginPage.login(acsUser.username, acsUser.password);
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter(`${randomName}`);
await searchResultsPage.dataTable.waitTillContentLoaded();
userOption = `${acsUser.firstName} ${acsUser.lastName}`;
await searchFiltersPage.checkSearchFiltersIsDisplayed();
await searchFiltersPage.creatorCheckListFiltersPage().enterFilterInputValue(userOption);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
const sitesApi = new SitesApi(apiService.getInstance());
await Promise.all([
uploadActions.deleteFileOrFolder(jpgFile.entry.id),
uploadActions.deleteFileOrFolder(jpgFileSite.entry.id),
uploadActions.deleteFileOrFolder(txtFile.entry.id),
uploadActions.deleteFileOrFolder(txtFileSite.entry.id)
]);
await sitesApi.deleteSite(site.entry.id, { permanent: true });
await navigationBarPage.clickLogoutButton();
});
it('[C280054] Should be able to select multiple items from a search facet filter', async () => {
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter(`${randomName}`);
await searchResultsPage.dataTable.waitTillContentLoaded();
userOption = `${acsUser.firstName} ${acsUser.lastName}`;
await searchFiltersPage.checkSearchFiltersIsDisplayed();
await searchFiltersPage.creatorCheckListFiltersPage().enterFilterInputValue(userOption);
await searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('Plain Text');
await searchResultsPage.dataTable.waitTillContentLoaded();
expect(searchResultsPage.numberOfResultsDisplayed()).toBe(2);
await searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
await searchResultsPage.checkContentIsDisplayed(txtFileSite.entry.name);
await searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('JPEG Image');
await searchResultsPage.dataTable.waitTillContentLoaded();
expect(await searchResultsPage.numberOfResultsDisplayed()).toBe(4);
await searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
await searchResultsPage.checkContentIsDisplayed(txtFileSite.entry.name);
await searchResultsPage.checkContentIsDisplayed(jpgFile.entry.name);
await searchResultsPage.checkContentIsDisplayed(jpgFileSite.entry.name);
});
});
describe('', () => {
let jpgFile: NodeEntry;
let txtFile: NodeEntry;
const userUploadingTxt = new UserModel();
const userUploadingImg = new UserModel();
const jpgFileInfo = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.JPG.file_path,
name: `${randomName}.jpg`
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(userUploadingTxt);
await usersActions.createUser(userUploadingImg);
await apiService.login(userUploadingTxt.username, userUploadingTxt.password);
const sitesApi = new SitesApi(apiService.getInstance());
site = await sitesApi.createSite({
title: StringUtil.generateRandomString(8),
visibility: 'PUBLIC'
});
await sitesApi.createSiteMembership(site.entry.id, {
id: userUploadingImg.username,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
txtFile = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, site.entry.guid);
await apiService.login(userUploadingImg.username, userUploadingImg.password);
jpgFile = await uploadActions.uploadFile(jpgFileInfo.location, jpgFileInfo.name, site.entry.guid);
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await loginPage.login(userUploadingImg.username, userUploadingImg.password);
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter(`*${randomName}*`);
await searchResultsPage.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkSearchFiltersIsDisplayed();
await searchFiltersPage.creatorCheckListFiltersPage().enterFilterInputValue(`${userUploadingTxt.firstName} ${userUploadingTxt.lastName}`);
await searchFiltersPage.creatorCheckListFiltersPage().enterFilterInputValue(`${userUploadingImg.firstName} ${userUploadingImg.lastName}`);
await searchResultsPage.dataTable.waitTillContentLoaded();
await searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
await searchResultsPage.checkContentIsDisplayed(jpgFile.entry.name);
await searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('Plain Text');
await searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('JPEG Image');
await searchResultsPage.dataTable.waitTillContentLoaded();
expect(await searchResultsPage.numberOfResultsDisplayed()).toBe(2);
await searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
await searchResultsPage.checkContentIsDisplayed(jpgFile.entry.name);
});
});
describe('', () => {
let txtFile: NodeEntry;
const acsUser = new UserModel();
beforeAll(async () => {
await createSite(acsUser);
txtFile = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, '-my-');
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await loginPage.login(acsUser.username, acsUser.password);
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter(`*${randomName}*`);
await searchResultsPage.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkSearchFiltersIsDisplayed();
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(txtFile.entry.id);
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(site.entry.id, { permanent: true });
});
it('[C280058] Should update filter facets items number when another filter facet item is selected', async () => {
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter(`*${randomName}*`);
await searchResultsPage.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkSearchFiltersIsDisplayed();
await searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('Plain Text');
await searchFiltersPage.creatorCheckListFiltersPage().enterFilterInputValue(`${acsUser.firstName} ${acsUser.lastName}`);
await searchResultsPage.dataTable.waitTillContentLoaded();
expect(await searchResultsPage.numberOfResultsDisplayed()).toBe(1);
await searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
});
});
});

View File

@ -1,218 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export class SearchConfiguration {
static getConfiguration() {
return {
'app:fields': [
'cm:name',
'cm:title',
'cm:description',
'ia:whatEvent',
'ia:descriptionEvent',
'lnk:title',
'lnk:description',
'TEXT',
'TAG'
],
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: 'SEARCH.FACET_FIELDS.TYPE'},
{field: 'content.size', mincount: 1, label: 'SEARCH.FACET_FIELDS.SIZE'},
{field: 'creator', mincount: 1, label: 'SEARCH.FACET_FIELDS.CREATOR'},
{field: 'modifier', mincount: 1, label: 'SEARCH.FACET_FIELDS.MODIFIER'},
{field: 'created', mincount: 1, label: 'SEARCH.FACET_FIELDS.CREATED'}
]
},
facetQueries: {
label: 'My facet queries',
pageSize: 5,
queries: [
{query: 'created:2018', label: '1.Created This Year'},
{query: 'content.mimetype:text/html', label: '2.Type: HTML'},
{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',
displayedLabelsByField: {
'cm:created': 'Created Date'
}
}
}
},
{
id: 'queryType',
name: 'Type',
enabled: true,
component: {
selector: 'radio',
settings: {
field: null,
pageSize: 5,
options: [
{name: 'None', value: '', default: true},
{name: 'All', value: 'TYPE:\'cm:folder\' OR TYPE:\'cm:content\''},
{name: 'Folder', value: 'TYPE:\'cm:folder\''},
{name: 'Document', value: 'TYPE:\'cm:content\''}
]
}
}
},
{
id: 'createdModifiedDateRange',
name: 'Date',
enabled: true,
component: {
selector: 'date-range',
settings: {
dateFormat: 'dd-MMM-yy',
maxDate: 'today',
field: 'cm:created, cm:modified',
displayedLabelsByField: {
'cm:created': 'Created Date',
'cm:modified': 'Modified Date'
}
}
}
}
],
highlight: {
prefix: '¿',
postfix: '?',
mergeContiguous: true,
fields: [
{
field: 'cm:title'
},
{
field: 'description',
prefix: '(',
postfix: ')'
}
]
}
};
}
}

View File

@ -17,4 +17,3 @@
export * from './document-list.page';
export * from './breadcrumb/public-api';
export * from './search/public-api';

View File

@ -1,133 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ElementFinder, protractor } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class NumberRangeFilterPage {
fromInput = '[data-automation-id="number-range-from-input"]';
toInput = '[data-automation-id="number-range-to-input"]';
applyButton = '[data-automation-id="number-range-btn-apply"]';
clearButton = '[data-automation-id="number-range-btn-clear"]';
fromErrorInvalid = '[data-automation-id="number-range-from-error-invalid"]';
fromErrorRequired = '[data-automation-id="number-range-from-error-required"]';
toErrorInvalid = '[data-automation-id="number-range-to-error-invalid"]';
toErrorRequired = '[data-automation-id="number-range-to-error-required"]';
filter: ElementFinder;
constructor(filter: ElementFinder) {
this.filter = filter;
}
async clearFromField(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter.$(this.fromInput));
await BrowserActions.clearWithBackSpace(this.filter.$(this.fromInput));
}
async getFromNumber(): Promise<string> {
return BrowserActions.getInputValue(this.filter.$(this.fromInput));
}
async putFromNumber(value): Promise<void> {
await this.checkFromFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.$(this.fromInput), value);
await this.filter.$(this.fromInput).sendKeys(protractor.Key.ENTER);
}
async getFromErrorRequired(): Promise<string> {
return BrowserActions.getText(this.filter.$(this.fromErrorRequired));
}
async checkFromErrorRequiredIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorRequired));
}
async getFromErrorInvalid(): Promise<string> {
return BrowserActions.getText(this.filter.$(this.fromErrorInvalid));
}
async checkFromErrorInvalidIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorInvalid));
}
async checkFromFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromInput));
}
async clearToField(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter.$(this.toInput));
await BrowserActions.clearWithBackSpace(this.filter.$(this.toInput));
}
async getToNumber(): Promise<string> {
return BrowserActions.getInputValue(this.filter.$(this.toInput));
}
async putToNumber(value): Promise<void> {
await this.checkToFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.$(this.toInput), value);
await this.filter.$(this.toInput).sendKeys(protractor.Key.ENTER);
}
async getToErrorRequired(): Promise<string> {
return BrowserActions.getText(this.filter.$(this.toErrorRequired));
}
async checkToErrorRequiredIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorRequired));
}
async getToErrorInvalid(): Promise<string> {
return BrowserActions.getText(this.filter.$(this.toErrorInvalid));
}
async checkToErrorInvalidIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorInvalid));
}
async checkToFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toInput));
}
async clickApplyButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.applyButton));
}
async checkApplyButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.applyButton));
}
async checkApplyButtonIsEnabled(): Promise<boolean> {
return this.filter.$(this.applyButton).isEnabled();
}
async clickClearButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.clearButton));
}
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton));
}
async checkNoErrorMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorInvalid));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorRequired));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.toErrorInvalid));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.toErrorRequired));
}
}

View File

@ -1,24 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export * from './search-categories.page';
export * from './number-range-filter.page';
export * from './search-check-list.page';
export * from './search-radio.page';
export * from './search-slider.page';
export * from './search-sorting-picker.page';
export * from './search-text.page';

View File

@ -1,70 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ElementFinder } from 'protractor';
import { SearchTextPage } from './search-text.page';
import { SearchCheckListPage } from './search-check-list.page';
import { SearchRadioPage } from './search-radio.page';
import { NumberRangeFilterPage } from './number-range-filter.page';
import { SearchSliderPage } from './search-slider.page';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchCategoriesPage {
static checkListFiltersPage(filter: ElementFinder): SearchCheckListPage {
return new SearchCheckListPage(filter);
}
static textFiltersPage(filter: ElementFinder): SearchTextPage {
return new SearchTextPage(filter);
}
static radioFiltersPage(filter: ElementFinder): SearchRadioPage {
return new SearchRadioPage(filter);
}
static numberRangeFilter(filter: ElementFinder): NumberRangeFilterPage {
return new NumberRangeFilterPage(filter);
}
static sliderFilter(filter: ElementFinder): SearchSliderPage {
return new SearchSliderPage(filter);
}
async checkFilterIsDisplayed(filter: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(filter);
}
async clickFilter(filter: ElementFinder): Promise<void> {
await BrowserActions.click(filter.$(' .mat-expansion-panel-header'));
}
async clickFilterHeader(filter: ElementFinder): Promise<void> {
const fileSizeFilterHeader = filter.$(' .mat-expansion-panel-header');
await BrowserActions.click(fileSizeFilterHeader);
}
async checkFilterIsCollapsed(filter: ElementFinder) {
const elementClass = await BrowserActions.getAttribute(filter, 'class');
expect(elementClass).not.toContain('mat-expanded');
}
async checkFilterIsExpanded(filter: ElementFinder) {
const elementClass = await BrowserActions.getAttribute(filter, 'class');
expect(elementClass).toContain('mat-expanded');
}
}

View File

@ -1,175 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { element, by, ElementFinder, browser, protractor, By } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchCheckListPage {
filter: ElementFinder;
inputBy = 'div[class*="mat-expansion-panel-content"] input';
showMoreBy = 'button[title="Show more"]';
showLessBy = 'button[title="Show less"]';
clearAllButton = 'button';
constructor(filter: ElementFinder) {
this.filter = filter;
}
async clickCheckListOption(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(`mat-checkbox[data-automation-id*='${option}'] input`);
await BrowserActions.click(result);
}
async checkChipIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-row', option)).$('mat-icon'));
}
async checkChipIsNotDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip-row', option)).$('mat-icon'));
}
async removeFilterOption(option: string): Promise<void> {
const cancelChipButton = element(by.cssContainingText('mat-chip-row', option)).$('mat-icon');
await BrowserActions.click(cancelChipButton);
}
async filterBy(option: string): Promise<SearchCheckListPage> {
await this.checkSearchFilterInputIsDisplayed();
await this.searchInFilter(option);
await this.clickCheckListOption(option);
return this;
}
async enterFilterInputValue(option: string): Promise<SearchCheckListPage> {
await this.checkSearchFilterInputIsDisplayed();
await BrowserVisibility.waitUntilElementIsClickable(this.filter);
const inputElement = this.filter.$$(this.inputBy).first();
await BrowserVisibility.waitUntilElementIsClickable(inputElement);
await BrowserActions.clearSendKeys(inputElement, option);
await inputElement.sendKeys(protractor.Key.ENTER);
return this;
}
async checkSearchFilterInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$$(this.inputBy).first());
}
async searchInFilter(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter);
const inputElement = this.filter.$$(this.inputBy).first();
await BrowserVisibility.waitUntilElementIsClickable(inputElement);
await BrowserActions.clearSendKeys(inputElement, option);
}
async checkShowLessButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.showLessBy));
}
async checkShowLessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.showLessBy));
}
async checkShowMoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.showMoreBy));
}
async checkShowMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.showMoreBy));
}
async clickShowMoreButtonUntilIsNotDisplayed(): Promise<void> {
const visible = await browser.isElementPresent(this.filter.$(this.showMoreBy));
if (visible) {
await BrowserActions.click(this.filter.$(this.showMoreBy));
await this.clickShowMoreButtonUntilIsNotDisplayed();
}
}
async clickShowLessButtonUntilIsNotDisplayed(): Promise<void> {
const visible = await browser.isElementPresent(this.filter.$(this.showLessBy));
if (visible) {
await BrowserActions.click(this.filter.$(this.showLessBy));
await this.clickShowLessButtonUntilIsNotDisplayed();
}
}
async getBucketNumberOfFilterType(option: string): Promise<any> {
const fileTypeFilter = this.filter.$$('mat-checkbox[data-automation-id*=".' + option + '"] div').first();
await BrowserVisibility.waitUntilElementIsVisible(fileTypeFilter);
const valueOfBucket = await BrowserActions.getText(fileTypeFilter);
const numberOfBucket = valueOfBucket.split('(')[1];
const totalNumberOfBucket = numberOfBucket.split(')')[0];
return totalNumberOfBucket.trim();
}
async checkCheckListOptionIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}']`);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async checkCheckListAutocompleteOptionIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = element(By.css(`mat-option[data-automation-id='option-${option}']`));
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async checkCheckListOptionIsNotSelected(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`);
await BrowserVisibility.waitUntilElementIsNotVisible(result);
}
async checkCheckListOptionIsSelected(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async checkClearAllButtonIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(this.clearAllButton);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async clickClearAllButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(this.clearAllButton);
await BrowserActions.click(result);
}
async getCheckListOptionsNumberOnPage(): Promise<number> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const checkListOptions = this.filter.$$('.checklist mat-checkbox');
return checkListOptions.count();
}
async clickShowMoreButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.showMoreBy));
}
async clickShowLessButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.showLessBy));
}
}

View File

@ -1,75 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, ElementFinder, $, $$ } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchRadioPage {
filter: ElementFinder;
showMoreButton = $('adf-search-radio button[title="Show more"]');
showLessButton = $('adf-search-radio button[title="Show less"]');
constructor(filter: ElementFinder) {
this.filter = filter;
}
async checkFilterRadioButtonIsDisplayed(filterName: string): Promise<void> {
const filterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"]`);
await BrowserVisibility.waitUntilElementIsVisible(filterType);
}
async checkFilterRadioButtonIsChecked(filterName: string): Promise<void> {
const selectedFilterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"][class*="checked"]`);
await BrowserVisibility.waitUntilElementIsVisible(selectedFilterType);
}
async clickFilterRadioButton(filterName: string): Promise<void> {
await browser.executeScript(`document.querySelector('[data-automation-id="search-radio-${filterName}"] input').click();`);
}
async getRadioButtonsNumberOnPage(): Promise<number> {
const radioButtons = $$('mat-radio-button');
return radioButtons.count();
}
async checkShowMoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showMoreButton);
}
async checkShowLessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showLessButton);
}
async checkShowMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.showMoreButton);
}
async checkShowLessButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.showLessButton);
}
async clickShowMoreButton(): Promise<void> {
await BrowserActions.click(this.showMoreButton);
}
async clickShowLessButton(): Promise<void> {
await BrowserActions.click(this.showLessButton);
}
}

View File

@ -1,79 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class SearchSliderPage {
filter: ElementFinder;
slider = 'mat-slider[data-automation-id="slider-range"]';
clearButton = 'button[data-automation-id="slider-btn-clear"]';
sliderWithThumbLabel = 'mat-slider[data-automation-id="slider-range"][class*="mat-slider-thumb-label-showing"]';
constructor(filter: ElementFinder) {
this.filter = filter;
}
async getMaxValue() {
return BrowserActions.getAttribute(this.filter.$(this.slider).$('input'), 'max');
}
async getMinValue() {
return BrowserActions.getAttribute(this.filter.$(this.slider).$('input'), 'min');
}
async getValue() {
return BrowserActions.getAttribute(this.filter.$(this.slider).$('input'), 'aria-valuetext');
}
async setValue(value: number): Promise<void> {
const elem = this.filter.$(this.slider).$('.mdc-slider__thumb-knob');
await BrowserVisibility.waitUntilElementIsVisible(elem);
await browser.actions().mouseMove(elem, { x: 0, y: 0 }).perform();
await browser.actions().mouseDown().mouseMove({x: value * 7, y: 0}).mouseUp().perform();
}
async checkSliderIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.slider));
}
async checkSliderIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.slider));
}
async checkSliderWithThumbLabelIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.sliderWithThumbLabel));
}
async clickClearButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.clearButton));
}
async checkClearButtonIsEnabled() {
return this.filter.$(this.clearButton).isEnabled();
}
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton));
}
async checkClearButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.clearButton));
}
}

View File

@ -1,91 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, by, element } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { DropdownPage } from '../../../core/pages/material/dropdown.page';
export class SearchSortingPickerPage {
sortingDropdown = new DropdownPage($('.adf-sorting-picker .mat-mdc-select-arrow'));
orderArrow = $('adf-sorting-picker button mat-icon');
async sortBy(sortOrder: string, sortType: string | RegExp): Promise<void> {
await this.sortingDropdown.clickDropdown();
const selectedSortingOption = element(by.cssContainingText('.mdc-list-item__primary-text', sortType));
await BrowserActions.click(selectedSortingOption);
await this.sortByOrder(sortOrder);
}
/**
* Sort the list by name column.
*
* @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant
*/
async sortByOrder(sortOrder: string): Promise<any> {
await BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
const result = await BrowserActions.getText(this.orderArrow);
if (sortOrder.toLocaleLowerCase() === 'asc') {
if (result !== 'arrow_upward') {
await browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
} else {
if (result === 'arrow_upward') {
await browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
}
}
async clickSortingOption(option: string): Promise<void> {
const selectedSortingOption = element(by.cssContainingText('.mdc-list-item__primary-text', option));
await BrowserActions.click(selectedSortingOption);
}
async checkOptionIsDisplayed(option: string): Promise<void> {
await this.sortingDropdown.checkOptionIsDisplayed(option);
}
async checkOptionIsNotDisplayed(option: string): Promise<void> {
await this.sortingDropdown.checkOptionIsNotDisplayed(option);
}
async checkOptionsDropdownIsDisplayed(): Promise<void> {
await this.sortingDropdown.checkOptionsPanelIsDisplayed();
}
async checkSortingDropdownIsDisplayed(): Promise<void> {
await this.sortingDropdown.checkDropdownIsVisible();
}
async clickSortingDropdown(): Promise<void> {
await this.sortingDropdown.clickDropdown();
}
async checkOrderArrowIsDownward(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
const result = await BrowserActions.getText(this.orderArrow);
return result !== 'arrow_upward';
}
async checkOrderArrowIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
}
}

View File

@ -1,36 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { protractor, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class SearchTextPage {
filter: ElementFinder;
inputBy = 'input';
constructor(filter: ElementFinder) {
this.filter = filter;
}
async searchByName(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
await BrowserActions.clearSendKeys(this.filter.$(this.inputBy), name);
await this.filter.$(this.inputBy).sendKeys(protractor.Key.ENTER);
}
}

View File

@ -16,85 +16,9 @@
*/
import { browser, ElementFinder } from 'protractor';
import * as path from 'path';
import * as fs from 'fs';
import { BrowserActions } from '../utils/browser-actions';
const JS_BIND_INPUT = (target) => {
const input = document.createElement('input');
input.type = 'file';
input.style.display = 'none';
input.addEventListener('change', () => {
target.scrollIntoView(true);
const rect = target.getBoundingClientRect();
const x = rect.left + (rect.width >> 1);
const y = rect.top + (rect.height >> 1);
const data = { files: input.files };
['dragenter', 'dragover', 'drop'].forEach((name) => {
const mouseEvent: any = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
mouseEvent.dataTransfer = data;
target.dispatchEvent(mouseEvent);
});
document.body.removeChild(input);
}, false);
document.body.appendChild(input);
return input;
};
const JS_BIND_INPUT_FOLDER = (target) => {
const input: any = document.createElement('input');
input.type = 'file';
input.style.display = 'none';
input.multiple = true;
input.webkitdirectory = true;
input.addEventListener('change', () => {
target.scrollIntoView(true);
const rect = target.getBoundingClientRect();
const x = rect.left + (rect.width >> 1);
const y = rect.top + (rect.height >> 1);
const data = { files: input.files };
['dragenter', 'dragover', 'drop'].forEach((name) => {
const mouseEvent: any = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
mouseEvent.dataTransfer = data;
target.dispatchEvent(mouseEvent);
});
document.body.removeChild(input);
}, false);
document.body.appendChild(input);
return input;
};
export class DropActions {
static async dropFile(dropArea, filePath) {
const absolutePath = path.resolve(path.join(browser.params.testConfig.main.rootPath, filePath));
fs.accessSync(absolutePath, fs.constants.F_OK);
const elem = await dropArea.getWebElement();
const input: any = await browser.executeScript(JS_BIND_INPUT, elem);
return input.sendKeys(absolutePath);
}
static async dropFolder(dropArea, folderPath) {
const absolutePath = path.resolve(path.join(browser.params.testConfig.main.rootPath, folderPath));
fs.accessSync(absolutePath, fs.constants.F_OK);
const elem = await dropArea.getWebElement();
const input: any = await browser.executeScript(JS_BIND_INPUT_FOLDER, elem);
return input.sendKeys(absolutePath);
}
static async dragAndDrop(elementToDrag: ElementFinder, locationToDragTo: ElementFinder, locationOffset = { x: 230, y: 280 }) {
await BrowserActions.click(elementToDrag);
await browser.actions().mouseDown(elementToDrag).mouseMove(locationToDragTo, locationOffset).mouseUp().perform();