Skip to content

Commit

Permalink
[ACS-5183] properties facet file size and file type (#3347)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
AleksanderSklorz authored Jul 20, 2023
1 parent 9a585c1 commit d3be553
Show file tree
Hide file tree
Showing 24 changed files with 183 additions and 329 deletions.
10 changes: 2 additions & 8 deletions e2e/protractor/protractor.excludes.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@
"C286252": "temp, see https://alfresco.atlassian.net/browse/ACS-5189",
"C284666": "temp, see https://alfresco.atlassian.net/browse/ACS-5189",
"C286269": "temp, see https://alfresco.atlassian.net/browse/ACS-5189",
"C279191": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5183",
"C279192": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5183",
"C279193": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5183",
"C279195": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5183",
"C280051": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5183",
"C280052": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5183",
"C279188": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5183",
"C308042": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5183",
"C280051": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5632",
"C308042": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-5632",
"C279186": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-4985",
"C279219": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-4985",
"C279221": "temp, will be fixed in https://alfresco.atlassian.net/browse/ACS-4985",
Expand Down
121 changes: 41 additions & 80 deletions e2e/protractor/suites/search/search-filters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
FILES,
SITE_VISIBILITY,
SITE_ROLES,
SizeOptions
SizeOperator
} from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';

Expand Down Expand Up @@ -62,7 +62,7 @@ describe('Search filters', () => {
source: FILES.pdfFile
};

const expectedFileTypes = ['Adobe PDF Document (1)', 'JPEG Image (1)'];
const expectedFileTypes = ['pdf', 'wpd'];
const expectedCreators = [`${user1} ${user1} (1)`, `${user2} ${user2} (1)`];
const expectedModifiers = [`${user1} ${user1} (1)`, `${user2} ${user2} (1)`];
const expectedLocations = ['_REPOSITORY_ (1)', `${site} (1)`];
Expand All @@ -77,7 +77,6 @@ describe('Search filters', () => {
const { searchInput } = page.pageLayoutHeader;
const { dataTable, filters, toolbar } = page;

const sizeFilter = filters.size;
const fileTypeFilter = filters.fileType;
const createdDateFilter = filters.createdDate;
const creatorFilter = filters.creator;
Expand Down Expand Up @@ -118,7 +117,6 @@ describe('Search filters', () => {
});

it('[C279186] Filters are displayed', async () => {
expect(await sizeFilter.isDisplayed()).toBe(true, 'Size filter panel not displayed');
expect(await createdDateFilter.isDisplayed()).toBe(true, 'Created date filter panel not displayed');
expect(await fileTypeFilter.isDisplayed()).toBe(true, 'File type filter panel not displayed');
expect(await creatorFilter.isDisplayed()).toBe(true, 'Creator filter panel not displayed');
Expand All @@ -129,64 +127,42 @@ describe('Search filters', () => {

describe('Filter by Size', () => {
afterEach(async () => {
await sizeFilter.resetPanel();
});

it('[C279197] Expand / Collapse the Size filter panel', async () => {
expect(await sizeFilter.isDialogPresent()).toBe(false, 'Size filter panel is expanded');

await sizeFilter.openDialog();

expect(await sizeFilter.isDialogPresent()).toBe(true, 'Size filter panel not expanded');

const expectedSizes = ['Small', 'Medium', 'Large', 'Huge'];
expect(await sizeFilter.getFiltersValues()).toEqual(expectedSizes, 'Incorrect Size filters facets');

await sizeFilter.closeDialog();

expect(await sizeFilter.isDialogPresent()).toBe(false, 'Size filter panel is expanded');
await fileTypeFilter.openDialog();
await fileTypeFilter.clickResetButton();
});

it('[C279199] Filter by Small', async () => {
await sizeFilter.openDialog();
await sizeFilter.getSizeCheckboxOption(SizeOptions.Small).click();
await sizeFilter.clickApplyButton();
it('[C279199] Filter existing', async () => {
await fileTypeFilter.openDialog();
await fileTypeFilter.typeFileSize('1024');
await fileTypeFilter.selectFileSizeOperator(SizeOperator.AT_MOST);
await fileTypeFilter.clickApplyButton();

expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, `${fileJpgUser1.name} not in the list`);
expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, `${filePdfUser2.name} not in the list`);
});

it('[C279202] Filter by Huge', async () => {
await sizeFilter.openDialog();
await sizeFilter.getSizeCheckboxOption(SizeOptions.Huge).click();
await sizeFilter.clickApplyButton();
it('[C279199] Filter non existing', async () => {
await fileTypeFilter.openDialog();
await fileTypeFilter.typeFileSize('512000');
await fileTypeFilter.clickApplyButton();

expect(await dataTable.isEmpty()).toBe(true, 'list is not empty');
});

it('[C279203] Filter by multiple size categories', async () => {
await sizeFilter.openDialog();
await sizeFilter.getSizeCheckboxOption(SizeOptions.Small).click();
await sizeFilter.getSizeCheckboxOption(SizeOptions.Medium).click();
await sizeFilter.getSizeCheckboxOption(SizeOptions.Large).click();
await sizeFilter.clickApplyButton();

expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, `${fileJpgUser1.name} not in the list`);
expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, `${filePdfUser2.name} not in the list`);
});

it('[C279198] Clear the Size filter options', async () => {
await sizeFilter.openDialog();
await sizeFilter.getSizeCheckboxOption(SizeOptions.Small).click();
await sizeFilter.getSizeCheckboxOption(SizeOptions.Medium).click();
await sizeFilter.clickApplyButton();

await sizeFilter.openDialog();
expect(await sizeFilter.getFiltersCheckedValues()).toEqual(['Small', 'Medium'], 'Incorrect checked Size filters');
await fileTypeFilter.openDialog();
await fileTypeFilter.typeFileSize('1024');
await fileTypeFilter.selectFileSizeOperator(SizeOperator.AT_MOST);
await fileTypeFilter.clickApplyButton();

await sizeFilter.clickResetButton();
await sizeFilter.openDialog();
expect(await sizeFilter.getFiltersCheckedValues()).toEqual([], 'Size filters not cleared');
await fileTypeFilter.openDialog();
expect(await fileTypeFilter.getFileSizeValue()).toEqual('1024', 'Incorrect file size');
expect(await fileTypeFilter.getFileSizeOperatorValue()).toEqual(SizeOperator.AT_MOST, 'Incorrect file size operator');
await fileTypeFilter.clickResetButton();
await fileTypeFilter.closeDialog();
await fileTypeFilter.openDialog();
expect(await fileTypeFilter.getFileSizeValue()).toEqual('', 'Incorrect file size');
expect(await fileTypeFilter.getFileSizeOperatorValue()).toEqual(SizeOperator.AT_LEAST, 'Incorrect file size operator');
});
});

Expand Down Expand Up @@ -300,54 +276,49 @@ describe('Search filters', () => {
it('[C279191] Expand / Collapse the File type filter panel', async () => {
await fileTypeFilter.openDialog();
expect(await fileTypeFilter.isDialogPresent()).toBe(true, 'File type filter panel not expanded');
expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes, 'Incorrect File type filters facets');
expect(await fileTypeFilter.isFilterCategoryInputDisplayed()).toBe(true, 'File type filter categories not displayed');
expect(await fileTypeFilter.getFileTypesValues('pd')).toEqual(expectedFileTypes, 'Incorrect File type filters facets');

await fileTypeFilter.closeDialog();
expect(await fileTypeFilter.isDialogPresent()).toBe(false, 'File type filter panel is expanded');
});

it('[C279192] Results are filtered by File type', async () => {
await fileTypeFilter.openDialog();
await fileTypeFilter.checkCategory('Adobe PDF Document');
await fileTypeFilter.selectFileType('pdf');
await fileTypeFilter.clickApplyButton();
expect(await fileTypeFilter.getChipTitle()).toEqual('Adobe PDF Document');
expect(await fileTypeFilter.getChipTitle()).toEqual('pdf');

expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(false, 'JPG file is displayed');

await fileTypeFilter.openDialog();
await fileTypeFilter.checkCategory('JPEG Image');
await fileTypeFilter.selectFileType('jpg');
await fileTypeFilter.clickApplyButton();

expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
expect(await fileTypeFilter.getChipTitle()).toEqual(['Adobe PDF Document', 'JPEG Image'].join(', '));
expect(await fileTypeFilter.getChipTitle()).toEqual(['pdf', 'jpg'].join(', '));
});

it('[C279193] Clear the File type filter options', async () => {
await fileTypeFilter.openDialog();
await fileTypeFilter.checkCategory('Adobe PDF Document');
await fileTypeFilter.selectFileType('pdf');
await fileTypeFilter.clickApplyButton();

expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(false, 'JPG file is displayed');

await fileTypeFilter.openDialog();
expect(await fileTypeFilter.getFiltersCheckedValues()).toEqual(['Adobe PDF Document (1)']);
expect(await fileTypeFilter.getSelectedFileTypeOptions()).toEqual(['pdf']);
await fileTypeFilter.clickResetButton();
await fileTypeFilter.closeDialog();
await fileTypeFilter.openDialog();
await fileTypeFilter.clickApplyButton();

expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed');
expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
expect(await fileTypeFilter.getChipTitle()).toEqual('');
});

it('[C279195] Search for a specific file type', async () => {
await fileTypeFilter.openDialog();
expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes, 'Incorrect File type filters facets');
await fileTypeFilter.filterCategoriesBy('PDF');
expect(await fileTypeFilter.getFiltersValues()).toEqual(['Adobe PDF Document (1)'], 'Incorrect File type filters facets');
});
});

describe('Filter by Creator', () => {
Expand Down Expand Up @@ -607,12 +578,10 @@ describe('Search filters', () => {
});

it('[C280051] Multiple filters can be applied', async () => {
await sizeFilter.openDialog();
await sizeFilter.getSizeCheckboxOption(SizeOptions.Small).click();
await sizeFilter.clickApplyButton();

await fileTypeFilter.openDialog();
await fileTypeFilter.checkCategory('JPEG Image');
await fileTypeFilter.typeFileSize('1024');
await fileTypeFilter.selectFileSizeOperator(SizeOperator.AT_MOST);
await fileTypeFilter.selectFileType('jpg');
await fileTypeFilter.clickApplyButton();

await creatorFilter.openDialog();
Expand All @@ -625,7 +594,7 @@ describe('Search filters', () => {

expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed');
expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed');
expect(await fileTypeFilter.getChipTitle()).toEqual('JPEG Image');
expect(await fileTypeFilter.getChipTitle()).toEqual(`${SizeOperator.AT_MOST} 1024 KB, jpg`);
expect(await creatorFilter.getChipTitle()).toEqual(`${user1} ${user1}`);
expect(await locationFilter.getChipTitle()).toEqual(site);

Expand All @@ -637,7 +606,7 @@ describe('Search filters', () => {

it('[C280052] Total results is updated correctly', async () => {
await fileTypeFilter.openDialog();
await fileTypeFilter.checkCategory('JPEG Image');
await fileTypeFilter.selectFileType('jpg');
await fileTypeFilter.clickApplyButton();

await creatorFilter.openDialog();
Expand All @@ -653,7 +622,7 @@ describe('Search filters', () => {

it('[C279188] Pagination is correct when search results are filtered', async () => {
await fileTypeFilter.openDialog();
await fileTypeFilter.checkCategory('JPEG Image');
await fileTypeFilter.selectFileType('jpg');
await fileTypeFilter.clickApplyButton();

await creatorFilter.openDialog();
Expand All @@ -668,10 +637,6 @@ describe('Search filters', () => {
});

it('[C308042] The filter facets display is updated when making a new query', async () => {
await fileTypeFilter.openDialog();
expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes);
await fileTypeFilter.closeDialog();

await creatorFilter.openDialog();
expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators);
await creatorFilter.closeDialog();
Expand All @@ -688,10 +653,6 @@ describe('Search filters', () => {
await searchInput.searchFor(fileJpgUser1.name);
await dataTable.waitForBody();

await fileTypeFilter.openDialog();
expect(await fileTypeFilter.getFiltersValues()).toEqual(['JPEG Image (1)']);
await fileTypeFilter.closeDialog();

await creatorFilter.openDialog();
expect(await creatorFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`]);
await creatorFilter.closeDialog();
Expand Down
50 changes: 16 additions & 34 deletions projects/aca-content/assets/app.extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1428,31 +1428,25 @@
}
},
{
"id": "size",
"name": "SEARCH.CATEGORIES.SIZE",
"id": "properties",
"name": "SEARCH.CATEGORIES.PROPERTIES",
"enabled": true,
"component": {
"selector": "check-list",
"selector": "properties",
"settings": {
"allowUpdateOnChange": false,
"hideDefaultAction": true,
"options": [
{
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.SMALL",
"value": "content.size:[0 TO 1048576>"
},
{
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.MEDIUM",
"value": "content.size:[1048576 TO 52428800]"
},
{
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.LARGE",
"value": "content.size:<52428800 TO 524288000]"
},
{
"name": "SEARCH.CATEGORIES.SIZE_OPTIONS.HUGE",
"value": "content.size:<524288000 TO MAX]"
}
"field": "content.size,cm:name",
"fileExtensions": [
"3g2", "3gp", "acp", "aep", "ai", "aiff", "apk", "arw", "avi", "bin", "bmp", "cgm", "class", "cr2",
"css", "csv", "dita", "dng", "doc", "docm", "docx", "dotm","dwg", "dwt", "eps", "flac", "flv", "fm",
"fodg", "gif", "gtar", "gz", "htm", "html", "icns", "ics", "ief", "indd", "jar", "java", "jp2", "jpeg",
"jpg", "js", "json", "jsp", "m4v", "man", "md", "mov", "mp3", "mp4", "mpeg", "mpp", "mrw", "msg", "nef",
"numbers", "odb", "odf", "odg", "odi", "odm", "odp", "ods", "odt", "oga", "ogg", "ogv", "ogx", "orf",
"ott", "pages", "pbm", "pdf", "pef", "pgm", "pmd", "png", "pnm", "pot", "potx", "ppam", "ppj", "pps",
"ppsm", "ppt", "pptm", "pptx", "ps", "psd", "rad", "raf", "rar", "rgb", "rss", "rtf", "rw2", "rwl",
"sda", "sdc", "sdd", "sdp", "sds", "sdw", "sgi", "sgl", "sgml", "sh", "sldm", "smf", "stw", "svg",
"swf", "sxi", "tar", "tex", "texi", "tif", "tiff", "ts", "tsv", "txt", "vsd", "vsdm", "vsdx", "vssm",
"vstm", "vstx", "wav", "webm", "wma", "wmv", "wpd", "wrl", "x3f", "xdp", "xhtml", "xla", "xlam", "xls",
"xlsb", "xlsm", "xlsx", "xltm", "xml", "xpm", "xwd", "z", "zip"
]
}
}
Expand Down Expand Up @@ -1487,18 +1481,6 @@
}
}
},
{
"id": "fileType",
"name": "SEARCH.FACET_FIELDS.FILE_TYPE",
"component": {
"selector": "",
"settings": {
"allowUpdateOnChange": false,
"hideDefaultAction": true,
"field": "content.mimetype"
}
}
},
{
"id": "location",
"name": "SEARCH.FACET_FIELDS.LOCATION",
Expand Down
9 changes: 1 addition & 8 deletions projects/aca-content/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,21 +526,13 @@
"CREATE_DATE": "تاريخ الإنشاء"
},
"FACET_FIELDS": {
"FILE_TYPE": "نوع الملف",
"CREATOR": "المنشئ",
"MODIFIER": "المعدل",
"LOCATION": "مكان",
"CATEGORIES": "فئات"
},
"CATEGORIES": {
"MODIFIED_DATE": "تاريخ التعديل",
"SIZE": "الحجم",
"SIZE_OPTIONS": {
"SMALL": "صغير",
"MEDIUM": "متوسط",
"LARGE": "كبير",
"HUGE": "ضخم"
},
"CREATED_DATE": "تاريخ الإنشاء",
"EFFECTIVITY_FROM": "فعالية من",
"EFFECTIVITY_TO": "فعالية ل",
Expand Down Expand Up @@ -614,3 +606,4 @@
}
}
}

9 changes: 1 addition & 8 deletions projects/aca-content/assets/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,21 +526,13 @@
"CREATE_DATE": "Datum vytvoření"
},
"FACET_FIELDS": {
"FILE_TYPE": "Typ souboru",
"CREATOR": "Autor",
"MODIFIER": "Upravující",
"LOCATION": "Umístění",
"CATEGORIES": "Kategorie"
},
"CATEGORIES": {
"MODIFIED_DATE": "Datum úpravy",
"SIZE": "Velikost",
"SIZE_OPTIONS": {
"SMALL": "Malá",
"MEDIUM": "Střední",
"LARGE": "Velká",
"HUGE": "Obrovská"
},
"CREATED_DATE": "Datum vytvoření",
"EFFECTIVITY_FROM": "Platnost od",
"EFFECTIVITY_TO": "Platnost do",
Expand Down Expand Up @@ -614,3 +606,4 @@
}
}
}

Loading

0 comments on commit d3be553

Please sign in to comment.