mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
* Layout changes for workspace sidemenu * added header and search layout changes * implemented review comments and removed process related code * Added expand and collapse functionality * Modified the paths * linting fixes * use standard material settings icon * use only specific modules needed for page layout * use standard "menu" icon for now * use standard avatar icon for now * cleanup user profile menu item * cleanup About component layout * remove hardcoded settings route * deprecate "headerImagePath" * deprecate "headerTextColor" customisation * deprecate "headerColor" customisation * proper toggle of the side menu * proper sidebar header implementation * user profile basic cleanup * minor fixes * cleanup buttons * remove old app layout and use ADF one * remove old header component * cleanup old layout module * fix unit tests * cleanup unit tests * cleanup header actions module * deprecate unused main-action component * cleanup styles * restore removed method * cleanup search results toolbar * restore expand menu functionality * cleanup code, back buttons for about and profile * restore original code * proper collapse button * remove unused i18n key * styles cleanup * cleanup sidebar * cleanup user profile * add safety checks for focus after close * layout fixes * update view profile unit tests * code cleanup after reviews * cleanup header actions * fix menu population, user info * improved upload and create actions * remove useless tests * fix folder rules tests * search button workaround * e2e: remove wait * add create/upload tooltips * e2e fix * e2e fix * e2e fix * e2e fix * e2e fix * e2e fix * e2e fix * e2e fix * e2e fix * e2e fix * e2e fix * e2e fix * try fix e2e * update e2e extension configs * try fix e2e * try fix e2e * fix eslint config * try fix e2e * move search button to extensions * move upload and create to extensions * remove header actions as no longer needed * cleanup * e2e fixes and cleanup for unwanted files * linting fixes * linting fixes * added button type to support text buttons * linting fixes * added more unit tests to achieve code coverage requirement * fixing code covergae for aca-content * fixed code coverage for aca-shared * linting fixes * linting fixes * cleanup * version fix --------- Co-authored-by: SheenaMalhotra182 <sheena.malhotra@globallogic.com> Co-authored-by: Denys Vuika <denys.vuika@gmail.com> Co-authored-by: SheenaMalhotra182 <sheena.malhotra@contractors.onbase.com>
261 lines
10 KiB
TypeScript
261 lines
10 KiB
TypeScript
/*!
|
|
* 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
|
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import { AdminActions, LoginPage, SearchResultsPage, RepoClient, Utils, SITE_VISIBILITY, SITE_ROLES } from '@alfresco/aca-testing-shared';
|
|
import { Logger } from '@alfresco/adf-testing';
|
|
|
|
describe('Search results - libraries', () => {
|
|
const random = Utils.random();
|
|
const username = `user-${random}`;
|
|
|
|
const site1 = {
|
|
name: `lib-${random}-1`,
|
|
id: `site-${random}-1`
|
|
};
|
|
const site2 = {
|
|
name: `site-2-${random}`,
|
|
id: `site-${random}-2`
|
|
};
|
|
const site3 = {
|
|
name: `my-lib-${random}`,
|
|
id: `site3-${random}`
|
|
};
|
|
const site4 = {
|
|
name: `my-site-${random}`,
|
|
id: `site4-${random}`,
|
|
description: 'site description'
|
|
};
|
|
|
|
const userSitePrivate = `user-site-${random}-private`;
|
|
const userSiteModerated = `user-site-${random}-moderated`;
|
|
const userSitePublic = `user-site-${random}-public`;
|
|
|
|
const siteRussian = {
|
|
/* cspell:disable-next-line */
|
|
name: `любимый-сайт-${random}`,
|
|
id: `site-russian-id-${random}`
|
|
};
|
|
|
|
const adminSite1 = `admin-${random}-site1`;
|
|
const adminSite2 = `admin-${random}-site2`;
|
|
const adminSite3 = `admin-${random}-site3`;
|
|
const adminSite4 = `admin-${random}-site4`;
|
|
const adminPrivate = `admin-${random}-sitePrivate`;
|
|
|
|
const apis = {
|
|
user: new RepoClient(username, username)
|
|
};
|
|
|
|
const loginPage = new LoginPage();
|
|
const page = new SearchResultsPage();
|
|
const { searchInput, toolbar } = page.pageLayoutHeader;
|
|
const dataTable = page.dataTable;
|
|
const adminApiActions = new AdminActions();
|
|
|
|
beforeAll(async () => {
|
|
try {
|
|
await adminApiActions.createUser({ username });
|
|
|
|
await apis.user.sites.createSite(site1.name, SITE_VISIBILITY.PUBLIC, '', site1.id);
|
|
await apis.user.sites.createSite(site2.name, SITE_VISIBILITY.PUBLIC, '', site2.id);
|
|
await apis.user.sites.createSite(site3.name, SITE_VISIBILITY.PUBLIC, '', site3.id);
|
|
await apis.user.sites.createSite(site4.name, SITE_VISIBILITY.PUBLIC, site4.description, site4.id);
|
|
|
|
await apis.user.sites.createSite(userSitePublic, SITE_VISIBILITY.PUBLIC);
|
|
await apis.user.sites.createSite(userSiteModerated, SITE_VISIBILITY.MODERATED);
|
|
await apis.user.sites.createSite(userSitePrivate, SITE_VISIBILITY.PRIVATE);
|
|
|
|
await apis.user.sites.createSite(siteRussian.name, SITE_VISIBILITY.PUBLIC, '', siteRussian.id);
|
|
|
|
await adminApiActions.sites.createSite(adminSite1, SITE_VISIBILITY.PUBLIC);
|
|
await adminApiActions.sites.createSite(adminSite2, SITE_VISIBILITY.PUBLIC);
|
|
await adminApiActions.sites.createSite(adminSite3, SITE_VISIBILITY.PUBLIC);
|
|
await adminApiActions.sites.createSite(adminSite4, SITE_VISIBILITY.PUBLIC);
|
|
await adminApiActions.sites.addSiteMember(adminSite1, username, SITE_ROLES.SITE_CONSUMER.ROLE);
|
|
await adminApiActions.sites.addSiteMember(adminSite2, username, SITE_ROLES.SITE_CONTRIBUTOR.ROLE);
|
|
await adminApiActions.sites.addSiteMember(adminSite3, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
|
|
await adminApiActions.sites.addSiteMember(adminSite4, username, SITE_ROLES.SITE_MANAGER.ROLE);
|
|
|
|
await adminApiActions.sites.createSite(adminPrivate, SITE_VISIBILITY.PRIVATE);
|
|
|
|
await adminApiActions.login();
|
|
await adminApiActions.sites.waitForSitesToBeCreated([adminSite1, adminSite2, adminSite3, adminSite4]);
|
|
|
|
await apis.user.sites.waitForSitesToBeCreated([
|
|
site1.id,
|
|
site2.id,
|
|
site3.id,
|
|
site4.id,
|
|
userSitePublic,
|
|
userSiteModerated,
|
|
userSitePrivate,
|
|
siteRussian.id
|
|
]);
|
|
|
|
await apis.user.queries.waitForSites(random, { expect: 12 });
|
|
|
|
await loginPage.loginWith(username);
|
|
} catch (error) {
|
|
Logger.error(`----- beforeAll failed : ${error}`);
|
|
}
|
|
});
|
|
|
|
afterAll(async () => {
|
|
try {
|
|
await adminApiActions.sites.deleteSites([adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate]);
|
|
await apis.user.sites.deleteSites([site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id]);
|
|
} catch (error) {
|
|
Logger.error(`----- afterAll failed : ${error}`);
|
|
}
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
await Utils.pressEscape();
|
|
await page.clickPersonalFiles();
|
|
});
|
|
|
|
it('[C290012] Search library - full name match', async () => {
|
|
await toolbar.clickSearchIconButton();
|
|
await searchInput.clickSearchButton();
|
|
await searchInput.checkLibraries();
|
|
await searchInput.searchForLibrary(site1.name);
|
|
await dataTable.waitForBody();
|
|
|
|
expect(await dataTable.isItemPresent(site1.name)).toBe(true, `${site1.name} not displayed`);
|
|
expect(await dataTable.isItemPresent(site2.name)).toBe(false, `${site2.name} displayed`);
|
|
expect(await dataTable.isItemPresent(site3.name)).toBe(false, `${site3.name} displayed`);
|
|
expect(await dataTable.isItemPresent(site4.name)).toBe(false, `${site4.name} displayed`);
|
|
});
|
|
|
|
it('[C290013] Search library - partial name match', async () => {
|
|
await toolbar.clickSearchIconButton();
|
|
await searchInput.clickSearchButton();
|
|
await searchInput.checkLibraries();
|
|
await searchInput.searchForLibrary(`lib-${random}`);
|
|
await dataTable.waitForBody();
|
|
|
|
expect(await dataTable.isItemPresent(site1.name)).toBe(true, `${site1.name} not displayed`);
|
|
expect(await dataTable.isItemPresent(site2.name)).toBe(false, `${site2.name} displayed`);
|
|
expect(await dataTable.isItemPresent(site3.name)).toBe(true, `${site3.name} not displayed`);
|
|
expect(await dataTable.isItemPresent(site4.name)).toBe(false, `${site4.name} displayed`);
|
|
});
|
|
|
|
it('[C290014] Search library - description match', async () => {
|
|
await toolbar.clickSearchIconButton();
|
|
await searchInput.clickSearchButton();
|
|
await searchInput.checkLibraries();
|
|
await searchInput.searchForLibrary(site4.description);
|
|
await dataTable.waitForBody();
|
|
|
|
expect(await dataTable.isItemPresent(site1.name)).toBe(false, `${site1.name} displayed`);
|
|
expect(await dataTable.isItemPresent(site2.name)).toBe(false, `${site2.name} displayed`);
|
|
expect(await dataTable.isItemPresent(site3.name)).toBe(false, `${site3.name} displayed`);
|
|
expect(await dataTable.isItemPresent(site4.name)).toBe(true, `${site4.name} not displayed`);
|
|
});
|
|
|
|
it('[C290015] Results page title', async () => {
|
|
await toolbar.clickSearchIconButton();
|
|
await searchInput.clickSearchButton();
|
|
await searchInput.checkLibraries();
|
|
await searchInput.searchForLibrary(random);
|
|
await dataTable.waitForBody();
|
|
|
|
expect(await page.breadcrumb.currentItem.getText()).toEqual('Libraries found...');
|
|
});
|
|
|
|
it('[C290016] Results page columns', async () => {
|
|
await toolbar.clickSearchIconButton();
|
|
await searchInput.clickSearchButton();
|
|
await searchInput.checkLibraries();
|
|
await searchInput.searchForLibrary(site1.name);
|
|
await dataTable.waitForBody();
|
|
|
|
const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility'];
|
|
const actualColumns = await dataTable.getColumnHeadersText();
|
|
|
|
await expect(actualColumns).toEqual(expectedColumns);
|
|
});
|
|
|
|
it('[C290017] Library visibility is correctly displayed', async () => {
|
|
await toolbar.clickSearchIconButton();
|
|
await searchInput.clickSearchButton();
|
|
await searchInput.checkLibraries();
|
|
await searchInput.searchForLibrary(`user-site-${random}`);
|
|
await dataTable.waitForBody();
|
|
|
|
const expectedSitesVisibility = {
|
|
[userSitePrivate]: SITE_VISIBILITY.PRIVATE,
|
|
[userSiteModerated]: SITE_VISIBILITY.MODERATED,
|
|
[userSitePublic]: SITE_VISIBILITY.PUBLIC
|
|
};
|
|
|
|
const sitesList = await dataTable.getSitesNameAndVisibility();
|
|
|
|
for (const site of Object.keys(expectedSitesVisibility)) {
|
|
expect(sitesList[site]).toEqual(expectedSitesVisibility[site]);
|
|
}
|
|
});
|
|
|
|
it('[C290018] User role is correctly displayed', async () => {
|
|
await toolbar.clickSearchIconButton();
|
|
await searchInput.clickSearchButton();
|
|
await searchInput.checkLibraries();
|
|
await searchInput.searchForLibrary(`admin-${random}-site`);
|
|
await dataTable.waitForBody();
|
|
|
|
const expectedSitesRoles = {
|
|
[adminSite1]: SITE_ROLES.SITE_CONSUMER.LABEL,
|
|
[adminSite2]: SITE_ROLES.SITE_CONTRIBUTOR.LABEL,
|
|
[adminSite3]: SITE_ROLES.SITE_COLLABORATOR.LABEL,
|
|
[adminSite4]: SITE_ROLES.SITE_MANAGER.LABEL
|
|
};
|
|
|
|
const sitesList: any = await dataTable.getSitesNameAndRole();
|
|
|
|
for (const site of Object.keys(expectedSitesRoles)) {
|
|
expect(sitesList[site]).toEqual(expectedSitesRoles[site]);
|
|
}
|
|
});
|
|
|
|
it('[C290019] Private sites are not displayed when user is not a member', async () => {
|
|
await toolbar.clickSearchIconButton();
|
|
await searchInput.clickSearchButton();
|
|
await searchInput.checkLibraries();
|
|
await searchInput.searchForLibrary(`admin-${random}-site`);
|
|
await dataTable.waitForBody();
|
|
|
|
expect(await dataTable.isItemPresent(adminPrivate)).toBe(false, `${adminPrivate} is displayed`);
|
|
});
|
|
|
|
it('[C290028] Search libraries with special characters', async () => {
|
|
await toolbar.clickSearchIconButton();
|
|
await searchInput.clickSearchButton();
|
|
await searchInput.checkLibraries();
|
|
await searchInput.searchForLibrary(siteRussian.name);
|
|
await dataTable.waitForBody();
|
|
|
|
expect(await dataTable.isItemPresent(siteRussian.name)).toBe(true, `${siteRussian.name} not displayed`);
|
|
});
|
|
});
|