From bbc698ad4c89e11934b92038e89a04fd9617ae58 Mon Sep 17 00:00:00 2001 From: datguychen Date: Fri, 9 Feb 2024 09:23:35 +0100 Subject: [PATCH] [ACS-6680] Deleted protractor tests --- .../suites/info-drawer/comments.test.ts | 220 --------------- .../file-folder-properties.test.ts | 115 -------- .../suites/info-drawer/file-preview.test.ts | 92 ------- .../suites/info-drawer/general.test.ts | 85 ------ .../info-drawer/library-properties.test.ts | 259 ------------------ 5 files changed, 771 deletions(-) delete mode 100755 e2e/protractor/suites/info-drawer/comments.test.ts delete mode 100755 e2e/protractor/suites/info-drawer/file-folder-properties.test.ts delete mode 100755 e2e/protractor/suites/info-drawer/file-preview.test.ts delete mode 100755 e2e/protractor/suites/info-drawer/general.test.ts delete mode 100755 e2e/protractor/suites/info-drawer/library-properties.test.ts diff --git a/e2e/protractor/suites/info-drawer/comments.test.ts b/e2e/protractor/suites/info-drawer/comments.test.ts deleted file mode 100755 index b51d832862..0000000000 --- a/e2e/protractor/suites/info-drawer/comments.test.ts +++ /dev/null @@ -1,220 +0,0 @@ -/*! - * 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 . - */ - -import { AdminActions, UserActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils, click } from '@alfresco/aca-testing-shared'; - -describe('Comments', () => { - const username = `user1-${Utils.random()}`; - - const parent = `parent-${Utils.random()}`; - let parentId: string; - - const file1 = `file1-${Utils.random()}.txt`; - const folder1 = `folder1-${Utils.random()}`; - const folder2 = `folder2-${Utils.random()}`; - let folder2Id: string; - - const fileWith1Comment = `file1Comment-${Utils.random()}.txt`; - let fileWith1CommentId: string; - const fileWith2Comments = `file2Comments-${Utils.random()}.txt`; - let fileWith2CommentsId: string; - - const file2Personal = `file2Personal-${Utils.random()}.txt`; - const file2Shared = `file2Shared-${Utils.random()}.txt`; - let file2SharedId: string; - const file2Recent = `file2Recent-${Utils.random()}.txt`; - const file2Favorites = `file2Favorites-${Utils.random()}.txt`; - let file2FavoritesId: string; - - let commentFile1Entry: any; - let comment1File2Entry: any; - let comment2File2Entry: any; - - const apis = { - user: new RepoClient(username, username) - }; - - const infoDrawer = new InfoDrawer(); - const { commentsTab } = infoDrawer; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - - const adminApiActions = new AdminActions(); - const userActions = new UserActions(); - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - - await apis.user.nodes.createFile(file1, parentId); - await apis.user.nodes.createFile(file2Personal, parentId); - await apis.user.nodes.createFile(file2Recent, parentId); - file2SharedId = (await apis.user.nodes.createFile(file2Shared, parentId)).entry.id; - file2FavoritesId = (await apis.user.nodes.createFile(file2Favorites, parentId)).entry.id; - - fileWith1CommentId = (await apis.user.nodes.createFile(fileWith1Comment, parentId)).entry.id; - fileWith2CommentsId = (await apis.user.nodes.createFile(fileWith2Comments, parentId)).entry.id; - - await userActions.login(username, username); - comment1File2Entry = await userActions.createComment(fileWith2CommentsId, 'first comment'); - comment2File2Entry = await userActions.createComment(fileWith2CommentsId, 'second comment'); - - await apis.user.shared.shareFilesByIds([file2SharedId, fileWith1CommentId, fileWith2CommentsId]); - await apis.user.shared.waitForFilesToBeShared([file2SharedId, fileWith1CommentId, fileWith2CommentsId]); - - await apis.user.favorites.addFavoritesByIds('file', [file2FavoritesId, fileWith1CommentId, fileWith2CommentsId]); - - await apis.user.nodes.createFolder(folder1, parentId); - folder2Id = (await apis.user.nodes.createFolder(folder2, parentId)).entry.id; - await apis.user.favorites.addFavoriteById('folder', folder2Id); - - await loginPage.loginWith(username); - }); - - afterAll(async () => { - await userActions.login(username, username); - await userActions.deleteNodes([parentId]); - }); - - afterEach(async () => { - await page.clickPersonalFiles(); - }); - - describe('from Personal Files', () => { - beforeEach(async () => { - await page.clickPersonalFilesAndWait(); - await dataTable.doubleClickOnRowByName(parent); - }); - - it('[C299173] Comments tab default fields', async () => { - await dataTable.selectItem(file1); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickCommentsTab(); - - expect(await infoDrawer.getActiveTabTitle()).toBe('Comments'); - expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (0)'); - expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - }); - }); - - describe('from Favorites', () => { - beforeAll(async () => { - await apis.user.favorites.waitForApi({ expect: 4 }); - }); - - beforeEach(async () => { - await page.clickFavoritesAndWait(); - }); - - it('[C299209] Add a comment on a folder', async () => { - const myComment = 'my comment'; - - await dataTable.selectItem(folder2); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickCommentsTab(); - await commentsTab.typeComment(myComment); - await commentsTab.clickAddButton(); - - expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`); - expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text'); - }); - }); - - describe('from Shared Files', () => { - beforeEach(async () => { - await page.clickSharedFilesAndWait(); - }); - - it('[C299189] Comments are displayed ordered by created date in descending order', async () => { - await dataTable.selectItem(fileWith2Comments); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickCommentsTab(); - - expect(await commentsTab.getNthCommentText(1)).toContain(comment2File2Entry.content); - expect(await commentsTab.getNthCommentText(2)).toContain(comment1File2Entry.content); - }); - }); - - describe('from Recent Files', () => { - beforeAll(async () => { - await apis.user.search.waitForApi(username, { expect: 7 }); - }); - - beforeEach(async () => { - await page.clickRecentFilesAndWait(); - }); - - it('[C299195] Add a comment on a file', async () => { - const myComment = 'my comment'; - - await dataTable.selectItem(file2Recent); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickCommentsTab(); - await commentsTab.typeComment(myComment); - await commentsTab.clickAddButton(); - - expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`); - expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text'); - }); - }); - - describe('Comment info display', () => { - beforeAll(async () => { - await userActions.login(username, username); - commentFile1Entry = await userActions.createComment(fileWith1CommentId, 'this is my comment'); - - await apis.user.favorites.waitForApi({ expect: 4 }); - await apis.user.search.waitForApi(username, { expect: 7 }); - }); - - it('[C299196] File from Favorites', async () => { - await page.clickFavoritesAndWait(); - - await dataTable.selectItem(fileWith1Comment); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickCommentsTab(); - - expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - - expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment is not displayed`); - expect(await commentsTab.getCommentText()).toBe(commentFile1Entry.content, 'Incorrect comment text'); - expect(await commentsTab.getCommentUserName()).toBe(`${username} ${username}`, 'Incorrect comment user'); - expect(await commentsTab.getCommentTime()).toBe('less than a minute ago', 'Incorrect comment created time'); - expect(await commentsTab.isCommentUserAvatarDisplayed()).toBe(true, 'User avatar not displayed'); - }); - }); -}); diff --git a/e2e/protractor/suites/info-drawer/file-folder-properties.test.ts b/e2e/protractor/suites/info-drawer/file-folder-properties.test.ts deleted file mode 100755 index eeb5f06cdc..0000000000 --- a/e2e/protractor/suites/info-drawer/file-folder-properties.test.ts +++ /dev/null @@ -1,115 +0,0 @@ -/*! - * 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 . - */ - -import { AdminActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils, FILES, click, rightClick } from '@alfresco/aca-testing-shared'; - -describe('File / Folder properties', () => { - const username = `user1-${Utils.random()}`; - - const parent = `parent-${Utils.random()}`; - let parentId: string; - - const file1 = { - name: `file1-${Utils.random()}.txt`, - title: 'file title', - description: 'file description', - author: 'file author', - contentType: 'Content' - }; - - const image1 = { - name: FILES.jpgFile, - title: 'image title', - description: 'image description', - author: 'image author' - }; - - const folder1 = { - name: `folder1-${Utils.random()}`, - title: 'folder title', - description: 'folder description', - author: 'folder author', - contentType: 'Folder' - }; - - const apis = { - user: new RepoClient(username, username) - }; - - const infoDrawer = new InfoDrawer(); - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - const adminApiActions = new AdminActions(); - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - await apis.user.nodes.createFile(file1.name, parentId, file1.title, file1.description, file1.author); - await apis.user.nodes.createFolder(folder1.name, parentId, folder1.title, folder1.description, folder1.author); - await apis.user.upload.uploadFile(image1.name, parentId); - - await loginPage.loginWith(username); - }); - - afterAll(async () => { - await apis.user.nodes.deleteNodeById(parentId); - }); - - beforeEach(async () => { - await page.clickPersonalFilesAndWait(); - await dataTable.doubleClickOnRowByName(parent); - }); - - describe('View properties', () => { - it('[C299162] Default tabs', async () => { - await dataTable.selectItem(file1.name); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - - expect(await infoDrawer.getHeaderTitle()).toEqual(file1.name); - expect(await infoDrawer.isPropertiesTabDisplayed()).toBe(true, 'Properties tab is not displayed'); - expect(await infoDrawer.isCommentsTabDisplayed()).toBe(true, 'Comments tab is not displayed'); - expect(await infoDrawer.getTabsCount()).toBe(2, 'Incorrect number of tabs'); - }); - - it('[C599174] Should be able to make the files/folders info drawer expandable as for Sites', async () => { - await dataTable.selectItem(file1.name); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.expandDetailsButton.click(); - expect(await infoDrawer.expandedDetailsPermissionsTab.isPresent()).toBe(true, 'Permissions tab is not displayed'); - - await page.clickPersonalFilesAndWait(); - await dataTable.selectItem(parent); - await rightClick(dataTable.selectedRow); - await dataTable.menu.clickMenuItem('Permissions'); - const expectedSelectedTabTitle = 'permissions'; - const actualSelectedTabTitle = await infoDrawer.selectedTab.getText(); - - expect(actualSelectedTabTitle.toLowerCase()).toEqual(expectedSelectedTabTitle); - }); - }); -}); diff --git a/e2e/protractor/suites/info-drawer/file-preview.test.ts b/e2e/protractor/suites/info-drawer/file-preview.test.ts deleted file mode 100755 index 48e3eda704..0000000000 --- a/e2e/protractor/suites/info-drawer/file-preview.test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/*! - * 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 . - */ - -import { - AdminActions, - LoginPage, - BrowsingPage, - RepoClient, - FILES, - SearchInput, - DataTable, - InfoDrawer, - click, - waitUntilElementIsVisible -} from '@alfresco/aca-testing-shared'; -import { element, by, $$ } from 'protractor'; - -describe('File preview', () => { - const timestamp = new Date().getTime(); - const username = `user1-${timestamp}`; - const fileName = `file1-${timestamp}.pdf`; - let fileId: string; - - const apis = { - user: new RepoClient(username, username) - }; - - const infoDrawer = new InfoDrawer(); - const loginPage = new LoginPage(); - const browsingPage = new BrowsingPage(); - const dataTable = new DataTable(); - const adminApiActions = new AdminActions(); - const searchInput = new SearchInput(); - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - fileId = (await apis.user.upload.uploadFileWithRename(FILES.pdfFile, '-my-', fileName)).entry.id; - await apis.user.search.waitForNodes(fileName, { expect: 1 }); - await loginPage.loginWith(username); - }); - - afterAll(async () => { - await apis.user.nodes.deleteNodeById(fileId); - }); - - beforeEach(async () => { - await browsingPage.clickPersonalFilesAndWait(); - }); - - async function checkFileContent(pageNumber: string, text: string): Promise { - const allPages = $$('.canvasWrapper > canvas').first(); - const pageLoaded = $$('div[data-page-number="' + pageNumber + '"][data-loaded="true"]').first(); - const textLayerLoaded = $$('div[data-page-number="' + pageNumber + '"] .textLayer').first(); - const specificText = element.all(by.cssContainingText('div[data-page-number="' + pageNumber + '"] .textLayer', text)).first(); - - await waitUntilElementIsVisible(allPages); - await waitUntilElementIsVisible(pageLoaded); - await waitUntilElementIsVisible(textLayerLoaded); - await waitUntilElementIsVisible(specificText); - } - - it('[C595967] Should preview document from the info drawer', async () => { - const pageNumber = '1'; - const documentText = 'This is a small demonstration'; - await searchInput.searchUntilResult(fileName, 'URL'); - await dataTable.selectItem(fileName); - await click(infoDrawer.toolbar.viewDetailsButton); - await infoDrawer.previewButton.click(); - await checkFileContent(pageNumber, documentText); - }); -}); diff --git a/e2e/protractor/suites/info-drawer/general.test.ts b/e2e/protractor/suites/info-drawer/general.test.ts deleted file mode 100755 index 25a039fd79..0000000000 --- a/e2e/protractor/suites/info-drawer/general.test.ts +++ /dev/null @@ -1,85 +0,0 @@ -/*! - * 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 . - */ - -import { AdminActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils, UserActions, click } from '@alfresco/aca-testing-shared'; - -describe('General', () => { - const username = `user1-${Utils.random()}`; - - const parent = `parent-${Utils.random()}`; - let parentId: string; - - const file1 = `file1-${Utils.random()}.txt`; - const folder1 = `folder1-${Utils.random()}`; - - const apis = { - user: new RepoClient(username, username) - }; - - const infoDrawer = new InfoDrawer(); - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - - const adminApiActions = new AdminActions(); - const userActions = new UserActions(); - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - await userActions.login(username, username); - - parentId = await apis.user.createFolder(parent); - await apis.user.createFile(file1, parentId); - await apis.user.createFolder(folder1, parentId); - - await loginPage.loginWith(username); - }); - - afterAll(async () => { - await userActions.deleteNodes([parentId]); - }); - - beforeEach(async () => { - await page.clickPersonalFilesAndWait(); - await dataTable.doubleClickOnRowByName(parent); - }); - - afterEach(async () => { - if (await infoDrawer.isOpen()) { - await click(page.toolbar.viewDetailsButton); - } - }); - - it('[C268999] Info drawer closes on page refresh', async () => { - await dataTable.selectItem(file1); - await click(page.toolbar.viewDetailsButton); - expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open'); - - await page.refresh(); - await dataTable.waitForBody(); - - expect(await infoDrawer.isOpen()).toBe(false, 'Info drawer open'); - }); -}); diff --git a/e2e/protractor/suites/info-drawer/library-properties.test.ts b/e2e/protractor/suites/info-drawer/library-properties.test.ts deleted file mode 100755 index 9866bebc59..0000000000 --- a/e2e/protractor/suites/info-drawer/library-properties.test.ts +++ /dev/null @@ -1,259 +0,0 @@ -/*! - * 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 . - */ - -import { - AdminActions, - LoginPage, - BrowsingPage, - SITE_VISIBILITY, - SITE_ROLES, - RepoClient, - InfoDrawer, - Utils, - click -} from '@alfresco/aca-testing-shared'; - -describe('Library properties', () => { - const username = `user1-${Utils.random()}`; - const user2 = `user2-${Utils.random()}`; - const user3 = `user3-${Utils.random()}`; - - const site = { - name: `site1-${Utils.random()}`, - id: `site-id-${Utils.random()}`, - visibility: SITE_VISIBILITY.MODERATED, - description: 'my site description' - }; - - const siteForUpdate = { - name: `site2-${Utils.random()}`, - id: `site-id-${Utils.random()}`, - visibility: SITE_VISIBILITY.MODERATED, - description: 'my initial description' - }; - - const siteUpdated = { - name: `site-for-rename-${Utils.random()}`, - visibility: SITE_VISIBILITY.PRIVATE, - description: 'new description' - }; - - const siteDup = `site3-${Utils.random()}`; - - const apis = { - user: new RepoClient(username, username) - }; - - const infoDrawer = new InfoDrawer(); - const { aboutTab } = infoDrawer; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - const adminApiActions = new AdminActions(); - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - await adminApiActions.createUser({ username: user2 }); - await adminApiActions.createUser({ username: user3 }); - await apis.user.sites.createSite(site.name, site.visibility, site.description, site.id); - 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.ROLE); - await apis.user.sites.addSiteMember(site.id, user3, SITE_ROLES.SITE_MANAGER.ROLE); - - await loginPage.loginWith(username); - }); - - afterAll(async () => { - await apis.user.sites.deleteSite(site.id); - await apis.user.sites.deleteSite(siteForUpdate.id); - await apis.user.sites.deleteSite(siteDup); - }); - - beforeEach(async () => { - await page.goToMyLibrariesAndWait(); - }); - - afterEach(async () => { - if (await infoDrawer.isOpen()) { - await click(page.toolbar.viewDetailsButton); - } - }); - - it('[C289336] Info drawer opens for a library', async () => { - await dataTable.selectItem(site.name); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - - expect(await infoDrawer.getHeaderTitle()).toEqual(site.name); - expect(await infoDrawer.isPropertiesTabDisplayed()).toBe(true, 'Properties tab is not displayed'); - expect(await aboutTab.isNameDisplayed()).toBe(true, 'Name field not displayed'); - expect(await aboutTab.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed'); - expect(await aboutTab.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed'); - expect(await aboutTab.isDescriptionDisplayed()).toBe(true, 'Description field not displayed'); - - expect(await aboutTab.getName()).toEqual(site.name); - expect(await aboutTab.getLibraryId()).toEqual(site.id); - expect((await aboutTab.getVisibility()).toLowerCase()).toEqual(site.visibility.toLowerCase()); - expect(await aboutTab.getDescription()).toEqual(site.description); - - expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(true, 'Edit action is not displayed'); - }); - - it('[C289338] Editable properties', async () => { - await dataTable.selectItem(site.name); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - - expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); - await aboutTab.clickEditLibraryProperties(); - - expect(await aboutTab.isNameEnabled()).toBe(true, 'Name field not enabled'); - expect(await aboutTab.isLibraryIdEnabled()).toBe(false, 'Library ID field not disabled'); - expect(await aboutTab.isVisibilityEnabled()).toBe(true, 'Visibility field not enabled'); - expect(await aboutTab.isDescriptionEnabled()).toBe(true, 'Description field not enabled'); - - expect(await aboutTab.isCancelDisplayed()).toBe(true, 'Cancel button not displayed'); - expect(await aboutTab.isUpdateDisplayed()).toBe(true, 'Update button not displayed'); - expect(await aboutTab.isCancelEnabled()).toBe(true, 'Cancel button not enabled'); - expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled'); - }); - - it('[C289339] Edit site details', async () => { - await dataTable.selectItem(siteForUpdate.name); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - - expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); - await aboutTab.clickEditLibraryProperties(); - - await aboutTab.enterName(siteUpdated.name); - await aboutTab.enterDescription(siteUpdated.description); - await aboutTab.setVisibility(siteUpdated.visibility); - expect(await aboutTab.isUpdateEnabled()).toBe(true, 'Update button not enabled'); - - await aboutTab.clickUpdate(); - - expect(await page.getSnackBarMessage()).toEqual('Library properties updated'); - expect(await dataTable.isItemPresent(siteUpdated.name)).toBe(true, 'New site name not displayed in the list'); - expect(await infoDrawer.isOpen()).toBe(false, 'Info drawer still open'); - - expect((await apis.user.sites.getSite(siteForUpdate.id)).entry.title).toEqual(siteUpdated.name); - expect((await apis.user.sites.getSite(siteForUpdate.id)).entry.description).toEqual(siteUpdated.description); - expect((await apis.user.sites.getSite(siteForUpdate.id)).entry.visibility).toEqual(siteUpdated.visibility); - }); - - it('[C289340] Cancel editing a site', async () => { - const newName = `new-name-${Utils.random}`; - const newDesc = `new desc ${Utils.random}`; - - await dataTable.selectItem(site.name); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - - expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); - await aboutTab.clickEditLibraryProperties(); - - await aboutTab.enterName(newName); - await aboutTab.enterDescription(newDesc); - await aboutTab.setVisibility(SITE_VISIBILITY.MODERATED); - - await aboutTab.clickCancel(); - - expect(await dataTable.isItemPresent(newName)).toBe(false, 'New site name is displayed in the list'); - expect(await dataTable.isItemPresent(site.name)).toBe(true, 'Original site name not displayed in the list'); - expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open'); - }); - - it('[C289341] Warning appears when editing the name of the library by entering an existing name', async () => { - await apis.user.queries.waitForSites(site.name, { expect: 1 }); - - await dataTable.selectItem(siteDup); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await aboutTab.clickEditLibraryProperties(); - - await aboutTab.enterName(site.name); - expect(await aboutTab.isMessageDisplayed()).toBe(true, 'Message not displayed'); - expect(await aboutTab.getMessage()).toEqual('Library name already in use'); - }); - - it('[C289342] Site name too long', async () => { - await dataTable.selectItem(site.name); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await aboutTab.clickEditLibraryProperties(); - - await aboutTab.enterName(Utils.string257); - await Utils.pressTab(); - expect(await aboutTab.isErrorDisplayed()).toBe(true, 'Message not displayed'); - expect(await aboutTab.getError()).toEqual('Use 256 characters or less for title'); - expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled'); - }); - - it('[C289343] Site description too long', async () => { - await dataTable.selectItem(site.name); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await aboutTab.clickEditLibraryProperties(); - - await aboutTab.enterDescription(Utils.string513); - await Utils.pressTab(); - expect(await aboutTab.isErrorDisplayed()).toBe(true, 'Message not displayed'); - expect(await aboutTab.getError()).toEqual('Use 512 characters or less for description'); - expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled'); - }); - - describe('Non manager', () => { - afterAll(async () => { - await loginPage.loginWith(username); - }); - - it('[C289337] Info drawer button is not displayed when user is not the library manager', async () => { - await loginPage.loginWith(user2); - await page.goToMyLibrariesAndWait(); - await dataTable.selectItem(site.name); - expect(await page.toolbar.isButtonPresent('View Details')).toBe(false, 'View Details is present'); - }); - - it('[C289344] Error notification', async () => { - await loginPage.loginWith(user3); - - await page.goToMyLibrariesAndWait(); - await dataTable.selectItem(site.name); - await click(page.toolbar.viewDetailsButton); - await infoDrawer.waitForInfoDrawerToOpen(); - await aboutTab.clickEditLibraryProperties(); - - await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER.ROLE); - - await aboutTab.enterDescription('new description'); - await aboutTab.clickUpdate(); - - expect(await page.getSnackBarMessage()).toEqual('There was an error updating library properties'); - }); - }); -});