diff --git a/e2e/components/sidenav/sidenav.ts b/e2e/components/sidenav/sidenav.ts index 4809e2c368..145c772e4b 100755 --- a/e2e/components/sidenav/sidenav.ts +++ b/e2e/components/sidenav/sidenav.ts @@ -36,6 +36,7 @@ export class Sidenav extends Component { label: '.item--label', expansion_panel: ".mat-expansion-panel-header", expansion_panel_content: ".mat-expansion-panel-body", + active: 'item--active', activeLink: '.item--active', newButton: '[data-automation-id="create-button"]' }; @@ -50,6 +51,23 @@ export class Sidenav extends Component { super(Sidenav.selectors.root, ancestor); } + private async expandMenu(name: string) { + try{ + + if (await element(by.cssContainingText('.mat-expanded', name)).isPresent()) { + return Promise.resolve(); + } else { + const link = this.getLink(name); + await Utils.waitUntilElementClickable(link); + await link.click(); + await element(by.css(Sidenav.selectors.expansion_panel_content)).isPresent(); + } + + } catch (e) { + console.log('---- sidebar navigation catch expandMenu: ', e); + } + } + async openNewMenu() { const { menu, newButton } = this; @@ -67,38 +85,40 @@ export class Sidenav extends Component { await this.menu.clickMenuItem('Create Library'); } - async isActiveByLabel(label: string) { - const className = await this.getLinkByLabel(label).getAttribute('class'); - return className.includes(Sidenav.selectors.activeLink.replace('.', '')); + async isActive(name: string) { + const className = await this.getLinkLabel(name).getAttribute('class'); + return className.includes(Sidenav.selectors.active); } - async childIsActiveByLabel(label: string) { - const labelElement = await this.getLinkByLabel(label).element(by.css('span')); - return (await labelElement.getAttribute('class')) - .includes(Sidenav.selectors.activeLink.replace('.', '')); + async childIsActive(name: string) { + const childClass = await this.getLinkLabel(name).element(by.css('span')).getAttribute('class'); + return childClass.includes(Sidenav.selectors.active); } - getLink(label: string) { - return this.component.element(by.cssContainingText(Sidenav.selectors.link, label)); + getLink(name: string) { + return this.getLinkLabel(name).element(by.xpath('..')); } - getLinkByLabel(label: string) { - return this.component.element(by.cssContainingText(Sidenav.selectors.label, label)); - // return browser.element(by.xpath(`.//*[.="${label}" and class="${Sidenav.selectors.label}"]`)) + getLinkLabel(name: string) { + return this.component.element(by.cssContainingText(Sidenav.selectors.label, name)); } - async getLinkTooltip(label: string) { - return await this.getLink(label).getAttribute('title'); + getActiveLink() { + return this.activeLink; } - async navigateToLinkByLabel(label: string) { + async getLinkTooltip(name: string) { + return await this.getLink(name).getAttribute('title'); + } + + async navigateToLink(name: string) { try{ - const link = this.getLinkByLabel(label); + const link = this.getLinkLabel(name); await Utils.waitUntilElementClickable(link); return await link.click(); } catch (e){ - console.log('---- sidebar navigation catch navigateToLinkByLabel: ', e); + console.log('---- sidebar navigation catch navigateToLink: ', e); } } @@ -106,21 +126,8 @@ export class Sidenav extends Component { return await element(by.cssContainingText('.mat-expanded', SIDEBAR_LABELS.FILE_LIBRARIES)).isPresent(); } - async expandMenu(label: string) { - try{ - - if (await element(by.cssContainingText('.mat-expanded', label)).isPresent()) { - return Promise.resolve(); - } else { - const link = this.getLinkByLabel(label); - await Utils.waitUntilElementClickable(link); - await link.click(); - await element(by.css(Sidenav.selectors.expansion_panel_content)).isPresent(); - } - - } catch (e) { - console.log('---- sidebar navigation catch expandMenu: ', e); - } + async expandFileLibraries() { + return await this.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES); } } diff --git a/e2e/configs.ts b/e2e/configs.ts index fad88fc7a4..18f23a8859 100755 --- a/e2e/configs.ts +++ b/e2e/configs.ts @@ -46,6 +46,7 @@ export const E2E_ROOT_PATH = __dirname; export const APP_ROUTES = { FAVORITES: '/favorites', MY_LIBRARIES: '/libraries', + FAVORITE_LIBRARIES: '/favorite/libraries', LOGIN: '/login', LOGOUT: '/logout', PERSONAL_FILES: '/personal-files', @@ -70,7 +71,8 @@ export const SIDEBAR_LABELS = { export const PAGE_TITLES = { VIEWER: 'Preview', SEARCH: 'Search Results', - MY_LIBRARIES: 'File Libraries' + MY_LIBRARIES: 'My Libraries', + FAVORITE_LIBRARIES: 'Favorite Libraries' }; // Site visibility @@ -82,10 +84,22 @@ export const SITE_VISIBILITY = { // Site roles export const SITE_ROLES = { - SITE_CONSUMER: 'SiteConsumer', - SITE_COLLABORATOR: 'SiteCollaborator', - SITE_CONTRIBUTOR: 'SiteContributor', - SITE_MANAGER: 'SiteManager' + SITE_CONSUMER: { + ROLE: 'SiteConsumer', + LABEL: 'Consumer' + }, + SITE_COLLABORATOR: { + ROLE: 'SiteCollaborator', + LABEL: 'Collaborator' + }, + SITE_CONTRIBUTOR: { + ROLE: 'SiteContributor', + LABEL: 'Contributor' + }, + SITE_MANAGER: { + ROLE: 'SiteManager', + LABEL: 'Manager' + } }; export const FILES = { diff --git a/e2e/pages/browsing-page.ts b/e2e/pages/browsing-page.ts index 084643d700..31b25dd903 100755 --- a/e2e/pages/browsing-page.ts +++ b/e2e/pages/browsing-page.ts @@ -43,75 +43,75 @@ export class BrowsingPage extends Page { // helper methods async clickPersonalFilesAndWait() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.PERSONAL_FILES); await this.dataTable.waitForHeader(); } async clickPersonalFiles() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.PERSONAL_FILES); } async clickFileLibrariesAndWait() { - await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES); - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.MY_LIBRARIES); + await this.sidenav.expandFileLibraries(); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.MY_LIBRARIES); await this.dataTable.waitForHeader(); } async clickFileLibraries() { - await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES); - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.MY_LIBRARIES); + await this.sidenav.expandFileLibraries(); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.MY_LIBRARIES); } - async clickFavoriteLibraries() { - await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES); - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITE_LIBRARIES); + async goToFavoriteLibraries() { + await this.sidenav.expandFileLibraries(); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.FAVORITE_LIBRARIES); } - async clickMyLibraries() { + async goToMyLibraries() { if ( !(await this.sidenav.isFileLibrariesMenuExpanded()) ) { - await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES); + await this.sidenav.expandFileLibraries(); } - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.MY_LIBRARIES); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.MY_LIBRARIES); } async clickRecentFilesAndWait() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.RECENT_FILES); await this.dataTable.waitForHeader(); } async clickRecentFiles() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.RECENT_FILES); } async clickSharedFilesAndWait() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.SHARED_FILES); await this.dataTable.waitForHeader(); } async clickSharedFiles() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.SHARED_FILES); } async clickFavoritesAndWait() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.FAVORITES); await this.dataTable.waitForHeader(); } async clickFavorites() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.FAVORITES); } async clickTrashAndWait() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.TRASH); await this.dataTable.waitForHeader(); } async clickTrash() { - await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); + await this.sidenav.navigateToLink(SIDEBAR_LABELS.TRASH); } } diff --git a/e2e/suites/actions/context-menu-single-selection.test.ts b/e2e/suites/actions/context-menu-single-selection.test.ts index 90a8b8a618..19b1a53c0c 100755 --- a/e2e/suites/actions/context-menu-single-selection.test.ts +++ b/e2e/suites/actions/context-menu-single-selection.test.ts @@ -122,7 +122,7 @@ describe('Context menu actions - single selection : ', () => { it('Context menu closes when clicking away from it - [C280619]', async () => { await dataTable.rightClickOnItem(fileUser); expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); - await page.sidenav.activeLink.click(); + await page.sidenav.getActiveLink().click(); expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed'); }); diff --git a/e2e/suites/actions/create-folder.test.ts b/e2e/suites/actions/create-folder.test.ts index 1dec61ebe0..03a588e91e 100755 --- a/e2e/suites/actions/create-folder.test.ts +++ b/e2e/suites/actions/create-folder.test.ts @@ -59,7 +59,7 @@ describe('Create folder', () => { await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE); const docLibId = (await apis.admin.sites.getDocLibId(siteName)); await apis.admin.nodes.createFolder(folderName1, docLibId); - await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER); + await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER.ROLE); parentId = (await apis.user.nodes.createFolder(parent)).entry.id; await apis.user.nodes.createFolder(duplicateFolderName, parentId); await loginPage.loginWith(username); diff --git a/e2e/suites/actions/edit-folder.test.ts b/e2e/suites/actions/edit-folder.test.ts index 3260c16ca0..234bea58fa 100755 --- a/e2e/suites/actions/edit-folder.test.ts +++ b/e2e/suites/actions/edit-folder.test.ts @@ -61,7 +61,7 @@ describe('Edit folder', () => { await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE); const docLibId = await apis.admin.sites.getDocLibId(siteName); await apis.admin.nodes.createFolder(folderName, docLibId); - await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER); + await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER.ROLE); parentId = (await apis.user.nodes.createFolder(parent)).entry.id; await apis.user.nodes.createFolder(folderName, parentId, '', folderDescription); diff --git a/e2e/suites/actions/restore.test.ts b/e2e/suites/actions/restore.test.ts index 0fceb718a4..787d8f630a 100755 --- a/e2e/suites/actions/restore.test.ts +++ b/e2e/suites/actions/restore.test.ts @@ -123,7 +123,7 @@ describe('Restore from Trash', () => { await toolbar.getButtonByTitleAttribute('Restore').click(); await page.clickSnackBarAction(); await page.dataTable.waitForHeader(); - expect(await page.sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Personal Files sidebar link not active'); + expect(await page.sidenav.isActive('Personal Files')).toBe(true, 'Personal Files sidebar link not active'); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); await apis.user.nodes.deleteNodeById(fileId, false); diff --git a/e2e/suites/actions/special-permissions-available-actions.test.ts b/e2e/suites/actions/special-permissions-available-actions.test.ts index 35c0d046f8..4664cbca2b 100755 --- a/e2e/suites/actions/special-permissions-available-actions.test.ts +++ b/e2e/suites/actions/special-permissions-available-actions.test.ts @@ -77,10 +77,10 @@ describe('Granular permissions available actions : ', () => { docxFileId = (await apis.admin.upload.uploadFile(docxFile, docLibId)).entry.id; - await apis.admin.sites.addSiteMember(siteName, userManager, SITE_ROLES.SITE_MANAGER); - await apis.admin.sites.addSiteMember(siteName, userConsumer, SITE_ROLES.SITE_CONSUMER); + await apis.admin.sites.addSiteMember(siteName, userManager, SITE_ROLES.SITE_MANAGER.ROLE); + await apis.admin.sites.addSiteMember(siteName, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE); - await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER); + await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE); await apis.userConsumer.shared.shareFileById(file1Id); await apis.userConsumer.shared.shareFileById(file2Id); diff --git a/e2e/suites/actions/toolbar-single-selection.test.ts b/e2e/suites/actions/toolbar-single-selection.test.ts index 7d3313a0c2..838ffe2691 100755 --- a/e2e/suites/actions/toolbar-single-selection.test.ts +++ b/e2e/suites/actions/toolbar-single-selection.test.ts @@ -90,10 +90,28 @@ describe('Toolbar actions - single selection : ', () => { xit(''); describe('General tests', () => { - it('actions are displayed for top level of File Libraries - [C213135]', async () => { - await page.clickFileLibrariesAndWait(); + beforeEach(async (done) => { + await Utils.pressEscape(); + await dataTable.clearSelection(); + done(); + }); + + it('Correct actions appear when a library is selected - My Libraries - [C213135]', async () => { + await page.goToMyLibraries(); await dataTable.selectItem(siteName); expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed'); + expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${siteName}`); + await toolbar.openMoreMenu(); + expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${siteName}`); + }); + + it('Correct actions appear when a library is selected - Favorite Libraries - [C289892]', async () => { + await page.goToFavoriteLibraries(); + await dataTable.selectItem(siteName); + expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed'); + expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${siteName}`); + await toolbar.openMoreMenu(); + expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${siteName}`); }); it('selected row is marked with a check circle icon - [C213134]', async () => { @@ -103,7 +121,7 @@ describe('Toolbar actions - single selection : ', () => { }); }); - describe('Personal Files', () => { + describe('on Personal Files', () => { beforeEach(async (done) => { await Utils.pressEscape(); await page.clickPersonalFilesAndWait(); @@ -144,7 +162,7 @@ describe('Toolbar actions - single selection : ', () => { }); }); - describe('File Libraries', () => { + describe('on File Libraries', () => { beforeEach(async (done) => { await Utils.pressEscape(); await page.clickFileLibrariesAndWait(); @@ -187,7 +205,7 @@ describe('Toolbar actions - single selection : ', () => { }); }); - describe('Shared Files', () => { + describe('on Shared Files', () => { beforeEach(async (done) => { await Utils.pressEscape(); await page.clickSharedFilesAndWait(); @@ -215,7 +233,7 @@ describe('Toolbar actions - single selection : ', () => { }); }); - describe('Recent Files', () => { + describe('on Recent Files', () => { beforeEach(async (done) => { await Utils.pressEscape(); await page.clickRecentFilesAndWait(); @@ -242,7 +260,7 @@ describe('Toolbar actions - single selection : ', () => { }); }); - describe('Favorites', () => { + describe('on Favorites', () => { beforeEach(async (done) => { await Utils.pressEscape(); await page.clickFavoritesAndWait(); @@ -283,7 +301,7 @@ describe('Toolbar actions - single selection : ', () => { }); }); - describe('Trash', () => { + describe('on Trash', () => { beforeEach(async (done) => { await Utils.pressEscape(); await page.clickTrashAndWait(); diff --git a/e2e/suites/actions/unshare-file.test.ts b/e2e/suites/actions/unshare-file.test.ts index c2283ed195..c7b6f7b038 100755 --- a/e2e/suites/actions/unshare-file.test.ts +++ b/e2e/suites/actions/unshare-file.test.ts @@ -711,7 +711,7 @@ describe('Unshare a file', () => { file1Id = (await apis.admin.nodes.createFile(file1, docLibId)).entry.id; file2Id = (await apis.admin.nodes.createFile(file2, docLibId)).entry.id; - await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER); + await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE); await apis.admin.shared.shareFileById(file1Id); await apis.user.shared.shareFileById(file2Id); diff --git a/e2e/suites/application/page-titles.test.ts b/e2e/suites/application/page-titles.test.ts index 6631214c8a..fca711230a 100755 --- a/e2e/suites/application/page-titles.test.ts +++ b/e2e/suites/application/page-titles.test.ts @@ -76,44 +76,45 @@ describe('Page titles', () => { it('Personal Files page - [C217157]', async () => { const label = SIDEBAR_LABELS.PERSONAL_FILES; - await page.sidenav.navigateToLinkByLabel(label); + await page.sidenav.navigateToLink(label); expect(await browser.getTitle()).toContain(label); }); - it('File Libraries page - [C217158]', async () => { - const parent = SIDEBAR_LABELS.FILE_LIBRARIES; - const label = SIDEBAR_LABELS.MY_LIBRARIES; - - await page.sidenav.expandMenu(parent); - await page.sidenav.navigateToLinkByLabel(label); + it('My Libraries page - [C217158]', async () => { + await page.goToMyLibraries(); expect(await browser.getTitle()).toContain(PAGE_TITLES.MY_LIBRARIES); }); + it('Favorite Libraries page - [C289907]', async () => { + await page.goToFavoriteLibraries(); + expect(await browser.getTitle()).toContain(PAGE_TITLES.FAVORITE_LIBRARIES); + }); + it('Shared Files page - [C217159]', async () => { const label = SIDEBAR_LABELS.SHARED_FILES; - await page.sidenav.navigateToLinkByLabel(label); + await page.sidenav.navigateToLink(label); expect(await browser.getTitle()).toContain(label); }); it('Recent Files page - [C217160]', async () => { const label = SIDEBAR_LABELS.RECENT_FILES; - await page.sidenav.navigateToLinkByLabel(label); + await page.sidenav.navigateToLink(label); expect(await browser.getTitle()).toContain(label); }); it('Favorites page - [C217161]', async () => { const label = SIDEBAR_LABELS.FAVORITES; - await page.sidenav.navigateToLinkByLabel(label); + await page.sidenav.navigateToLink(label); expect(await browser.getTitle()).toContain(label); }); it('Trash page - [C217162]', async () => { const label = SIDEBAR_LABELS.TRASH; - await page.sidenav.navigateToLinkByLabel(label); + await page.sidenav.navigateToLink(label); expect(await browser.getTitle()).toContain(label); }); diff --git a/e2e/suites/info-drawer/library-properties.test.ts b/e2e/suites/info-drawer/library-properties.test.ts index fe67eb3f08..63a7de6f3d 100755 --- a/e2e/suites/info-drawer/library-properties.test.ts +++ b/e2e/suites/info-drawer/library-properties.test.ts @@ -75,8 +75,8 @@ describe('Library properties', () => { await apis.user.sites.createSite(siteForUpdate.name, siteForUpdate.visibility, siteForUpdate.description, siteForUpdate.id); await apis.user.sites.createSite(siteDup); - await apis.user.sites.addSiteMember(site.id, user2, SITE_ROLES.SITE_COLLABORATOR); - await apis.user.sites.addSiteMember(site.id, user3, SITE_ROLES.SITE_MANAGER); + await apis.user.sites.addSiteMember(site.id, user2, SITE_ROLES.SITE_COLLABORATOR.ROLE); + await apis.user.sites.addSiteMember(site.id, user3, SITE_ROLES.SITE_MANAGER.ROLE); await loginPage.loginWith(username); done(); @@ -250,7 +250,7 @@ describe('Library properties', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickButton('Edit'); - await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER); + await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER.ROLE); await infoDrawer.enterDescription('new description'); await infoDrawer.clickButton('Update'); diff --git a/e2e/suites/list-views/empty-list.test.ts b/e2e/suites/list-views/empty-list.test.ts index 725327c872..a677465878 100755 --- a/e2e/suites/list-views/empty-list.test.ts +++ b/e2e/suites/list-views/empty-list.test.ts @@ -52,13 +52,20 @@ describe('Empty list views', () => { expect(await dataTable.getEmptyDragAndDropText()).toContain('Drag and drop'); }); - it('empty File Libraries - [C217099]', async () => { - await page.clickFileLibraries(); + it('empty My Libraries - [C217099]', async () => { + await page.goToMyLibraries(); expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`); expect(await dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.'); }); + it('empty Favorite Libraries - [C289911]', async () => { + await page.goToFavoriteLibraries(); + expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.getEmptyStateTitle()).toContain(`No Favorite Libraries`); + expect(await dataTable.getEmptyStateSubtitle()).toContain('Favorite a library that you want to find easily later.'); + }); + it('empty Shared Files - [C280132]', async () => { await page.clickSharedFiles(); expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); diff --git a/e2e/suites/list-views/favorites.test.ts b/e2e/suites/list-views/favorites.test.ts index d4f4426715..d210203e32 100755 --- a/e2e/suites/list-views/favorites.test.ts +++ b/e2e/suites/list-views/favorites.test.ts @@ -53,7 +53,7 @@ describe('Favorites', () => { await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); const docLibId = await apis.admin.sites.getDocLibId(siteName); - await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER); + await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER.ROLE); const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).entry.id; const folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id; @@ -135,7 +135,7 @@ describe('Favorites', () => { it('Location column redirect - file in site - [C280485]', async () => { await dataTable.clickItemLocation(fileName1); - expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]); + expect(await breadcrumb.getAllItems()).toEqual([ 'My Libraries', siteName ]); }); it('Navigate into folder from Favorites - [C213230]', async () => { diff --git a/e2e/suites/list-views/file-libraries.test.ts b/e2e/suites/list-views/file-libraries.test.ts index a329c61c06..5de73cc6e4 100755 --- a/e2e/suites/list-views/file-libraries.test.ts +++ b/e2e/suites/list-views/file-libraries.test.ts @@ -32,13 +32,21 @@ describe('File Libraries', () => { const username = `user-${Utils.random()}`; const password = username; - const sitePrivate = `private-${Utils.random()}`; - const siteModerated = `moderated-${Utils.random()}`; - const sitePublic = `public-${Utils.random()}`; + const userSitePrivate = `user-private-${Utils.random()}`; + const userSiteModerated = `user-moderated-${Utils.random()}`; + const userSitePublic = `user-public-${Utils.random()}`; + const siteName = `siteName-${Utils.random()}`; + const siteId1 = Utils.random(); const siteId2 = Utils.random(); - const adminSite = `admin-${Utils.random()}`; + + const adminSite1 = `admin1-${Utils.random()}`; + const adminSite2 = `admin2-${Utils.random()}`; + const adminSite3 = `admin3-${Utils.random()}`; + const adminSite4 = `admin4-${Utils.random()}`; + const adminSite5 = `admin5-${Utils.random()}`; + const adminSite6 = `admin6-${Utils.random()}`; const siteDescription = 'my site description'; @@ -53,86 +61,214 @@ describe('File Libraries', () => { beforeAll(async (done) => { await apis.admin.people.createUser({ username }); - await apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC); - await apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, siteDescription); - await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, null); - await apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC); - await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1); - await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2); - await apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER); - await apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER); - await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR); - await apis.admin.sites.addSiteMember(siteId1, username, SITE_ROLES.SITE_CONTRIBUTOR); - await apis.admin.sites.addSiteMember(siteId2, username, SITE_ROLES.SITE_CONTRIBUTOR); - await loginPage.loginWith(username); - done(); - }); + await apis.user.sites.createSite(userSitePublic, SITE_VISIBILITY.PUBLIC); + await apis.user.sites.createSite(userSiteModerated, SITE_VISIBILITY.MODERATED, siteDescription); + await apis.user.sites.createSite(userSitePrivate, SITE_VISIBILITY.PRIVATE, null); - beforeEach(async (done) => { - await page.clickFileLibrariesAndWait(); + await apis.admin.sites.createSite(adminSite1, SITE_VISIBILITY.PUBLIC); + await apis.admin.sites.createSite(adminSite2, SITE_VISIBILITY.PUBLIC); + await apis.admin.sites.createSite(adminSite3, SITE_VISIBILITY.PUBLIC); + await apis.admin.sites.createSite(adminSite4, SITE_VISIBILITY.PUBLIC); + await apis.admin.sites.createSite(adminSite5, SITE_VISIBILITY.PUBLIC); + await apis.admin.sites.createSite(adminSite6, SITE_VISIBILITY.PUBLIC); + await apis.admin.sites.addSiteMember(adminSite1, username, SITE_ROLES.SITE_CONSUMER.ROLE); + await apis.admin.sites.addSiteMember(adminSite2, username, SITE_ROLES.SITE_CONTRIBUTOR.ROLE); + await apis.admin.sites.addSiteMember(adminSite3, username, SITE_ROLES.SITE_COLLABORATOR.ROLE); + await apis.admin.sites.addSiteMember(adminSite4, username, SITE_ROLES.SITE_MANAGER.ROLE); + await apis.admin.sites.addSiteMember(adminSite6, username, SITE_ROLES.SITE_CONSUMER.ROLE); + + await apis.user.favorites.addFavoriteById('site', adminSite1); + await apis.user.favorites.addFavoriteById('site', adminSite2); + await apis.user.favorites.addFavoriteById('site', adminSite3); + await apis.user.favorites.addFavoriteById('site', adminSite4); + + await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1); + await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2); + + await loginPage.loginWith(username); done(); }); afterAll(async (done) => { - await apis.admin.sites.deleteSites([ sitePublic, siteModerated, sitePrivate, adminSite, siteId1, siteId2 ]); + await apis.user.sites.deleteSites([ userSitePublic, userSiteModerated, userSitePrivate, siteId1, siteId2 ]); + await apis.admin.sites.deleteSites([ adminSite1, adminSite2, adminSite3, adminSite4, adminSite5, adminSite6 ]); done(); }); - it('has the correct columns - [C217095]', async () => { - const labels = [ 'Name', 'My Role', 'Visibility' ]; - const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); + xit(''); + + describe('My Libraries', () => { + beforeEach(async (done) => { + await page.goToMyLibraries(); + done(); + }); - expect(await dataTable.getColumnHeaders().count()).toBe(3 + 1, 'Incorrect number of columns'); + it('has the correct columns - [C217095]', async () => { + const labels = [ 'Name', 'My Role', 'Visibility' ]; + const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); - await elements.forEach(async (element, index) => { - expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`); + expect(await dataTable.getColumnHeaders().count()).toBe(3 + 1, 'Incorrect number of columns'); + + await elements.forEach(async (element, index) => { + expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`); + }); }); - }); - it('User can see only the sites he is a member of - [C280501]', async () => { - const sitesCount = await dataTable.countRows(); + it('User can see only the sites he is a member of - [C280501]', async () => { + const sitesCount = await dataTable.countRows(); + + expect(sitesCount).toEqual(10, 'Incorrect number of sites displayed'); + expect(await dataTable.getRowByName(adminSite5).isPresent()).toBe(false, `${adminSite5} should not appear in the list`); + }); - const expectedSites = { - [sitePrivate]: SITE_VISIBILITY.PRIVATE, - [siteModerated]: SITE_VISIBILITY.MODERATED, - [sitePublic]: SITE_VISIBILITY.PUBLIC - }; + it('Library visibility is correctly displayed - [C289905]', async () => { + const expectedSitesVisibility = { + [userSitePrivate]: SITE_VISIBILITY.PRIVATE, + [userSiteModerated]: SITE_VISIBILITY.MODERATED, + [userSitePublic]: SITE_VISIBILITY.PUBLIC + }; - expect(sitesCount).toEqual(5, 'Incorrect number of sites displayed'); - expect(await dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list'); + const rowCells = await dataTable.getRows().map((row) => { + return row.all(dataTable.cell).map(async cell => await cell.getText()); + }); + const sitesList = rowCells.reduce((acc, cell) => { + acc[cell[1]] = cell[3].toUpperCase(); + return acc; + }, {}); - const rowCells = await dataTable.getRows().map((row) => { - return row.all(dataTable.cell).map(async cell => await cell.getText()); + Object.keys(expectedSitesVisibility).forEach((site) => { + expect(sitesList[site]).toEqual(expectedSitesVisibility[site]); + }); }); - const sitesList = rowCells.reduce((acc, cell) => { - acc[cell[1]] = cell[3].toUpperCase(); - return acc; - }, {}); - Object.keys(expectedSites).forEach((site) => { - expect(sitesList[site]).toEqual(expectedSites[site]); + it('User role is correctly displayed - [C289903]', async () => { + 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 rowCells = await dataTable.getRows().map((row) => { + return row.all(dataTable.cell).map(async cell => await cell.getText()); + }); + const sitesList = rowCells.reduce((acc, cell) => { + acc[cell[1]] = cell[2]; + return acc; + }, {}); + + Object.keys(expectedSitesRoles).forEach((site) => { + expect(sitesList[site]).toEqual(expectedSitesRoles[site]); + }); }); - }); - it('Site ID is displayed when two sites have the same name - [C217098]', async () => { - const expectedSites = [ - `${siteName} (${siteId1})`, - `${siteName} (${siteId2})` - ]; - const cells = await dataTable.getCellsContainingName(siteName); - const expectedJSON = JSON.stringify(expectedSites.sort()); - const actualJSON = JSON.stringify(cells.sort()); - expect(actualJSON).toEqual(expectedJSON); - }); + it('Site ID is displayed when two sites have the same name - [C217098]', async () => { + const expectedSites = [ + `${siteName} (${siteId1})`, + `${siteName} (${siteId2})` + ]; + const cells = await dataTable.getCellsContainingName(siteName); + const expectedJSON = JSON.stringify(expectedSites.sort()); + const actualJSON = JSON.stringify(cells.sort()); + expect(actualJSON).toEqual(expectedJSON); + }); + + it('Tooltip for sites without description - [C217096]', async () => { + const tooltip = await dataTable.getItemNameTooltip(userSitePrivate); + expect(tooltip).toBe(`${userSitePrivate}`); + }); - it('Tooltip for sites without description - [C217096]', async () => { - const tooltip = await dataTable.getItemNameTooltip(sitePrivate); - expect(tooltip).toBe(`${sitePrivate}`); + it('Tooltip for sites with description - [C217097]', async () => { + const tooltip = await dataTable.getItemNameTooltip(userSiteModerated); + expect(tooltip).toBe(`${siteDescription}`); + }); }); - it('Tooltip for sites with description - [C217097]', async () => { - const tooltip = await dataTable.getItemNameTooltip(siteModerated); - expect(tooltip).toBe(`${siteDescription}`); + describe('Favorite Libraries', () => { + beforeEach(async (done) => { + await page.goToFavoriteLibraries(); + done(); + }); + + it('has the correct columns - [C289893]', async () => { + const labels = [ 'Name', 'My Role', 'Visibility' ]; + const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); + + expect(await dataTable.getColumnHeaders().count()).toBe(3 + 1, 'Incorrect number of columns'); + + await elements.forEach(async (element, index) => { + expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`); + }); + }); + + it('User can see only his favorite sites - [C289897]', async () => { + const sitesCount = await dataTable.countRows(); + + expect(sitesCount).toEqual(9, 'Incorrect number of sites displayed'); + expect(await dataTable.getRowByName(adminSite6).isPresent()).toBe(false, `${adminSite6} should not appear`); + }); + + it('Library visibility is correctly displayed - [C289906]', async () => { + const expectedSitesVisibility = { + [userSitePrivate]: SITE_VISIBILITY.PRIVATE, + [userSiteModerated]: SITE_VISIBILITY.MODERATED, + [userSitePublic]: SITE_VISIBILITY.PUBLIC + }; + + const rowCells = await dataTable.getRows().map((row) => { + return row.all(dataTable.cell).map(async cell => await cell.getText()); + }); + const sitesList = rowCells.reduce((acc, cell) => { + acc[cell[1]] = cell[3].toUpperCase(); + return acc; + }, {}); + + Object.keys(expectedSitesVisibility).forEach((site) => { + expect(sitesList[site]).toEqual(expectedSitesVisibility[site]); + }); + }); + + it('User role is correctly displayed - [C289904]', async () => { + 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 rowCells = await dataTable.getRows().map((row) => { + return row.all(dataTable.cell).map(async cell => await cell.getText()); + }); + const sitesList = rowCells.reduce((acc, cell) => { + acc[cell[1]] = cell[2]; + return acc; + }, {}); + + Object.keys(expectedSitesRoles).forEach((site) => { + expect(sitesList[site]).toEqual(expectedSitesRoles[site]); + }); + }); + + it('Site ID is displayed when two sites have the same name - [C289896]', async () => { + const expectedSites = [ + `${siteName} (${siteId1})`, + `${siteName} (${siteId2})` + ]; + const cells = await dataTable.getCellsContainingName(siteName); + const expectedJSON = JSON.stringify(expectedSites.sort()); + const actualJSON = JSON.stringify(cells.sort()); + expect(actualJSON).toEqual(expectedJSON); + }); + + it('Tooltip for sites without description - [C289894]', async () => { + const tooltip = await dataTable.getItemNameTooltip(userSitePrivate); + expect(tooltip).toBe(`${userSitePrivate}`); + }); + + it('Tooltip for sites with description - [C289895]', async () => { + const tooltip = await dataTable.getItemNameTooltip(userSiteModerated); + expect(tooltip).toBe(`${siteDescription}`); + }); }); }); diff --git a/e2e/suites/list-views/permissions.test.ts b/e2e/suites/list-views/permissions.test.ts index c42e8434ad..44c0be41b6 100755 --- a/e2e/suites/list-views/permissions.test.ts +++ b/e2e/suites/list-views/permissions.test.ts @@ -55,7 +55,7 @@ describe('Special permissions', () => { beforeAll(async (done) => { await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE); - await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR); + await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE); const docLibId = await apis.admin.sites.getDocLibId(sitePrivate); fileId = (await apis.admin.nodes.createFile(fileName, docLibId)).entry.id; await apis.user.favorites.addFavoriteById('file', fileId); @@ -70,7 +70,7 @@ describe('Special permissions', () => { }); afterEach(async (done) => { - await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR); + await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE); done(); }); @@ -111,7 +111,7 @@ describe('Special permissions', () => { beforeAll(async (done) => { await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE); - await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR); + await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE); const docLibId = await apis.admin.sites.getDocLibId(sitePrivate); fileId = (await apis.user.nodes.createFile(fileName, docLibId)).entry.id; await apis.user.favorites.addFavoriteById('file', fileId); diff --git a/e2e/suites/list-views/personal-files.test.ts b/e2e/suites/list-views/personal-files.test.ts index 8cabd3255c..7bb0752115 100755 --- a/e2e/suites/list-views/personal-files.test.ts +++ b/e2e/suites/list-views/personal-files.test.ts @@ -79,8 +79,8 @@ describe('Personal Files', () => { }); it('has Data Dictionary and created content - [C213241]', async () => { - expect(await dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true); - expect(await dataTable.getRowByName(adminFolder).isPresent()).toBe(true); + expect(await dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true, 'Data Dictionary not displayed'); + expect(await dataTable.getRowByName(adminFolder).isPresent()).toBe(true, 'admin folder not displayed'); }); }); @@ -111,7 +111,7 @@ describe('Personal Files', () => { }); it('has user created content - [C213242]', async () => { - expect(await dataTable.getRowByName(userFolder).isPresent()).toBe(true); + expect(await dataTable.getRowByName(userFolder).isPresent()).toBe(true, 'user folder not displayed'); }); it('navigates to folder - [C213244]', async () => { diff --git a/e2e/suites/list-views/recent-files.test.ts b/e2e/suites/list-views/recent-files.test.ts index 112c4df328..44de6ae22a 100755 --- a/e2e/suites/list-views/recent-files.test.ts +++ b/e2e/suites/list-views/recent-files.test.ts @@ -131,6 +131,6 @@ describe('Recent Files', () => { it('Location column redirect - file in site - [C280487]', async () => { await dataTable.clickItemLocation(fileSite); - expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName, folderSite ]); + expect(await breadcrumb.getAllItems()).toEqual([ 'My Libraries', siteName, folderSite ]); }); }); diff --git a/e2e/suites/list-views/shared-files.test.ts b/e2e/suites/list-views/shared-files.test.ts index 76c68a5a8a..94896fe2bf 100755 --- a/e2e/suites/list-views/shared-files.test.ts +++ b/e2e/suites/list-views/shared-files.test.ts @@ -53,7 +53,7 @@ describe('Shared Files', () => { beforeAll(async (done) => { await apis.admin.people.createUser({ username }); await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); - await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER); + await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER.ROLE); const docLibId = await apis.admin.sites.getDocLibId(siteName); const nodeId = (await apis.admin.nodes.createFile(fileAdmin, docLibId)).entry.id; await apis.admin.shared.shareFileById(nodeId); @@ -131,7 +131,7 @@ describe('Shared Files', () => { it('Location column redirect - file in site - [C280491]', async () => { await dataTable.clickItemLocation(fileAdmin); - expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]); + expect(await breadcrumb.getAllItems()).toEqual([ 'My Libraries', siteName ]); }); it('Location column displays a tooltip with the entire path of the file - [C213667]', async () => { diff --git a/e2e/suites/list-views/trash.test.ts b/e2e/suites/list-views/trash.test.ts index 8f7426dc30..8ad7a4437c 100755 --- a/e2e/suites/list-views/trash.test.ts +++ b/e2e/suites/list-views/trash.test.ts @@ -60,7 +60,7 @@ describe('Trash', () => { fileAdminId = (await apis.admin.nodes.createFiles([ fileAdmin ])).entry.id; folderAdminId = (await apis.admin.nodes.createFolders([ folderAdmin ])).entry.id; await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); - await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER); + await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER.ROLE); const docLibId = await apis.admin.sites.getDocLibId(siteName); fileSiteId = (await apis.admin.nodes.createFile(fileSite, docLibId)).entry.id; fileUserId = (await apis.user.nodes.createFiles([ fileUser ])).entry.id; @@ -186,7 +186,7 @@ describe('Trash', () => { it('Location column redirect - file in site - [C280497]', async () => { await dataTable.clickItemLocation(fileSite); - expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]); + expect(await breadcrumb.getAllItems()).toEqual([ 'My Libraries', siteName ]); }); }); }); diff --git a/e2e/suites/navigation/breadcrumb.test.ts b/e2e/suites/navigation/breadcrumb.test.ts index 7497001379..5e5abf4ac2 100755 --- a/e2e/suites/navigation/breadcrumb.test.ts +++ b/e2e/suites/navigation/breadcrumb.test.ts @@ -90,13 +90,13 @@ describe('Breadcrumb', () => { }); it('My Libraries breadcrumb main node - [C260966]', async () => { - await page.clickMyLibraries(); + await page.goToMyLibraries(); expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.getCurrentItemName()).toBe('My Libraries'); }); it('Favorite Libraries breadcrumb main node - [C289891]', async () => { - await page.clickFavoriteLibraries(); + await page.goToFavoriteLibraries(); expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(await breadcrumb.getCurrentItemName()).toBe('Favorite Libraries'); }); @@ -140,7 +140,7 @@ describe('Breadcrumb', () => { await page.dataTable.doubleClickOnRowByName(parent); await page.dataTable.doubleClickOnRowByName(subFolder1); await page.dataTable.doubleClickOnRowByName(subFolder2); - const expectedItems = [ 'File Libraries', siteName, parent, subFolder1, subFolder2 ]; + const expectedItems = [ 'My Libraries', siteName, parent, subFolder1, subFolder2 ]; expect(await breadcrumb.getAllItems()).toEqual(expectedItems); }); diff --git a/e2e/suites/navigation/sidebar.test.ts b/e2e/suites/navigation/sidebar.test.ts index 17a80605be..0c9700206c 100755 --- a/e2e/suites/navigation/sidebar.test.ts +++ b/e2e/suites/navigation/sidebar.test.ts @@ -40,77 +40,111 @@ describe('Sidebar', () => { it('has "Personal Files" as default - [C217149]', async () => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); - expect(await sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Active link'); + expect(await sidenav.isActive(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true, 'Active link'); }); - it('navigates to "File Libraries" - [C217150]', async () => { + it('File Libraries has correct sub-categories - [C217150]', async () => { await page.clickFileLibraries(); + expect(await sidenav.isFileLibrariesMenuExpanded()).toBe(true, 'File Libraries not expanded'); + expect(await sidenav.getLink(SIDEBAR_LABELS.MY_LIBRARIES).isPresent()).toBe(true, 'My Libraries link not present'); + expect(await sidenav.getLink(SIDEBAR_LABELS.FAVORITE_LIBRARIES).isPresent()).toBe(true, 'Favorite Libraries link not present'); + }); + + it('My Libraries is automatically selected on expanding File Libraries - [C289900]', async () => { + await page.clickFileLibraries(); + expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.MY_LIBRARIES); + expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries link not active'); + expect(await sidenav.childIsActive(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true, 'My Libraries link not active'); + }); + + it('navigate to Favorite Libraries - [C289902]', async () => { + await page.goToFavoriteLibraries(); + expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITE_LIBRARIES); + expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries link not active'); + expect(await sidenav.childIsActive(SIDEBAR_LABELS.FAVORITE_LIBRARIES)).toBe(true, 'Favorite Libraries link not active'); + }); + + it('navigate to My Libraries - [C289901]', async () => { + await page.goToMyLibraries(); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.MY_LIBRARIES); - expect(await sidenav.childIsActiveByLabel(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true); + expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries link not active'); + expect(await sidenav.childIsActive(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true, 'My Libraries link not active'); }); it('navigates to "Personal Files" - [C280409]', async () => { await page.clickPersonalFiles(); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); - expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true); + expect(await sidenav.isActive(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true, 'Personal Files link not active'); }); it('navigates to "Shared Files" - [C213110]', async () => { await page.clickSharedFiles(); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.SHARED_FILES); - expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.SHARED_FILES)).toBe(true); + expect(await sidenav.isActive(SIDEBAR_LABELS.SHARED_FILES)).toBe(true, 'Shared Files link not active'); }); it('navigates to "Recent Files" - [C213166]', async () => { await page.clickRecentFiles(); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.RECENT_FILES); - expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.RECENT_FILES)).toBe(true); + expect(await sidenav.isActive(SIDEBAR_LABELS.RECENT_FILES)).toBe(true, 'Recent Files link not active'); }); it('navigates to "Favorites" - [C213225]', async () => { await page.clickFavorites(); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITES); - expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.FAVORITES)).toBe(true); + expect(await sidenav.isActive(SIDEBAR_LABELS.FAVORITES)).toBe(true, 'Favorites link not active'); }); it('navigates to "Trash" - [C213216]', async () => { await page.clickTrash(); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.TRASHCAN); - expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.TRASH)).toBe(true); + expect(await sidenav.isActive(SIDEBAR_LABELS.TRASH)).toBe(true, 'Trash link not active'); }); // TODO: incomplete test - xit('Personal Files tooltip - [C217151]', async () => { + it('Personal Files tooltip - [C217151]', async () => { await page.clickPersonalFiles(); expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.PERSONAL_FILES)).toContain('View your Personal Files'); }); // TODO: incomplete test - xit('File Libraries tooltip - [C217152]', async () => { + it('File Libraries tooltip - [C217152]', async () => { await page.clickFileLibraries(); - expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FILE_LIBRARIES)).toContain('Access File Libraries'); + expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FILE_LIBRARIES)).toContain('File Libraries'); + }); + + // TODO: incomplete test + it('My Libraries tooltip - [C289916]', async () => { + await page.goToMyLibraries(); + expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.MY_LIBRARIES)).toContain('Access my libraries'); + }); + + // TODO: incomplete test + it('Favorite Libraries tooltip - [C289917]', async () => { + await page.goToFavoriteLibraries(); + expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FAVORITE_LIBRARIES)).toContain('Access my favorite libraries'); }); // TODO: incomplete test - xit('Shared Files tooltip - [C213111]', async () => { + it('Shared Files tooltip - [C213111]', async () => { await page.clickSharedFiles(); expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.SHARED_FILES)).toContain('View files that have been shared'); }); // TODO: incomplete test - xit('Recent Files tooltip - [C213167]', async () => { + it('Recent Files tooltip - [C213167]', async () => { await page.clickRecentFiles(); expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.RECENT_FILES)).toContain('View files you recently edited'); }); // TODO: incomplete test - xit('Favorites tooltip - [C217153]', async () => { + it('Favorites tooltip - [C217153]', async () => { await page.clickFavorites(); expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FAVORITES)).toContain('View your favorite files and folders'); }); // TODO: incomplete test - xit('Trash tooltip - [C217154]', async () => { + it('Trash tooltip - [C217154]', async () => { await page.clickTrash(); expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.TRASH)).toContain('View deleted files in the trash'); }); diff --git a/e2e/utilities/repo-client/apis/favorites/favorites-api.ts b/e2e/utilities/repo-client/apis/favorites/favorites-api.ts index 9636ab66d7..b744a91c9b 100755 --- a/e2e/utilities/repo-client/apis/favorites/favorites-api.ts +++ b/e2e/utilities/repo-client/apis/favorites/favorites-api.ts @@ -45,19 +45,26 @@ export class FavoritesApi extends RepoApi { return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data); } - async addFavoriteById(nodeType: 'file' | 'folder', id: string) { + async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string) { + let guid; + await this.apiAuth(); + + if ( nodeType === 'site' ) { + guid = (await this.alfrescoJsApi.core.sitesApi.getSite(id)).entry.guid; + } else { + guid = id; + } const data = { target: { [nodeType]: { - guid: id + guid: guid } } }; - await this.apiAuth(); return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data); } - async addFavoritesByIds(nodeType: 'file' | 'folder', ids: string[]) { + async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]) { await this.apiAuth(); return await ids.reduce(async (previous, current) => { await previous; diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 1f64c82406..5445fed2f1 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -44,7 +44,7 @@ } }, "LIBRARIES": { - "TITLE": "File Libraries", + "TITLE": "My Libraries", "DESCRIPTION": "Access File Libraries", "SIDENAV_LINK": { "LABEL": "File Libraries", @@ -65,14 +65,14 @@ "TITLE": "My Libraries", "SIDENAV_LINK": { "LABEL": "My Libraries", - "TOOLTIP": "Access My Libraries" + "TOOLTIP": "Access my libraries" } }, "FAVORITE_LIBRARIES": { "TITLE": "Favorite Libraries", "SIDENAV_LINK": { "LABEL": "Favorite Libraries", - "TOOLTIP": "Access Favorited Libraries" + "TOOLTIP": "Access my favorite libraries" } } }