[ACS-5183] properties facet file size and file type (#3347)

* ACS-5183 Started updating configuration for file type and size

* ACS-5183 Corrected file extensions

* ACS-5183 Added more file extensions

* ACS-5183 Corrected configuration

* ACS-5183 Fix e2e

* ACS-5183 Added translation key

* ACS-5183 Changed jira for excluded e2es

* ACS-5183 Corrected import

* ACS-5183 Added license header
This commit is contained in:
AleksanderSklorz
2023-07-20 08:38:34 +02:00
committed by GitHub
parent 9a585c1642
commit d3be553fd6
24 changed files with 183 additions and 329 deletions

View File

@@ -0,0 +1,103 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { GenericFilter } from './generic-filter';
import { by, element, ElementArrayFinder, ElementFinder } from 'protractor';
export enum SizeOperator {
AT_LEAST = 'At Least',
AT_MOST = 'At Most',
EXACTLY = 'Exactly'
}
export class PropertiesFilter extends GenericFilter {
private readonly locators = {
fileSizeOperatorSelect: '[data-automation-id=adf-search-properties-file-size-operator-select]',
fileSizeOperatorOption: '.mat-option-text',
selectedFileSizeOperatorOption: '.mat-select-min-line',
fileSizeInput: '[data-automation-id=adf-search-properties-file-size-input]',
fileTypeInput: '[data-automation-id=adf-search-chip-autocomplete-input]',
fileTypeOption: '.mat-option-text',
selectedFileTypeOption: 'adf-search-chip-autocomplete-input .mat-chip span'
};
constructor() {
super('Properties');
}
get fileTypeInput(): ElementFinder {
return this.filterDialogOpened.element(by.css(this.locators.fileTypeInput));
}
get fileTypeOptions(): ElementArrayFinder {
return element.all(by.css(this.locators.fileTypeOption));
}
get fileSizeInput(): ElementFinder {
return this.filterDialogOpened.element(by.css(this.locators.fileSizeInput));
}
get fileSizeOperatorSelect(): ElementFinder {
return this.filterDialogOpened.element(by.css(this.locators.fileSizeOperatorSelect));
}
get fileTypeOperatorOptions(): ElementArrayFinder {
return element.all(by.css(this.locators.fileSizeOperatorOption));
}
get selectedFileTypeOperatorOption(): ElementFinder {
return this.filterDialogOpened.element(by.css(this.locators.selectedFileSizeOperatorOption));
}
async getFileTypesValues(filterValue: string): Promise<string[]> {
await this.fileTypeInput.sendKeys(filterValue);
return this.fileTypeOptions.map((option) => option.getText());
}
async selectFileType(option: string): Promise<void> {
await this.fileTypeInput.sendKeys(option);
return this.fileTypeOptions.filter(async (element) => (await element.getText()) === option).click();
}
async getSelectedFileTypeOptions(): Promise<string[]> {
return this.filterDialogOpened.all(by.css(this.locators.selectedFileTypeOption)).map((option) => option.getText());
}
async typeFileSize(fileSize: string): Promise<void> {
await this.fileSizeInput.sendKeys(fileSize);
}
async selectFileSizeOperator(option: string): Promise<void> {
await this.fileSizeOperatorSelect.click();
await this.fileTypeOperatorOptions.filter(async (element) => (await element.getText() === option)).click();
}
async getFileSizeOperatorValue(): Promise<string> {
return this.selectedFileTypeOperatorOption.getText();
}
async getFileSizeValue(): Promise<string> {
return this.fileSizeInput.getAttribute('value');
}
}

View File

@@ -1,66 +0,0 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { by, ElementArrayFinder } from 'protractor';
import { GenericFilter } from './generic-filter';
import { BrowserActions, TestElement } from '@alfresco/adf-testing';
export enum SizeOptions {
Small = 'SMALL',
Medium = 'MEDIUM',
Large = 'LARGE',
Huge = 'HUGE'
}
export class SizeFilter extends GenericFilter {
constructor() {
super('Size');
}
facets: ElementArrayFinder = this.filterDialogOpened.all(by.css('.mat-checkbox'));
selectedFacets: ElementArrayFinder = this.filterDialogOpened.all(by.css('.mat-checkbox.mat-checkbox-checked'));
public getSizeCheckboxOption = (sizeOption: SizeOptions) =>
TestElement.byCss(`[data-automation-id="checkbox-SEARCH.CATEGORIES.SIZE_OPTIONS.${sizeOption}"] [type="checkbox"]`);
async getFiltersValues(): Promise<string[]> {
return this.facets.map((option) => {
return option.getText();
});
}
async getFiltersCheckedValues(): Promise<string[]> {
return this.selectedFacets.map((option) => {
return option.getText();
});
}
async resetPanel(): Promise<void> {
if ((await this.selectedFacets.count()) > 0) {
await this.openDialog();
await this.selectedFacets.each(async (elem) => {
await BrowserActions.click(elem);
});
}
await this.closeDialog();
}
}

View File

@@ -26,7 +26,7 @@ export * from './filters/autocomplete-chips-filter';
export * from './filters/created-date-filter';
export * from './filters/facet-filter';
export * from './filters/generic-filter';
export * from './filters/size-filter';
export * from './filters/properties-filter';
export * from './search-filters';
export * from './search-input';
export * from './search-sorting-picker';

View File

@@ -24,17 +24,16 @@
import { by, browser } from 'protractor';
import { Component } from '../component';
import { SizeFilter } from './filters/size-filter';
import { CreatedDateFilter } from './filters/created-date-filter';
import { FacetFilter } from './filters/facet-filter';
import { AutocompleteChipsFilter } from './filters/autocomplete-chips-filter';
import { PropertiesFilter } from './filters/properties-filter';
export class SearchFilters extends Component {
resetAllButton = browser.element(by.css('button[adf-reset-search]'));
size = new SizeFilter();
createdDate = new CreatedDateFilter();
fileType = new FacetFilter('File type');
fileType = new PropertiesFilter();
creator = new FacetFilter('Creator');
modifier = new FacetFilter('Modifier');
location = new AutocompleteChipsFilter('Location');