diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts
index 19f244641..69395b507 100755
--- a/e2e/components/data-table/data-table.ts
+++ b/e2e/components/data-table/data-table.ts
@@ -409,6 +409,14 @@ export class DataTable extends Component {
}, {});
}
+ getSearchResultsRows(): ElementArrayFinder {
+ return this.body.all(by.css(DataTable.selectors.searchResultsRow));
+ }
+
+ getNthSearchResultsRow(nth: number): ElementFinder {
+ return this.getSearchResultsRows().get(nth - 1);
+ }
+
getSearchResultsRowByName(name: string, location: string = '') {
if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name))
diff --git a/e2e/suites/list-views/empty-list.test.ts b/e2e/suites/list-views/empty-list.test.ts
index 93ecafd09..7c06ebdb0 100755
--- a/e2e/suites/list-views/empty-list.test.ts
+++ b/e2e/suites/list-views/empty-list.test.ts
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see .
*/
-import { LoginPage, BrowsingPage } from '../../pages/pages';
+import { LoginPage, BrowsingPage, SearchResultsPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
@@ -38,6 +38,7 @@ describe('Empty list views', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
+ const searchResultsPage = new SearchResultsPage();
const { dataTable, pagination } = page;
const { searchInput } = page.header;
@@ -168,7 +169,6 @@ describe('Empty list views', () => {
it('Search results - pagination controls not displayed - [C290123]', async () => {
await searchInput.clickSearchButton();
- await searchInput.checkOnlyFiles();
/* cspell:disable-next-line */
await searchInput.searchFor('qwertyuiop');
await dataTable.waitForBody();
@@ -181,6 +181,15 @@ describe('Empty list views', () => {
expect(await pagination.isNextButtonPresent()).toBe(false, 'Next button is present');
});
+ it('Search filters panel is not displayed on empty Search Results page - [C279189]', async () => {
+ await searchInput.clickSearchButton();
+ /* cspell:disable-next-line */
+ await searchInput.searchFor('qwertyuiop');
+ await dataTable.waitForBody();
+
+ expect(await searchResultsPage.filters.isSearchFiltersPanelDisplayed()).toBe(false, 'Search filters panel is present');
+ });
+
it('Empty Search results - Libraries - [C290020]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
diff --git a/e2e/suites/search/search-filters.test.ts b/e2e/suites/search/search-filters.test.ts
new file mode 100644
index 000000000..4b471519c
--- /dev/null
+++ b/e2e/suites/search/search-filters.test.ts
@@ -0,0 +1,600 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * 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 .
+ */
+
+import { LoginPage, SearchResultsPage } from '../../pages/pages';
+import { RepoClient } from '../../utilities/repo-client/repo-client';
+import { Utils } from '../../utilities/utils';
+import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
+import * as moment from 'moment';
+
+fdescribe('Search filters', () => {
+ const random = Utils.random();
+
+ const user1 = `user1-${random}`;
+ const user2 = `user2-${random}`;
+
+ const parent = `parent-${random}`;
+ let parentId: string;
+
+ const site = `site-${Utils.random()}`; let docLibId;
+
+ const fileJpg = {
+ name: `search-filters-file-1-${random}.jpg`,
+ source: FILES.jpgFile
+ };
+
+ const filePdf = {
+ name: `search-filters-file-2-${random}.pdf`,
+ title: 'search filters title',
+ description: 'search filters',
+ source: FILES.pdfFile
+ };
+
+ const expectedFileTypes = ['Adobe PDF Document (1)', 'JPEG Image (1)'];
+ const expectedCreators = [`${user1} ${user1} (1)`, `${user2} ${user2} (1)`];
+ const expectedModifiers = [`${user1} ${user1} (1)`, `${user2} ${user2} (1)`];
+ const expectedLocations = ['_REPOSITORY_ (1)', `${site} (1)`];
+
+ const apis = {
+ admin: new RepoClient(),
+ user1: new RepoClient(user1, user1),
+ user2: new RepoClient(user2, user2)
+ };
+
+ const loginPage = new LoginPage();
+ const page = new SearchResultsPage();
+ const { searchInput } = page.header;
+ const { dataTable, filters } = page;
+
+ const sizeFilter = filters.size;
+ const fileTypeFilter = filters.fileType;
+ const createdDateFilter = filters.createdDate;
+ const creatorFilter = filters.creator;
+ const locationFilter = filters.location;
+ const modifierFilter = filters.modifier;
+ const modifiedDateFilter = filters.modifiedDate;
+
+ beforeAll(async (done) => {
+ await apis.admin.people.createUser({ username: user1 });
+ await apis.admin.people.createUser({ username: user2 });
+ parentId = (await apis.user1.nodes.createFolder(parent)).entry.id;
+ await apis.user1.sites.createSite(site, SITE_VISIBILITY.PUBLIC);
+ await apis.user1.sites.addSiteMember(site, user2, SITE_ROLES.SITE_MANAGER.ROLE);
+ docLibId = await apis.admin.sites.getDocLibId(site);
+
+ await apis.user1.nodes.setGranularPermission(parentId, true, user2, 'Collaborator');
+
+ await apis.user1.upload.uploadFileWithRename(fileJpg.source, docLibId, fileJpg.name);
+ await apis.user2.upload.uploadFileWithRename(filePdf.source, parentId, filePdf.name, filePdf.title, filePdf.description);
+
+ await apis.user1.search.waitForNodes('search-filters', { expect: 2 });
+
+ await loginPage.loginWith(user1);
+ done();
+ });
+
+ beforeEach(async (done) => {
+ await Utils.pressEscape();
+ await page.clickPersonalFilesAndWait();
+
+ await searchInput.clickSearchButton();
+ await searchInput.searchFor('search filters');
+ await dataTable.waitForBody();
+ done();
+ });
+
+ afterAll(async (done) => {
+ await Promise.all([
+ apis.user1.nodes.deleteNodeById(parentId),
+ apis.user1.sites.deleteSite(site)
+ ]);
+ done();
+ });
+
+ it('Filters are displayed - [C279186]', async () => {
+ expect(await sizeFilter.isPanelDisplayed()).toBe(true, 'Size filter panel not displayed');
+ expect(await createdDateFilter.isPanelDisplayed()).toBe(true, 'Created date filter panel not displayed');
+ expect(await fileTypeFilter.isPanelDisplayed()).toBe(true, 'File type filter panel not displayed');
+ expect(await creatorFilter.isPanelDisplayed()).toBe(true, 'Creator filter panel not displayed');
+ expect(await modifierFilter.isPanelDisplayed()).toBe(true, 'Modifier filter panel not displayed');
+ expect(await locationFilter.isPanelDisplayed()).toBe(true, 'Location filter panel not displayed');
+ expect(await modifiedDateFilter.isPanelDisplayed()).toBe(true, 'Modified date filter panel not displayed');
+ });
+
+ describe('Filter by Size', () => {
+ afterEach(async (done) => {
+ await sizeFilter.resetPanel();
+ done();
+ });
+
+ it('Expand / Collapse the Size filter panel - [C279197]', async () => {
+ expect(await sizeFilter.isPanelExpanded()).toBe(false, 'Size filter panel is expanded');
+
+ await sizeFilter.expandPanel();
+ expect(await sizeFilter.isPanelExpanded()).toBe(true, 'Size filter panel not expanded');
+
+ const expectedSizes = ['Small', 'Medium', 'Large', 'Huge'];
+ expect(await sizeFilter.getFiltersValues()).toEqual(expectedSizes, 'Incorrect Size filters facets');
+ expect(await sizeFilter.isClearButtonEnabled()).toBe(true, 'Size filter Clear button not enabled');
+
+ await sizeFilter.collapsePanel();
+ expect(await sizeFilter.isPanelExpanded()).toBe(false, 'Size filter panel is expanded');
+ });
+
+ it('Filter by Small - [C279199]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeSmall();
+
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, `${fileJpg.name} not in the list`);
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, `${filePdf.name} not in the list`);
+ });
+
+ it('Filter by Huge - [C279202]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeHuge();
+
+ expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
+ });
+
+ it('Filter by multiple size categories - [C279203]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeSmall();
+ await sizeFilter.checkSizeMedium();
+ await sizeFilter.checkSizeLarge();
+
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, `${fileJpg.name} not in the list`);
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, `${filePdf.name} not in the list`);
+ });
+
+ it('Clear the Size filter options - [C279198]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeSmall();
+ await sizeFilter.checkSizeMedium();
+ expect(await sizeFilter.getFiltersCheckedValues()).toEqual(['Small', 'Medium'], 'Incorrect checked Size filters');
+
+ await sizeFilter.clickClearButton();
+ expect(await sizeFilter.getFiltersCheckedValues()).toEqual([], 'Size filters not cleared');
+ });
+ });
+
+ describe('Filter by Created date', () => {
+ const yesterday = moment().subtract(1, 'day').format('DD-MMM-YY');
+ const today = moment().format('DD-MMM-YY');
+ const future = moment().add(1, 'month').format('DD-MMM-YY');
+
+ afterEach(async (done) => {
+ await createdDateFilter.resetPanel();
+ done();
+ });
+
+ it('Expand / Collapse the Created date filter panel - [C279211]', async () => {
+ expect(await createdDateFilter.isPanelExpanded()).toBe(false, 'Created date filter panel is expanded');
+
+ await createdDateFilter.expandPanel();
+ expect(await createdDateFilter.isPanelExpanded()).toBe(true, 'Created date filter panel not expanded');
+
+ expect(await createdDateFilter.isClearButtonEnabled()).toBe(true, 'Created date CLEAR button not enabled');
+ expect(await createdDateFilter.isApplyButtonEnabled()).toBe(false, 'Created date APPLY button not disabled');
+
+ await createdDateFilter.collapsePanel();
+ expect(await createdDateFilter.isPanelExpanded()).toBe(false, 'Created date filter panel is expanded');
+ });
+
+ it('Results are filtered by Created date - [C279217]', async () => {
+ await createdDateFilter.enterFromDate(yesterday);
+ await createdDateFilter.enterToDate(yesterday);
+
+ expect(await createdDateFilter.isApplyButtonEnabled()).toBe(true, 'Created date filter Apply button not enabled');
+
+ await createdDateFilter.clickApplyButton();
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(false, 'JPG file is displayed');
+
+ await createdDateFilter.enterFromDate(yesterday);
+ await createdDateFilter.enterToDate(today);
+
+ expect(await createdDateFilter.isApplyButtonEnabled()).toBe(true, 'Created date filter Apply button not enabled');
+
+ await createdDateFilter.clickApplyButton();
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ });
+
+ it('Clear the Created date filter options - [C279216]', async () => {
+ await createdDateFilter.enterFromDate(yesterday);
+ await createdDateFilter.enterToDate(yesterday);
+ await createdDateFilter.clickApplyButton();
+
+ expect(await createdDateFilter.getFromValue()).toContain(yesterday);
+ expect(await createdDateFilter.getToValue()).toContain(yesterday);
+
+ await createdDateFilter.clickClearButton();
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file is displayed');
+ expect(await createdDateFilter.getFromValue()).toEqual('', 'From field not empty');
+ expect(await createdDateFilter.getToValue()).toEqual('', 'To field not empty');
+ });
+
+ it('From and To values are required - [C279212]', async () => {
+ await createdDateFilter.enterFromDate('');
+ await createdDateFilter.enterToDate('');
+
+ expect(await createdDateFilter.isFromErrorDisplayed()).toBe(true, 'Error missing for From field');
+ expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field');
+ expect(await createdDateFilter.getFromError()).toEqual('Required value');
+ expect(await createdDateFilter.getToError()).toEqual('Required value');
+ });
+
+ it('Error message is displayed when entering an incorrect date format - [C279213]', async () => {
+ await createdDateFilter.enterFromDate('03.31.2019');
+ await createdDateFilter.enterToDate('invalid text');
+
+ expect(await createdDateFilter.isFromErrorDisplayed()).toBe(true, 'Error missing for From field');
+ expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field');
+ expect(await createdDateFilter.getFromError()).toEqual(`Invalid date. The date must be in the format 'DD-MMM-YY'`);
+ expect(await createdDateFilter.getToError()).toEqual(`Invalid date. The date must be in the format 'DD-MMM-YY'`);
+ });
+
+ it('Error message is displayed when entering a date from the future - [C279214]', async () => {
+ await createdDateFilter.enterFromDate(future);
+ await createdDateFilter.enterToDate(future);
+
+ expect(await createdDateFilter.isFromErrorDisplayed()).toBe(true, 'Error missing for From field');
+ expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field');
+ expect(await createdDateFilter.getFromError()).toEqual('The date is beyond the maximum date.');
+ expect(await createdDateFilter.getToError()).toEqual('The date is beyond the maximum date.');
+ });
+
+ it('Error message is displayed when From value is bigger than To value - [C279215]', async () => {
+ await createdDateFilter.enterFromDate(today);
+ await createdDateFilter.enterToDate(yesterday);
+
+ expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field');
+ expect(await createdDateFilter.getToError()).toEqual('No days selected.');
+ });
+ });
+
+ describe('Filter by File type', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the File type filter panel - [C279191]', async () => {
+ expect(await fileTypeFilter.isPanelExpanded()).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');
+
+ await fileTypeFilter.collapsePanel();
+ expect(await fileTypeFilter.isPanelExpanded()).toBe(false, 'File type filter panel is expanded');
+ });
+
+ it('Results are filtered by File type - [C279192]', async () => {
+ await fileTypeFilter.checkCategory('Adobe PDF Document');
+
+ expect(await fileTypeFilter.isClearButtonEnabled()).toBe(true, 'File type filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(false, 'JPG file is displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['Adobe PDF Document']);
+
+ await fileTypeFilter.checkCategory('JPEG Image');
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['Adobe PDF Document', 'JPEG Image']);
+ });
+
+ it('Clear the File type filter options - [C279193]', async () => {
+ await fileTypeFilter.expandPanel();
+ await fileTypeFilter.checkCategory('Adobe PDF Document');
+ await fileTypeFilter.checkCategory('JPEG Image');
+
+ expect(await fileTypeFilter.getFiltersCheckedValues()).toEqual(['Adobe PDF Document (1)', 'JPEG Image (1)'], 'Incorrect checked File type filters');
+
+ await fileTypeFilter.clickClearButton();
+ expect(await fileTypeFilter.getFiltersCheckedValues()).toEqual([], 'File types selection not cleared');
+ });
+
+ it('Search for a specific file type - [C279195]', async () => {
+ 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', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the Creator filter panel - [C279205]', async () => {
+ expect(await creatorFilter.isPanelExpanded()).toBe(true, 'Creator filter panel not expanded');
+
+ expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators, 'Incorrect Creator filters facets');
+ expect(await creatorFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Creator filter categories not displayed');
+
+ await creatorFilter.collapsePanel();
+ expect(await creatorFilter.isPanelExpanded()).toBe(false, 'Creator filter panel is expanded');
+ });
+
+ it('Results are filtered by Creator - [C279206]', async () => {
+ await creatorFilter.checkCategory(user1);
+
+ expect(await creatorFilter.isClearButtonEnabled()).toBe(true, 'Creator filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`]);
+
+ await creatorFilter.checkCategory(user2);
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`, `${user2} ${user2}`]);
+ });
+
+ it('Clear the Creator filter options - [C279207]', async () => {
+ await creatorFilter.expandPanel();
+ await creatorFilter.checkCategory(user1);
+ await creatorFilter.checkCategory(user2);
+ expect(await creatorFilter.getFiltersCheckedValues()).toEqual(expectedCreators, 'Incorrect checked Creator filters');
+
+ await creatorFilter.clickClearButton();
+ expect(await creatorFilter.getFiltersCheckedValues()).toEqual([], 'Creator selection not cleared');
+ });
+
+ it('Search for a specific creator - [C279208]', async () => {
+ expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators, 'Incorrect Creator filters facets');
+ await creatorFilter.filterCategoriesBy(user1);
+ expect(await creatorFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`], 'Incorrect Creator filters facets');
+ });
+ });
+
+ describe('Filter by Modifier', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the Modifier filter panel - [C279224]', async () => {
+ expect(await modifierFilter.isPanelExpanded()).toBe(true, 'Modifier filter panel not expanded');
+
+ expect(await modifierFilter.getFiltersValues()).toEqual(expectedModifiers, 'Incorrect Modifier filters facets');
+ expect(await modifierFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Modifier filter categories not displayed');
+
+ await modifierFilter.collapsePanel();
+ expect(await modifierFilter.isPanelExpanded()).toBe(false, 'Modifier filter panel is expanded');
+ });
+
+ it('Results are filtered by Modifier - [C279225]', async () => {
+ await modifierFilter.checkCategory(user1);
+
+ expect(await modifierFilter.isClearButtonEnabled()).toBe(true, 'Modifier filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`]);
+
+ await modifierFilter.checkCategory(user2);
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`, `${user2} ${user2}`]);
+ });
+
+ it('Clear the Modifier filter options - [C279226]', async () => {
+ await modifierFilter.expandPanel();
+ await modifierFilter.checkCategory(user1);
+ await modifierFilter.checkCategory(user2);
+ expect(await modifierFilter.getFiltersCheckedValues()).toEqual(expectedModifiers, 'Incorrect checked Modifier filters');
+
+ await modifierFilter.clickClearButton();
+ expect(await modifierFilter.getFiltersCheckedValues()).toEqual([], 'Modifier selection not cleared');
+ });
+
+ it('Search for a specific modifier - [C279227]', async () => {
+ expect(await modifierFilter.getFiltersValues()).toEqual(expectedModifiers, 'Incorrect Modifier filters facets');
+ await modifierFilter.filterCategoriesBy(user1);
+ expect(await modifierFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`], 'Incorrect Modifier filters facets');
+ });
+ });
+
+ describe('Filter by Location', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the Location filter panel - [C279230]', async () => {
+ expect(await locationFilter.isPanelExpanded()).toBe(true, 'Location filter panel not expanded');
+
+ expect(await locationFilter.getFiltersValues()).toEqual(expectedLocations, 'Incorrect Location filters facets');
+ expect(await locationFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Location filter categories not displayed');
+
+ await locationFilter.collapsePanel();
+ expect(await locationFilter.isPanelExpanded()).toBe(false, 'Location filter panel is expanded');
+ });
+
+ it('Results are filtered by Location - [C279231]', async () => {
+ await locationFilter.checkCategory(site);
+
+ expect(await locationFilter.isClearButtonEnabled()).toBe(true, 'Location filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([site]);
+
+ await locationFilter.checkCategory('_REPOSITORY_');
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([site, '_REPOSITORY_']);
+ });
+
+ it('Clear the Location filter options - [C279232]', async () => {
+ await locationFilter.expandPanel();
+ await locationFilter.checkCategory(site);
+ await locationFilter.checkCategory('_REPOSITORY_');
+ expect(await locationFilter.getFiltersCheckedValues()).toEqual(expectedLocations, 'Incorrect checked Location filters');
+
+ await locationFilter.clickClearButton();
+ expect(await locationFilter.getFiltersCheckedValues()).toEqual([], 'Location selection not cleared');
+ });
+
+ it('Search for a specific location - [C279233]', async () => {
+ expect(await locationFilter.getFiltersValues()).toEqual(expectedLocations, 'Incorrect Location filters facets');
+ await locationFilter.filterCategoriesBy(site);
+ expect(await locationFilter.getFiltersValues()).toEqual([`${site} (1)`], 'Incorrect Location filters facets');
+ });
+ });
+
+ describe('Filter by Modified date', () => {
+ const expectedDateFilters = ['Today (2)', 'This week (2)', 'This month (2)', 'In the last 6 months (2)', 'This year (2)'];
+
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ done();
+ });
+
+ it('Expand / Collapse the Modified date filter panel - [C279219]', async () => {
+ expect(await modifiedDateFilter.isPanelExpanded()).toBe(true, 'Modified Date filter panel not expanded');
+
+ expect(await modifiedDateFilter.getFiltersValues()).toEqual(expectedDateFilters, 'Incorrect Modified Date filters facets');
+ expect(await modifiedDateFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Modified Date filter categories not displayed');
+
+ await modifiedDateFilter.collapsePanel();
+ expect(await modifiedDateFilter.isPanelExpanded()).toBe(false, 'Modified Date filter panel is expanded');
+ });
+
+ it('Results are filtered by Modified date - [C279221]', async () => {
+ await modifiedDateFilter.checkCategory('Today');
+
+ expect(await modifiedDateFilter.isClearButtonEnabled()).toBe(true, 'Modified date filter Clear button not enabled');
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['Today']);
+
+ await modifiedDateFilter.checkCategory('This week');
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['Today', 'This week']);
+ });
+
+ it('Clear the Modified date filter options - [C279220]', async () => {
+ await modifiedDateFilter.expandPanel();
+ await modifiedDateFilter.checkCategory('Today');
+ await modifiedDateFilter.checkCategory('This week');
+ await modifiedDateFilter.checkCategory('This month');
+ await modifiedDateFilter.checkCategory('In the last 6 months');
+ await modifiedDateFilter.checkCategory('This year');
+
+ expect(await modifiedDateFilter.getFiltersCheckedValues()).toEqual(expectedDateFilters, 'Incorrect checked Modified date filters');
+
+ await modifiedDateFilter.clickClearButton();
+ expect(await modifiedDateFilter.getFiltersCheckedValues()).toEqual([], 'Modified date selection not cleared');
+ });
+
+ it('Search for a specific modified date option - [C325006]', async () => {
+ expect(await modifiedDateFilter.getFiltersValues()).toEqual(expectedDateFilters, 'Incorrect Modified date filters facets');
+ await modifiedDateFilter.filterCategoriesBy('This');
+ expect(await modifiedDateFilter.getFiltersValues()).toEqual(['This week (2)', 'This month (2)', 'This year (2)'], 'Incorrect Modified date filters facets');
+ });
+ });
+
+ describe('Multiple filters', () => {
+ afterEach(async (done) => {
+ await filters.clickResetAllButton();
+ await sizeFilter.resetPanel();
+ await createdDateFilter.resetPanel();
+ done();
+ });
+
+ it('Multiple filters can be applied - [C280051]', async () => {
+ await sizeFilter.expandPanel();
+ await sizeFilter.checkSizeSmall();
+
+ await fileTypeFilter.expandPanel();
+ await fileTypeFilter.checkCategory('JPEG Image');
+ await creatorFilter.checkCategory(user1);
+ await locationFilter.checkCategory(site);
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(false, 'PDF file is displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual(['JPEG Image', `${user1} ${user1}`, site]);
+
+ await page.removeChip('JPEG Image');
+ await page.removeChip(`${user1} ${user1}`);
+ await page.removeChip(site);
+
+ expect(await dataTable.isItemPresent(filePdf.name)).toBe(true, 'PDF file not displayed');
+ expect(await dataTable.isItemPresent(fileJpg.name)).toBe(true, 'JPG file not displayed');
+ expect(await page.getResultsChipsValues()).toEqual([]);
+ });
+
+ it('Total results is updated correctly - [C280052]', async () => {
+ await fileTypeFilter.expandPanel();
+ await fileTypeFilter.checkCategory('JPEG Image');
+ await creatorFilter.checkCategory(user1);
+
+ expect(await page.getResultsFoundText()).toEqual('1 result found');
+
+ await page.removeChip('JPEG Image');
+ await page.removeChip(`${user1} ${user1}`);
+
+ expect(await page.getResultsFoundText()).toEqual('2 results found');
+ });
+
+ it('Pagination is correct when search results are filtered - [C279188]', async () => {
+ await fileTypeFilter.expandPanel();
+ await fileTypeFilter.checkCategory('JPEG Image');
+ await creatorFilter.checkCategory(user1);
+
+ expect(await page.pagination.getRange()).toEqual('Showing 1-1 of 1');
+
+ await page.removeChip('JPEG Image');
+ await page.removeChip(`${user1} ${user1}`);
+
+ expect(await page.pagination.getRange()).toEqual('Showing 1-2 of 2');
+ });
+
+ it('The filter facets display is updated when making a new query - [C308042]', async () => {
+ expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes);
+ expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators);
+ expect(await modifierFilter.getFiltersValues()).toEqual(expectedModifiers);
+ expect(await locationFilter.getFiltersValues()).toEqual(expectedLocations);
+
+ await searchInput.clickSearchButton();
+ await searchInput.searchFor(fileJpg.name);
+ await dataTable.waitForBody();
+
+ expect(await fileTypeFilter.getFiltersValues()).toEqual(['JPEG Image (1)']);
+ expect(await creatorFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`]);
+ expect(await modifierFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`]);
+ expect(await locationFilter.getFiltersValues()).toEqual([`${site} (1)`]);
+ });
+ });
+});
diff --git a/e2e/suites/search/search-input.test.ts b/e2e/suites/search/search-input.test.ts
index ac57d4d98..d692d5569 100644
--- a/e2e/suites/search/search-input.test.ts
+++ b/e2e/suites/search/search-input.test.ts
@@ -48,13 +48,13 @@ describe('Search input', () => {
it('Search options are displayed when clicking in the search input - [C289848]', async () => {
await searchInput.clickSearchButton();
- expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, '1. Search options not displayed');
- expect(await searchInput.isFilesOptionEnabled()).toBe(true, '2. Files option not enabled');
- expect(await searchInput.isFoldersOptionEnabled()).toBe(true, '3. Folders option not enabled');
- expect(await searchInput.isLibrariesOptionEnabled()).toBe(true, '4. Libraries option not enabled');
- expect(await searchInput.isFilesOptionChecked()).toBe(false, '5. Files option is checked');
- expect(await searchInput.isFoldersOptionChecked()).toBe(false, '6. Folders option is checked');
- expect(await searchInput.isLibrariesOptionChecked()).toBe(false, '7. Libraries option is checked');
+ expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, 'Search options not displayed');
+ expect(await searchInput.isFilesOptionEnabled()).toBe(true, 'Files option not enabled');
+ expect(await searchInput.isFoldersOptionEnabled()).toBe(true, 'Folders option not enabled');
+ expect(await searchInput.isLibrariesOptionEnabled()).toBe(true, 'Libraries option not enabled');
+ expect(await searchInput.isFilesOptionChecked()).toBe(false, 'Files option is checked');
+ expect(await searchInput.isFoldersOptionChecked()).toBe(false, 'Folders option is checked');
+ expect(await searchInput.isLibrariesOptionChecked()).toBe(false, 'Libraries option is checked');
});
it('Search options are correctly enabled / disabled - [C289849]', async () => {
diff --git a/e2e/suites/search/search-results-files-folders.test.ts b/e2e/suites/search/search-results-files-folders.test.ts
index db589b197..bad389200 100644
--- a/e2e/suites/search/search-results-files-folders.test.ts
+++ b/e2e/suites/search/search-results-files-folders.test.ts
@@ -60,19 +60,9 @@ describe('Search results - files and folders', () => {
beforeAll(async done => {
await apis.admin.people.createUser({ username });
- fileId = (await apis.user.nodes.createFile(
- file,
- '-my-',
- fileTitle,
- fileDescription
- )).entry.id;
+ fileId = (await apis.user.nodes.createFile(file, '-my-', fileTitle, fileDescription)).entry.id;
await apis.user.nodes.editNodeContent(fileId, 'edited by user');
- folderId = (await apis.user.nodes.createFolder(
- folder,
- '-my-',
- folderTitle,
- folderDescription
- )).entry.id;
+ folderId = (await apis.user.nodes.createFolder(folder, '-my-', folderTitle, folderDescription)).entry.id;
fileRussianId = (await apis.user.nodes.createFile(fileRussian)).entry.id;
await apis.user.sites.createSite(site);
@@ -83,6 +73,11 @@ describe('Search results - files and folders', () => {
done();
});
+ beforeEach(async done => {
+ await page.refresh();
+ done();
+ });
+
afterAll(async done => {
await Promise.all([
apis.user.nodes.deleteNodeById(fileId),
@@ -93,20 +88,13 @@ describe('Search results - files and folders', () => {
done();
});
- beforeEach(async done => {
- await page.refresh();
- done();
- });
-
it('Results page title - [C307002]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('test-');
await dataTable.waitForBody();
- expect(await page.breadcrumb.getCurrentItemName()).toEqual(
- 'Search Results'
- );
+ expect(await page.breadcrumb.getCurrentItemName()).toEqual('Search Results');
});
it('File information - [C279183]', async () => {
@@ -116,38 +104,17 @@ describe('Search results - files and folders', () => {
await dataTable.waitForBody();
const fileEntry = await apis.user.nodes.getNodeById(fileId);
- const modifiedDate = moment(fileEntry.entry.modifiedAt).format(
- 'MMM D, YYYY, h:mm:ss A'
- );
+ const modifiedDate = moment(fileEntry.entry.modifiedAt).format('MMM D, YYYY, h:mm:ss A');
const modifiedBy = fileEntry.entry.modifiedByUser.displayName;
const size = fileEntry.entry.content.sizeInBytes;
- expect(await dataTable.isItemPresent(file)).toBe(
- true,
- `${file} is not displayed`
- );
-
- expect(await dataTable.getRowCellsCount(file)).toEqual(
- 2,
- 'incorrect number of columns'
- );
-
- expect(await dataTable.getSearchResultLinesCount(file)).toEqual(
- 4,
- 'incorrect number of lines for search result'
- );
- expect(await dataTable.getSearchResultNameAndTitle(file)).toBe(
- `${file} ( ${fileTitle} )`
- );
- expect(await dataTable.getSearchResultDescription(file)).toBe(
- fileDescription
- );
- expect(await dataTable.getSearchResultModified(file)).toBe(
- `Modified: ${modifiedDate} by ${modifiedBy} | Size: ${size} Bytes`
- );
- expect(await dataTable.getSearchResultLocation(file)).toMatch(
- /Location:\s+Personal Files/
- );
+ expect(await dataTable.isItemPresent(file)).toBe(true, `${file} is not displayed`);
+ expect(await dataTable.getRowCellsCount(file)).toEqual(2, 'incorrect number of columns');
+ expect(await dataTable.getSearchResultLinesCount(file)).toEqual(4, 'incorrect number of lines for search result');
+ expect(await dataTable.getSearchResultNameAndTitle(file)).toBe(`${file} ( ${fileTitle} )`);
+ expect(await dataTable.getSearchResultDescription(file)).toBe(fileDescription);
+ expect(await dataTable.getSearchResultModified(file)).toBe(`Modified: ${modifiedDate} by ${modifiedBy} | Size: ${size} Bytes`);
+ expect(await dataTable.getSearchResultLocation(file)).toMatch(/Location:\s+Personal Files/);
});
it('Folder information - [C306867]', async () => {
@@ -157,37 +124,16 @@ describe('Search results - files and folders', () => {
await dataTable.waitForBody();
const folderEntry = await apis.user.nodes.getNodeById(folderId);
- const modifiedDate = moment(folderEntry.entry.modifiedAt).format(
- 'MMM D, YYYY, h:mm:ss A'
- );
+ const modifiedDate = moment(folderEntry.entry.modifiedAt).format('MMM D, YYYY, h:mm:ss A');
const modifiedBy = folderEntry.entry.modifiedByUser.displayName;
- expect(await dataTable.isItemPresent(folder)).toBe(
- true,
- `${folder} is not displayed`
- );
-
- expect(await dataTable.getRowCellsCount(folder)).toEqual(
- 2,
- 'incorrect number of columns'
- );
-
- expect(await dataTable.getSearchResultLinesCount(folder)).toEqual(
- 4,
- 'incorrect number of lines for search result'
- );
- expect(await dataTable.getSearchResultNameAndTitle(folder)).toBe(
- `${folder} ( ${folderTitle} )`
- );
- expect(await dataTable.getSearchResultDescription(folder)).toBe(
- folderDescription
- );
- expect(await dataTable.getSearchResultModified(folder)).toBe(
- `Modified: ${modifiedDate} by ${modifiedBy}`
- );
- expect(await dataTable.getSearchResultLocation(folder)).toMatch(
- /Location:\s+Personal Files/
- );
+ expect(await dataTable.isItemPresent(folder)).toBe(true, `${folder} is not displayed`);
+ expect(await dataTable.getRowCellsCount(folder)).toEqual(2, 'incorrect number of columns');
+ expect(await dataTable.getSearchResultLinesCount(folder)).toEqual(4, 'incorrect number of lines for search result');
+ expect(await dataTable.getSearchResultNameAndTitle(folder)).toBe(`${folder} ( ${folderTitle} )`);
+ expect(await dataTable.getSearchResultDescription(folder)).toBe(folderDescription);
+ expect(await dataTable.getSearchResultModified(folder)).toBe(`Modified: ${modifiedDate} by ${modifiedBy}`);
+ expect(await dataTable.getSearchResultLocation(folder)).toMatch(/Location:\s+Personal Files/);
});
it('Search file with special characters - [C290029]', async () => {
@@ -196,10 +142,7 @@ describe('Search results - files and folders', () => {
await searchInput.searchFor(fileRussian);
await dataTable.waitForBody();
- expect(await dataTable.isItemPresent(fileRussian)).toBe(
- true,
- `${fileRussian} is not displayed`
- );
+ expect(await dataTable.isItemPresent(fileRussian)).toBe(true, `${fileRussian} is not displayed`);
});
it('Location column redirect - file in user Home - [C279177]', async () => {
diff --git a/e2e/suites/search/search-results-libraries.test.ts b/e2e/suites/search/search-results-libraries.test.ts
index a40ed84f7..f958fdc03 100644
--- a/e2e/suites/search/search-results-libraries.test.ts
+++ b/e2e/suites/search/search-results-libraries.test.ts
@@ -63,7 +63,6 @@ describe('Search results - libraries', () => {
const adminSite2 = `admin-site-${Utils.random()}`;
const adminSite3 = `admin-site-${Utils.random()}`;
const adminSite4 = `admin-site-${Utils.random()}`;
-
const adminPrivate = `admin-site-${Utils.random()}`;
const apis = {
diff --git a/e2e/suites/search/search-sorting.test.ts b/e2e/suites/search/search-sorting.test.ts
new file mode 100644
index 000000000..3e34c1e2d
--- /dev/null
+++ b/e2e/suites/search/search-sorting.test.ts
@@ -0,0 +1,202 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ *
+ * 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 .
+ */
+
+import { LoginPage, SearchResultsPage } from '../../pages/pages';
+import { RepoClient } from '../../utilities/repo-client/repo-client';
+import { Utils } from '../../utilities/utils';
+import { FILES } from '../../configs';
+
+describe('Search sorting', () => {
+ const random = Utils.random();
+
+ const user1 = `user1-${random}`;
+ const user2 = `user2-${random}`;
+
+ const parent = `parent-${random}`;
+ let parentId: string;
+
+ const fileJpg = {
+ name: `search-sort-file-1-${random}.jpg`,
+ source: FILES.jpgFile
+ };
+
+ const filePdf = {
+ name: `search-sort-file-2-${random}.pdf`,
+ title: 'search sort title',
+ description: 'search sort',
+ source: FILES.pdfFile
+ };
+
+ const apis = {
+ admin: new RepoClient(),
+ user1: new RepoClient(user1, user1),
+ user2: new RepoClient(user2, user2)
+ };
+
+ const loginPage = new LoginPage();
+ const page = new SearchResultsPage();
+ const { searchInput } = page.header;
+ const { dataTable } = page;
+
+ beforeAll(async (done) => {
+ await apis.admin.people.createUser({ username: user1 });
+ await apis.admin.people.createUser({ username: user2 });
+ parentId = (await apis.user1.nodes.createFolder(parent)).entry.id;
+
+ await apis.user1.nodes.setGranularPermission(parentId, true, user2, 'Collaborator');
+
+ await apis.user1.upload.uploadFileWithRename(fileJpg.source, parentId, fileJpg.name);
+ await apis.user2.upload.uploadFileWithRename(filePdf.source, parentId, filePdf.name, filePdf.title, filePdf.description);
+
+ await apis.user1.search.waitForNodes('search-sort', { expect: 2 });
+
+ await loginPage.loginWith(user1);
+ done();
+ });
+
+ beforeEach(async (done) => {
+ await Utils.pressEscape();
+ await page.clickPersonalFilesAndWait();
+
+ await searchInput.clickSearchButton();
+ await searchInput.searchFor('search sort');
+ await dataTable.waitForBody();
+ done();
+ });
+
+ afterAll(async () => {
+ await apis.user1.nodes.deleteNodeById(parentId);
+ });
+
+ it('Sorting options are displayed - [C277722]', async () => {
+ expect(await page.sortingPicker.isSortOrderButtonDisplayed()).toBe(true, 'Sort order button not displayed');
+ expect(await page.sortingPicker.isSortByOptionDisplayed()).toBe(true, 'Sort options not displayed');
+ expect(await page.sortingPicker.getSortOrder()).toBe('DESC', 'Incorrect default sort order');
+ expect(await page.sortingPicker.getSelectedSortByOption()).toBe('Relevance', 'Incorrect selected sort option');
+
+ await page.sortingPicker.clickSortByDropdown();
+
+ const expectedOptions = [ 'Relevance', 'Filename', 'Title', 'Modified date', 'Modifier', 'Created date', 'Size', 'Type' ];
+ expect(await page.sortingPicker.getSortByOptionsList()).toEqual(expectedOptions, 'Incorrect sort options list');
+ });
+
+ it('Sort by Name - [C277728]', async () => {
+ await page.sortingPicker.sortByName();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByName();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+
+ it('Sort by Type - [C277740]', async () => {
+ await page.sortingPicker.sortByType();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+
+ await page.sortingPicker.sortByType();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+ });
+
+ it('Sort by Size - [C277738]', async () => {
+ await page.sortingPicker.sortBySize();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+
+ await page.sortingPicker.sortBySize();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+ });
+
+ it('Sort by Created date - [C277734]', async () => {
+ await page.sortingPicker.sortByCreatedDate();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByCreatedDate();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+
+ it('Sort by Modified date - [C277736]', async () => {
+ await page.sortingPicker.sortByModifiedDate();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByModifiedDate();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+
+ it('Sort by Relevance - [C277727]', async () => {
+ await page.sortingPicker.sortByRelevance();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByRelevance();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+
+ it('Sort by Modifier - [C277732]', async () => {
+ await page.sortingPicker.sortByModifier();
+ await page.sortingPicker.setSortOrderASC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
+
+ await page.sortingPicker.sortByModifier();
+ await page.sortingPicker.setSortOrderDESC();
+
+ expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
+ expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
+ });
+});
diff --git a/e2e/utilities/repo-client/apis/upload/upload-api.ts b/e2e/utilities/repo-client/apis/upload/upload-api.ts
index 2e9bcaea8..e9db895e9 100644
--- a/e2e/utilities/repo-client/apis/upload/upload-api.ts
+++ b/e2e/utilities/repo-client/apis/upload/upload-api.ts
@@ -51,8 +51,15 @@ export class UploadApi extends RepoApi {
}
}
- async uploadFileWithRename(fileName: string, parentFolderId: string = '-my-', newName: string) {
+ async uploadFileWithRename(fileName: string, parentId: string = '-my-', newName: string, title: string = '', description: string = '') {
const file = fs.createReadStream(`${E2E_ROOT_PATH}/resources/test-files/${fileName}`);
+ const nodeProps = {
+ properties: {
+ 'cm:title': title,
+ 'cm:description': description
+ }
+ };
+
const opts = {
name: newName,
nodeType: 'cm:content'
@@ -60,7 +67,7 @@ export class UploadApi extends RepoApi {
try {
await this.apiAuth();
- return await this.upload.uploadFile(file, '', parentFolderId, null, opts);
+ return await this.upload.uploadFile(file, '', parentId, nodeProps, opts);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error);
}
diff --git a/e2e/utilities/utils.ts b/e2e/utilities/utils.ts
index 886b57507..fba5052fd 100755
--- a/e2e/utilities/utils.ts
+++ b/e2e/utilities/utils.ts
@@ -92,6 +92,13 @@ export class Utils {
}
}
+ static async clearFieldWithBackspace(elem: ElementFinder): Promise {
+ const text = await elem.getAttribute('value');
+ for (let i = 0; i < text.length; i++) {
+ await elem.sendKeys(protractor.Key.BACK_SPACE);
+ }
+ }
+
static async fileExistsOnOS(fileName: string, folderName: string = '', subFolderName: string = '') {
const config = await browser.getProcessedConfig();
const filePath = path.join(config.params.downloadFolder, folderName, subFolderName, fileName);