diff --git a/e2e/playwright/search/exclude.tests.json b/e2e/playwright/search/exclude.tests.json
index 28a318a83..b3736414d 100644
--- a/e2e/playwright/search/exclude.tests.json
+++ b/e2e/playwright/search/exclude.tests.json
@@ -1,4 +1,5 @@
{
"C290019": "https://alfresco.atlassian.net/browse/ACS-6928",
- "C290018": "https://alfresco.atlassian.net/browse/ACS-6928"
+ "C290018": "https://alfresco.atlassian.net/browse/ACS-6928",
+ "C699046-3": "https://hyland.atlassian.net/browse/ACS-7464"
}
\ No newline at end of file
diff --git a/e2e/playwright/search/src/tests/search-filters-properties.e2e.ts b/e2e/playwright/search/src/tests/search-filters-properties.e2e.ts
new file mode 100644
index 000000000..66236c88b
--- /dev/null
+++ b/e2e/playwright/search/src/tests/search-filters-properties.e2e.ts
@@ -0,0 +1,95 @@
+/*!
+ * Copyright © 2005-2024 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
+ * from Hyland Software. If not, see .
+ */
+
+import { expect } from '@playwright/test';
+import { ApiClientFactory, Utils, test, NodesApi, TrashcanApi, FileActionsApi, TEST_FILES } from '@alfresco/playwright-shared';
+
+test.describe('Search - Filters - Properties', () => {
+ let nodesApi: NodesApi;
+ let trashcanApi: TrashcanApi;
+
+ const randomId = Utils.random();
+ const username = `user-${randomId}`;
+ const fileNamePdfKb = `${randomId}-fileNameKb.pdf`;
+ const fileNameJpgMb = `${randomId}-fileNameMb.jpg`;
+
+ test.beforeEach(async ({ loginPage }) => {
+ await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
+ });
+
+ test.beforeAll(async () => {
+ try {
+ const apiClientFactory = new ApiClientFactory();
+ await apiClientFactory.setUpAcaBackend('admin');
+ await apiClientFactory.createUser({ username });
+ nodesApi = await NodesApi.initialize(username, username);
+ trashcanApi = await TrashcanApi.initialize(username, username);
+ const fileActionsApi = await FileActionsApi.initialize(username, username);
+ await fileActionsApi.uploadFileWithRename(TEST_FILES.PDF.path, fileNamePdfKb, '-my-');
+ await fileActionsApi.uploadFileWithRename(TEST_FILES.JPG_FILE_1MB.path, fileNameJpgMb, '-my-');
+ } catch (error) {
+ console.error(`beforeAll failed: ${error}`);
+ }
+ });
+
+ test.afterAll(async () => {
+ await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
+ });
+
+ test('[C699046-1] Filter by size - At least 1000KB', async ({ searchPage }) => {
+ await searchPage.searchWithin(randomId, 'files');
+ await searchPage.searchFiltersProperties.setPropertiesParameters(searchPage, undefined, undefined, '1000');
+
+ await expect(searchPage.searchFilters.propertiesFilter).toContainText('Properties: At Least 1000 KB');
+ await expect(searchPage.dataTable.getRowByName(fileNamePdfKb)).toBeHidden();
+ await expect(searchPage.dataTable.getRowByName(fileNameJpgMb)).toBeVisible();
+ });
+
+ test('[C699046-2] Filter by size - At most 1MB', async ({ searchPage }) => {
+ await searchPage.searchWithin(randomId, 'files');
+ await searchPage.searchFiltersProperties.setPropertiesParameters(searchPage, 'At Most', 'MB', '1');
+
+ await expect(searchPage.searchFilters.propertiesFilter).toContainText('Properties: At Most 1 MB');
+ await expect(searchPage.dataTable.getRowByName(fileNamePdfKb)).toBeVisible();
+ await expect(searchPage.dataTable.getRowByName(fileNameJpgMb)).toBeHidden();
+ });
+
+ test('[C699046-3] Filter by size - Exactly', async ({ searchPage }) => {
+ await searchPage.searchWithin(randomId, 'files');
+ await searchPage.searchFiltersProperties.setPropertiesParameters(searchPage, 'Exactly', undefined, '2.96');
+
+ await expect(searchPage.searchFilters.propertiesFilter).toContainText('Properties: Exactly 2.96 KB');
+ await expect(searchPage.dataTable.getRowByName(fileNamePdfKb)).toBeVisible();
+ await expect(searchPage.dataTable.getRowByName(fileNameJpgMb)).toBeHidden();
+ });
+
+ test('[C699047] Filter by type', async ({ searchPage }) => {
+ await searchPage.searchWithin(randomId, 'files');
+ await searchPage.searchFiltersProperties.setPropertiesParameters(searchPage, undefined, undefined, undefined, 'pdf');
+
+ await expect(searchPage.searchFilters.propertiesFilter).toContainText('Properties: pdf');
+ await expect(searchPage.dataTable.getRowByName(fileNamePdfKb)).toBeVisible();
+ await expect(searchPage.dataTable.getRowByName(fileNameJpgMb)).toBeHidden();
+ });
+});
diff --git a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters.component.ts b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters.component.ts
index b52df382c..411703e12 100644
--- a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters.component.ts
+++ b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters.component.ts
@@ -39,9 +39,9 @@ export class SearchFilters extends BaseComponent {
public locationFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Location' });
public tagsFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Tags' });
public categoriesFilter = this.page.locator('adf-search-widget-chip', { hasText: 'Categories' });
- public resetButton = this.getChild('button' , { hasText: 'Reset' });
- public menuCardTitle = this.getChild('.adf-search-filter-title');
- public menuCardClose = this.getChild('.adf-search-filter-title-action');
- public menuCardClear = this.getChild('#cancel-filter-button');
- public menuCardApply = this.getChild('#apply-filter-button');
+ public resetButton = this.page.locator('button' , { hasText: 'Reset' });
+ public menuCardTitle = this.page.locator('.adf-search-filter-title');
+ public menuCardClose = this.page.locator('.adf-search-filter-title-action');
+ public menuCardClear = this.page.locator('#cancel-filter-button');
+ public menuCardApply = this.page.locator('#apply-filter-button');
}
\ No newline at end of file
diff --git a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts
index 1a81ae67d..b31fb63b5 100644
--- a/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts
+++ b/projects/aca-playwright-shared/src/page-objects/components/search/search-filters/search-filters-properties.component.ts
@@ -24,6 +24,7 @@
import { BaseComponent } from '../../base.component';
import { Page } from '@playwright/test';
+import { SearchPage } from '@alfresco/playwright-shared';
export class SearchFiltersProperties extends BaseComponent {
private static rootElement = '.adf-search-filter-menu-card';
@@ -33,7 +34,66 @@ export class SearchFiltersProperties extends BaseComponent {
}
public operatorButton = this.getChild(`.adf-search-properties-file-size-operator`);
- public fileSizeInput = this.getChild(`[placeholder$='Results will match all words entered here']`);
+ public fileSizeInput = this.getChild(`[placeholder$='Enter file size']`);
public unitButton = this.getChild(`.adf-search-properties-file-size-unit`);
- public fileTypeInput = this.getChild(`[placeholder$='Results will exclude matches with these words']`);
+ public fileTypeInput = this.getChild(`[placeholder$='File Type']`);
+ public atLeastOption = this.page.locator(`.mat-option`, { hasText: 'At Least' });
+ public atMostOption = this.page.locator(`.mat-option`, { hasText: 'At Most' });
+ public exactlyOption = this.page.locator(`.mat-option`, { hasText: 'Exactly' });
+ public kbUnit = this.page.locator(`.mat-option`, { hasText: 'KB' });
+ public mbUnit = this.page.locator(`.mat-option`, { hasText: 'MB' });
+ public gbUnit = this.page.locator(`.mat-option`, { hasText: 'GB' });
+ public dropdownOptions = this.page.locator(`.mat-option`);
+
+ async setPropertiesParameters(
+ page: SearchPage,
+ operator?: 'At Least' | 'At Most' | 'Exactly',
+ unit?: 'KB' | 'MB' | 'GB',
+ fileSizeInputText?: string,
+ fileTypeInputText?: string
+ ): Promise {
+ await page.searchFilters.propertiesFilter.click();
+
+ if (operator) {
+ await this.operatorButton?.click();
+ switch (operator) {
+ case 'At Least':
+ await this.atLeastOption?.click();
+ break;
+ case 'At Most':
+ await this.atMostOption?.click();
+ break;
+ case 'Exactly':
+ await this.exactlyOption?.click();
+ break;
+ }
+ }
+
+ if (unit) {
+ await this.unitButton?.click();
+ switch (unit) {
+ case 'KB':
+ await this.kbUnit?.click();
+ break;
+ case 'MB':
+ await this.mbUnit?.click();
+ break;
+ case 'GB':
+ await this.gbUnit?.click();
+ break;
+ }
+ }
+
+ if (fileSizeInputText) {
+ await this.fileSizeInput?.fill(fileSizeInputText);
+ }
+
+ if (fileTypeInputText) {
+ await this.fileTypeInput?.fill(fileTypeInputText);
+ await this.dropdownOptions.first().click();
+ }
+
+ await page.searchFilters.menuCardApply.click();
+ await page.dataTable.progressBarWaitForReload();
+ }
}
diff --git a/projects/aca-playwright-shared/src/resources/test-files/file-jpg-1mb.jpg b/projects/aca-playwright-shared/src/resources/test-files/file-jpg-1mb.jpg
new file mode 100644
index 000000000..1aa016ba1
Binary files /dev/null and b/projects/aca-playwright-shared/src/resources/test-files/file-jpg-1mb.jpg differ
diff --git a/projects/aca-playwright-shared/src/resources/test-files/index.ts b/projects/aca-playwright-shared/src/resources/test-files/index.ts
index 6cceabb24..bddf38db1 100644
--- a/projects/aca-playwright-shared/src/resources/test-files/index.ts
+++ b/projects/aca-playwright-shared/src/resources/test-files/index.ts
@@ -65,6 +65,10 @@ export const TEST_FILES = {
path: resolve(__dirname, 'file-jpg.jpg'),
name: 'file-jpg'
},
+ JPG_FILE_1MB: {
+ path: resolve(__dirname, 'file-jpg-1mb.jpg'),
+ name: 'file-jpg-1mb'
+ },
PDF_PROTECTED2: {
path: resolve(__dirname, 'protected.pdf'),
name: 'file-protected',