diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 134d683e21..c19fad2a31 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -174,6 +174,8 @@ jobs: id: 6 - name: "pagination" id: 7 + - name: "list-views" + id: 8 steps: - name: Checkout uses: actions/checkout@v3 diff --git a/e2e/playwright/list-views/.eslintrc.json b/e2e/playwright/list-views/.eslintrc.json new file mode 100644 index 0000000000..9e1357d874 --- /dev/null +++ b/e2e/playwright/list-views/.eslintrc.json @@ -0,0 +1,26 @@ +{ + "extends": "../../../.eslintrc.json", + "ignorePatterns": [ + "!**/*" + ], + "overrides": [ + { + "files": [ + "*.ts" + ], + "parserOptions": { + "project": [ + "e2e/playwright/list-views/tsconfig.e2e.json" + ], + "createDefaultProgram": true + }, + "plugins": [ + "rxjs", + "unicorn" + ], + "rules": { + "@typescript-eslint/no-floating-promises": "off" + } + } + ] +} diff --git a/e2e/playwright/list-views/exclude.tests.json b/e2e/playwright/list-views/exclude.tests.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/e2e/playwright/list-views/exclude.tests.json @@ -0,0 +1 @@ +{} diff --git a/e2e/playwright/list-views/playwright.config.ts b/e2e/playwright/list-views/playwright.config.ts new file mode 100644 index 0000000000..8b7f9faa6e --- /dev/null +++ b/e2e/playwright/list-views/playwright.config.ts @@ -0,0 +1,44 @@ +/*! + * 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 { PlaywrightTestConfig } from '@playwright/test'; +import { CustomConfig, getGlobalConfig, getExcludedTestsRegExpArray } from '@alfresco/playwright-shared'; +import EXCLUDED_JSON from './exclude.tests.json'; + +const config: PlaywrightTestConfig = { + ...getGlobalConfig, + + grepInvert: getExcludedTestsRegExpArray(EXCLUDED_JSON, 'List Views'), + projects: [ + { + name: 'List Views', + testDir: './src/tests', + use: { + users: ['hruser', 'admin'] + } + } + ] +}; + +export default config; diff --git a/e2e/playwright/list-views/project.json b/e2e/playwright/list-views/project.json new file mode 100644 index 0000000000..a55e67f9fd --- /dev/null +++ b/e2e/playwright/list-views/project.json @@ -0,0 +1,22 @@ +{ + "name": "list-views-e2e", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "e2e/playwright/list-views", + "projectType": "application", + "targets": { + "e2e": { + "executor": "nx:run-commands", + "options": { + "commands": ["npx playwright test --config=e2e/playwright/list-views/playwright.config.ts"] + }, + "configurations": { + "production": { + "devServerTarget": "content-ce:serve:production" + } + } + }, + "lint": { + "executor": "@angular-eslint/builder:lint" + } + } +} diff --git a/e2e/playwright/list-views/src/tests/favorites.spec.ts b/e2e/playwright/list-views/src/tests/favorites.spec.ts new file mode 100644 index 0000000000..3f4c8fe2c5 --- /dev/null +++ b/e2e/playwright/list-views/src/tests/favorites.spec.ts @@ -0,0 +1,146 @@ +/*! + * 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 { expect } from '@playwright/test'; +import { ApiClientFactory, LoginPage, NodesApi, Utils, test, SitesApi, FavoritesPageApi, timeouts } from '@alfresco/playwright-shared'; +import { Site } from '@alfresco/js-api'; + +test.describe('Favorites Files', () => { + let nodesApi: NodesApi; + let siteActionsAdmin: SitesApi; + const username = `user-${Utils.random()}`; + const siteName = `site-${Utils.random()}`; + const favFolderName = `favFolder-${Utils.random()}`; + const parentFolder = `parent-${Utils.random()}`; + const fileName1 = `file1-${Utils.random()}.txt`; + const fileName2 = `file2-${Utils.random()}.txt`; + const fileName3 = `file3-${Utils.random()}.txt`; + const fileName4 = `file4-${Utils.random()}.txt`; + + test.beforeAll(async () => { + try { + test.setTimeout(timeouts.extendedTest); + const apiClientFactory = new ApiClientFactory(); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username }); + nodesApi = await NodesApi.initialize(username, username); + const nodesApiAdmin = await NodesApi.initialize('admin'); + siteActionsAdmin = await SitesApi.initialize('admin'); + const favoritesActions = await FavoritesPageApi.initialize(username, username); + const consumerFavoritesTotalItems = await favoritesActions.getFavoritesTotalItems(username); + const folderFavId = (await nodesApi.createFolder(favFolderName)).entry.id; + const parentId = (await nodesApi.createFolder(parentFolder)).entry.id; + await siteActionsAdmin.createSite(siteName, Site.VisibilityEnum.PUBLIC); + const docLibId = await siteActionsAdmin.getDocLibId(siteName); + await siteActionsAdmin.addSiteMember(siteName, username, Site.RoleEnum.SiteManager); + await favoritesActions.addFavoritesByIds('folder', [folderFavId]); + const file1Id = (await nodesApiAdmin.createFile(fileName1, docLibId)).entry.id; + const file2Id = (await nodesApi.createFile(fileName2, parentId)).entry.id; + const file3Id = (await nodesApi.createFile(fileName3, parentId)).entry.id; + const file4Id = (await nodesApi.createFile(fileName4, parentId)).entry.id; + + await favoritesActions.addFavoritesByIds('file', [file1Id]); + await favoritesActions.addFavoriteById('file', file2Id); + await favoritesActions.addFavoriteById('file', file3Id); + await favoritesActions.addFavoriteById('file', file4Id); + await nodesApi.deleteNodes([file3Id, file4Id], false); + await apiClientFactory.trashCan.restoreDeletedNode(file4Id); + await Promise.all([ + favoritesActions.isFavoriteWithRetry(username, folderFavId, { expect: true }), + favoritesActions.waitForApi(username, { expect: consumerFavoritesTotalItems + 4 }) + ]); + } catch (error) { + console.error(`beforeAll failed : ${error}`); + } + }); + + test.beforeEach(async ({ page }) => { + const loginPage = new LoginPage(page); + await loginPage.loginUser( + { username, password: username }, + { + withNavigation: true, + waitForLoading: true + } + ); + }); + + test.afterAll(async () => { + await nodesApi.deleteCurrentUserNodes(); + await siteActionsAdmin.deleteSites([siteName]); + }); + + test.describe(`Regular user's Favorites files`, () => { + test.beforeEach(async ({ favoritePage }) => { + await favoritePage.navigate(); + }); + + test('[C280482] has the correct columns', async ({ favoritePage }) => { + const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by', 'Tags']; + const actualColumns = await favoritePage.dataTable.getColumnHeaders(); + expect(actualColumns).toEqual(expectedColumns); + }); + + test(`[C213228] deleted favorite file does not appear`, async ({ favoritePage }) => { + expect(await favoritePage.dataTable.isItemPresent(fileName3), `${fileName3} is displayed`).not.toBe(true); + }); + + test(`[C213229] file is displayed after it is restored from Trashcan`, async ({ favoritePage }) => { + expect(await favoritePage.dataTable.isItemPresent(fileName4), `${fileName4} not displayed`).toBe(true); + }); + + test('[C213231] Location column displays the parent folder of the files', async ({ favoritePage }) => { + expect(await favoritePage.dataTable.getItemLocationText(fileName2)).toEqual(parentFolder); + expect(await favoritePage.dataTable.getItemLocationText(favFolderName)).toEqual('Personal Files'); + expect(await favoritePage.dataTable.getItemLocationTooltip(fileName2)).toEqual(`Personal Files/${parentFolder}`); + expect(await favoritePage.dataTable.getItemLocationTooltip(favFolderName)).toEqual('Personal Files'); + expect(await favoritePage.dataTable.getItemLocationText(fileName1)).toEqual(siteName); + expect(await favoritePage.dataTable.getItemLocationTooltip(fileName1)).toContain(`${siteName}`); + }); + + test('[C213650] Location column redirect - item in user Home', async ({ favoritePage }) => { + await favoritePage.dataTable.clickItemLocation(favFolderName); + await favoritePage.dataTable.spinnerWaitForReload(); + expect(await favoritePage.breadcrumb.getAllItems()).toEqual(['Personal Files']); + }); + + test('[C280484] Location column redirect - file in folder', async ({ favoritePage }) => { + await favoritePage.dataTable.clickItemLocation(fileName2); + await favoritePage.dataTable.spinnerWaitForReload(); + expect(await favoritePage.breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]); + }); + + test('[C280485] Location column redirect - file in site', async ({ favoritePage }) => { + await favoritePage.dataTable.clickItemLocation(fileName1); + await favoritePage.dataTable.spinnerWaitForReload(); + expect(await favoritePage.breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]); + }); + + test('[C213230] Navigate into folder from Favorites', async ({ favoritePage }) => { + await favoritePage.dataTable.performClickFolderOrFileToOpen(favFolderName); + await favoritePage.dataTable.spinnerWaitForReload(); + expect(await favoritePage.breadcrumb.currentItem.innerText()).toBe(favFolderName); + }); + }); +}); diff --git a/e2e/playwright/list-views/src/tests/file-libraries.spec.ts b/e2e/playwright/list-views/src/tests/file-libraries.spec.ts new file mode 100755 index 0000000000..f2774ce8f9 --- /dev/null +++ b/e2e/playwright/list-views/src/tests/file-libraries.spec.ts @@ -0,0 +1,168 @@ +/*! + * 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 { expect } from '@playwright/test'; +import { ApiClientFactory, FavoritesPageApi, LoginPage, SitesApi, Utils, test, timeouts } from '@alfresco/playwright-shared'; +import { Site } from '@alfresco/js-api'; + +test.describe('File Libraries', () => { + let siteActionsAdmin: SitesApi; + let siteActionsUser: SitesApi; + + const username = `user-${Utils.random()}`; + const userSitePrivate = `user-priv-${Utils.random()}`; + const userSiteModerated = `user-mode-${Utils.random()}`; + const userSitePublic = `user-pub-${Utils.random()}`; + const siteName = `siteName-${Utils.random()}`; + + const siteId1 = Utils.random(); + const siteId2 = 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()}`; + + test.beforeAll(async () => { + try { + test.setTimeout(timeouts.extendedTest); + const apiClientFactory = new ApiClientFactory(); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username }); + siteActionsAdmin = await SitesApi.initialize('admin'); + siteActionsUser = await SitesApi.initialize(username, username); + const favoritesActions = await FavoritesPageApi.initialize(username, username); + const siteDescription = 'my site description'; + await siteActionsUser.createSite(userSitePublic, Site.VisibilityEnum.PUBLIC); + await siteActionsUser.createSite(userSiteModerated, Site.VisibilityEnum.MODERATED, siteDescription); + await siteActionsUser.createSite(userSitePrivate, Site.VisibilityEnum.PRIVATE, null); + + await siteActionsAdmin.createSite(adminSite1, Site.VisibilityEnum.PUBLIC); + await siteActionsAdmin.createSite(adminSite2, Site.VisibilityEnum.PUBLIC); + await siteActionsAdmin.createSite(adminSite3, Site.VisibilityEnum.PUBLIC); + await siteActionsAdmin.createSite(adminSite4, Site.VisibilityEnum.PUBLIC); + await siteActionsAdmin.createSite(adminSite5, Site.VisibilityEnum.PUBLIC); + await siteActionsAdmin.addSiteMember(adminSite1, username, Site.RoleEnum.SiteConsumer); + await siteActionsAdmin.addSiteMember(adminSite2, username, Site.RoleEnum.SiteContributor); + await siteActionsAdmin.addSiteMember(adminSite3, username, Site.RoleEnum.SiteCollaborator); + await siteActionsAdmin.addSiteMember(adminSite4, username, Site.RoleEnum.SiteManager); + await siteActionsAdmin.addSiteMember(adminSite5, username, Site.RoleEnum.SiteConsumer); + + await favoritesActions.addFavoriteById('site', adminSite1); + await favoritesActions.addFavoriteById('site', adminSite2); + await favoritesActions.addFavoriteById('site', adminSite3); + await favoritesActions.addFavoriteById('site', adminSite4); + + await siteActionsUser.createSite(siteName, Site.VisibilityEnum.PUBLIC, null, siteId1); + await siteActionsUser.createSite(siteName, Site.VisibilityEnum.PUBLIC, null, siteId2); + } catch (error) { + console.error(`----- beforeAll failed : ${error}`); + } + }); + + test.afterAll(async () => { + await siteActionsUser.deleteSites([userSitePublic, userSiteModerated, userSitePrivate, siteId1, siteId2]); + await siteActionsAdmin.deleteSites([adminSite1, adminSite2, adminSite3, adminSite4, adminSite5]); + }); + + test.describe('My Libraries', () => { + test.beforeEach(async ({ page, myLibrariesPage }) => { + const loginPage = new LoginPage(page); + await loginPage.loginUser( + { username, password: username }, + { + withNavigation: true, + waitForLoading: true + } + ); + await myLibrariesPage.navigate(); + }); + + test('[C217095] has the correct columns', async ({ myLibrariesPage }) => { + const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility']; + const actualColumns = await myLibrariesPage.dataTable.getColumnHeaders(); + expect(actualColumns).toEqual(expectedColumns); + }); + + test('[C289905] Library visibility is correctly displayed', async ({ myLibrariesPage }) => { + const expectedSitesVisibility = { + [userSitePrivate]: Site.VisibilityEnum.PRIVATE, + [userSiteModerated]: Site.VisibilityEnum.MODERATED, + [userSitePublic]: Site.VisibilityEnum.PUBLIC + }; + for (const [site, visibility] of Object.entries(expectedSitesVisibility)) { + const sitesVisibility = await myLibrariesPage.dataTable.getRowAllInnerTexts(site); + expect(sitesVisibility.toLowerCase()).toContain(visibility.toLowerCase()); + } + }); + + test('[C289903] User role is correctly displayed', async ({ myLibrariesPage }) => { + const expectedSitesRoles = { + [adminSite1]: Site.RoleEnum.SiteConsumer, + [adminSite2]: Site.RoleEnum.SiteContributor, + [adminSite3]: Site.RoleEnum.SiteCollaborator, + [adminSite4]: Site.RoleEnum.SiteManager + }; + + for (const [site, role] of Object.entries(expectedSitesRoles)) { + const sitesRowNames = await myLibrariesPage.dataTable.getRowAllInnerTexts(site); + expect(sitesRowNames).toContain(role.split('Site')[1]); + } + }); + + test('[C217098] Site ID is displayed when two sites have the same name', async ({ myLibrariesPage }) => { + const expectedSites = [`${siteName} (${siteId1})`, `${siteName} (${siteId2})`]; + const actualSite1 = await myLibrariesPage.dataTable.getRowAllInnerTexts(siteId1); + expect(actualSite1).toContain(expectedSites[0]); + const actualSite2 = await myLibrariesPage.dataTable.getRowAllInnerTexts(siteId2); + expect(actualSite2).toContain(expectedSites[1]); + }); + }); + + test.describe('Favorite Libraries', () => { + test.beforeEach(async ({ page, favoritesLibrariesPage }) => { + const loginPage = new LoginPage(page); + await loginPage.loginUser( + { username, password: username }, + { + withNavigation: true, + waitForLoading: true + } + ); + await favoritesLibrariesPage.navigate(); + }); + + test('[C289893] has the correct columns', async ({ favoritesLibrariesPage }) => { + const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility']; + const actualColumns = await favoritesLibrariesPage.dataTable.getColumnHeaders(); + + expect(actualColumns).toEqual(expectedColumns); + }); + + test('[C289897] User can see only his favorite sites', async ({ favoritesLibrariesPage }) => { + expect(await favoritesLibrariesPage.dataTable.isItemPresent(adminSite5), `${adminSite5} should not appear`).toBe(false); + }); + }); +}); diff --git a/e2e/playwright/list-views/src/tests/personal-files.spec.ts b/e2e/playwright/list-views/src/tests/personal-files.spec.ts new file mode 100644 index 0000000000..35e4fad9d8 --- /dev/null +++ b/e2e/playwright/list-views/src/tests/personal-files.spec.ts @@ -0,0 +1,84 @@ +/*! + * 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 { expect } from '@playwright/test'; +import { APP_ROUTES, ApiClientFactory, LoginPage, NodesApi, SIDEBAR_LABELS, Utils, test } from '@alfresco/playwright-shared'; + +test.describe('Personal Files', () => { + let nodesApi: NodesApi; + const username = `user-${Utils.random()}`; + const userFolder = `user-folder-${Utils.random()}`; + + test.beforeAll(async () => { + try { + const apiClientFactory = new ApiClientFactory(); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username }); + nodesApi = await NodesApi.initialize(username, username); + await nodesApi.createFolder(userFolder); + } catch (error) { + console.error(`beforeAll failed : ${error}`); + } + }); + + test.afterAll(async () => { + await nodesApi.deleteCurrentUserNodes(); + }); + + test.describe(`Regular user's personal files`, () => { + test.beforeEach(async ({ page }) => { + const loginPage = new LoginPage(page); + await loginPage.loginUser( + { username, password: username }, + { + withNavigation: true, + waitForLoading: true + } + ); + }); + + test('[C217142] has the correct columns', async ({ personalFiles }) => { + const expectedColumns = ['Name', 'Size', 'Modified', 'Modified by', 'Tags']; + const actualColumns = await personalFiles.dataTable.getColumnHeaders(); + expect(actualColumns).toEqual(expectedColumns); + }); + + test('[C217143] has default sorted column', async ({ personalFiles }) => { + expect(await personalFiles.dataTable.getSortedColumnHeaderText()).toBe('Name'); + }); + + test('[C213245] redirects to Personal Files on clicking the link from sidebar', async ({ personalFiles }) => { + await personalFiles.dataTable.performClickFolderOrFileToOpen(userFolder); + await personalFiles.sidenav.openPanel(SIDEBAR_LABELS.PERSONAL_FILES); + await personalFiles.dataTable.spinnerWaitForReload(); + expect(personalFiles.page.url()).toContain(APP_ROUTES.PERSONAL_FILES); + expect(await personalFiles.sidenav.isActive(SIDEBAR_LABELS.PERSONAL_FILES), 'My Libraries link not active').toBe(true); + }); + + test('[C213246] page loads correctly after browser refresh', async ({ personalFiles }) => { + await personalFiles.reload(); + expect(personalFiles.page.url()).toContain(APP_ROUTES.PERSONAL_FILES); + }); + }); +}); diff --git a/e2e/playwright/list-views/src/tests/recent-files.spec.ts b/e2e/playwright/list-views/src/tests/recent-files.spec.ts new file mode 100755 index 0000000000..84efecf8fb --- /dev/null +++ b/e2e/playwright/list-views/src/tests/recent-files.spec.ts @@ -0,0 +1,121 @@ +/*! + * 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 { expect } from '@playwright/test'; +import { ApiClientFactory, LoginPage, NodesApi, SearchPageApi, SitesApi, TrashcanApi, Utils, test, timeouts } from '@alfresco/playwright-shared'; +import { Site } from '@alfresco/js-api'; + +test.describe('Recent Files', () => { + let nodeActionsUser: NodesApi; + let siteActionsUser: SitesApi; + const username = `user-${Utils.random()}`; + + const folderName = `folder-${Utils.random()}`; + let folderId: string; + const fileName1 = `file-${Utils.random()}.txt`; + const fileName2 = `file-${Utils.random()}.txt`; + let file2Id: string; + const fileName3 = `file-${Utils.random()}.txt`; + + const siteName = `site-${Utils.random()}`; + const folderSite = `folder2-${Utils.random()}`; + const fileSite = `file-${Utils.random()}.txt`; + + test.beforeAll(async () => { + test.setTimeout(timeouts.extendedTest); + const apiClientFactory = new ApiClientFactory(); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username }); + nodeActionsUser = await NodesApi.initialize(username, username); + siteActionsUser = await SitesApi.initialize(username, username); + + folderId = (await nodeActionsUser.createFolder(folderName)).entry.id; + await nodeActionsUser.createFiles([fileName1], folderName); + file2Id = (await nodeActionsUser.createFile(fileName2)).entry.id; + const id = (await nodeActionsUser.createFile(fileName3)).entry.id; + + await nodeActionsUser.deleteNodes([id], false); + + await siteActionsUser.createSite(siteName, Site.VisibilityEnum.PUBLIC); + const docLibId = await siteActionsUser.getDocLibId(siteName); + const folderSiteId = (await nodeActionsUser.createFolder(folderSite, docLibId)).entry.id; + await nodeActionsUser.createFile(fileSite, folderSiteId); + + const searchApi = await SearchPageApi.initialize(username, username); + await searchApi.waitForApi(username, { expect: 3 }); + }); + + test.beforeEach(async ({ page, recentFilesPage }) => { + const loginPage = new LoginPage(page); + await loginPage.loginUser( + { username, password: username }, + { + withNavigation: true, + waitForLoading: true + } + ); + await recentFilesPage.navigate(); + }); + + test.afterAll(async () => { + await nodeActionsUser.deleteNodes([folderId, file2Id]); + await siteActionsUser.deleteSites([siteName]); + const trashcanApi = await TrashcanApi.initialize(username, username); + await trashcanApi.emptyTrashcan(); + }); + + test('[C213168] has the correct columns', async ({ recentFilesPage }) => { + const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Tags']; + const actualColumns = await recentFilesPage.dataTable.getColumnHeaders(); + + expect(actualColumns).toEqual(expectedColumns); + }); + + test('[C213171] default sorting column', async ({ recentFilesPage }) => { + expect(await recentFilesPage.dataTable.getSortedColumnHeaderText()).toBe('Modified'); + expect(await recentFilesPage.dataTable.getSortingOrder()).toBe('desc'); + }); + + test(`[C213174] file not displayed if it's been deleted`, async ({ recentFilesPage }) => { + expect(await recentFilesPage.dataTable.isItemPresent(fileName3), `${fileName3} is displayed`).not.toBe(true); + }); + + test('[C213176] Location column redirect - file in user Home', async ({ recentFilesPage }) => { + await recentFilesPage.dataTable.clickItemLocation(fileName2); + await recentFilesPage.dataTable.spinnerWaitForReload(); + expect(await recentFilesPage.breadcrumb.getAllItems()).toEqual(['Personal Files']); + }); + + test('[C280486] Location column redirect - file in folder', async ({ recentFilesPage }) => { + await recentFilesPage.dataTable.clickItemLocation(fileName1); + await recentFilesPage.dataTable.spinnerWaitForReload(); + expect(await recentFilesPage.breadcrumb.getAllItems()).toEqual(['Personal Files', folderName]); + }); + + test('[C280487] Location column redirect - file in site', async ({ recentFilesPage }) => { + await recentFilesPage.dataTable.clickItemLocation(fileSite); + await recentFilesPage.dataTable.spinnerWaitForReload(); + expect(await recentFilesPage.breadcrumb.getAllItems()).toEqual(['My Libraries', siteName, folderSite]); + }); +}); diff --git a/e2e/playwright/list-views/src/tests/shared-files.spec.ts b/e2e/playwright/list-views/src/tests/shared-files.spec.ts new file mode 100644 index 0000000000..7b6c7b7d27 --- /dev/null +++ b/e2e/playwright/list-views/src/tests/shared-files.spec.ts @@ -0,0 +1,129 @@ +/*! + * 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 { expect } from '@playwright/test'; +import { ApiClientFactory, LoginPage, NodesApi, Utils, test, SitesApi, timeouts, SharedLinksApi } from '@alfresco/playwright-shared'; +import { Site } from '@alfresco/js-api'; + +test.describe('Shared Files', () => { + let nodesApi: NodesApi; + let siteActionsAdmin: SitesApi; + + const username = `user-${Utils.random()}`; + const siteName = `site-${Utils.random()}`; + const fileAdmin = `fileSite-${Utils.random()}.txt`; + const folderUser = `folder-${Utils.random()}`; + const file1User = `file1-${Utils.random()}.txt`; + const file2User = `file2-${Utils.random()}.txt`; + const file3User = `file3-${Utils.random()}.txt`; + const file4User = `file4-${Utils.random()}.txt`; + + test.beforeAll(async () => { + test.setTimeout(timeouts.extendedTest); + const apiClientFactory = new ApiClientFactory(); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username }); + siteActionsAdmin = await SitesApi.initialize('admin'); + const nodesApiAdmin = await NodesApi.initialize('admin'); + const shareActionsAdmin = await SharedLinksApi.initialize('admin'); + nodesApi = await NodesApi.initialize(username, username); + const shareActions = await SharedLinksApi.initialize(username, username); + + await siteActionsAdmin.createSite(siteName, Site.VisibilityEnum.PUBLIC); + await siteActionsAdmin.addSiteMember(siteName, username, Site.RoleEnum.SiteConsumer); + const docLibId = await siteActionsAdmin.getDocLibId(siteName); + const nodeId = (await nodesApiAdmin.createFile(fileAdmin, docLibId)).entry.id; + + await shareActionsAdmin.shareFileById(nodeId); + await shareActionsAdmin.waitForFilesToBeShared([nodeId]); + + const folderId = (await nodesApi.createFolder(folderUser)).entry.id; + const file1Id = (await nodesApi.createFile(file1User, folderId)).entry.id; + const file2Id = (await nodesApi.createFile(file2User)).entry.id; + const file3Id = (await nodesApi.createFile(file3User)).entry.id; + const file4Id = (await nodesApi.createFile(file4User)).entry.id; + + await shareActions.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]); + await shareActions.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]); + + await nodesApi.deleteNodeById(file2Id); + await shareActions.unshareFileById(file3Id); + + await shareActions.waitForFilesToNotBeShared([file2Id, file3Id]); + }); + + test.beforeEach(async ({ page, sharedPage }) => { + const loginPage = new LoginPage(page); + await loginPage.loginUser( + { username, password: username }, + { + withNavigation: true, + waitForLoading: true + } + ); + await sharedPage.navigate(); + }); + + test.afterAll(async () => { + await siteActionsAdmin.deleteSites([siteName]); + await nodesApi.deleteCurrentUserNodes(); + }); + + test('[C213113] has the correct columns', async ({ sharedPage }) => { + const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by', 'Tags']; + const actualColumns = await sharedPage.dataTable.getColumnHeaders(); + expect(actualColumns).toEqual(expectedColumns); + }); + + test('[C213115] default sorting column', async ({ sharedPage }) => { + expect(await sharedPage.dataTable.getSortedColumnHeaderText()).toBe('Modified'); + expect(await sharedPage.dataTable.getSortingOrder()).toBe('desc'); + }); + + test(`[C213117] file not displayed if it's been deleted`, async ({ sharedPage }) => { + expect(await sharedPage.dataTable.isItemPresent(file2User), `${file2User} is displayed`).toBe(false); + }); + + test('[C213118] unshared file is not displayed', async ({ sharedPage }) => { + expect(await sharedPage.dataTable.isItemPresent(file3User), `${file3User} is displayed`).toBe(false); + }); + + test('[C213666] Location column redirect - file in user Home', async ({ sharedPage }) => { + await sharedPage.dataTable.clickItemLocation(file4User); + await sharedPage.dataTable.spinnerWaitForReload(); + expect(await sharedPage.breadcrumb.getAllItems()).toEqual(['Personal Files']); + }); + + test('[C280490] Location column redirect - file in folder', async ({ sharedPage }) => { + await sharedPage.dataTable.clickItemLocation(file1User); + await sharedPage.dataTable.spinnerWaitForReload(); + expect(await sharedPage.breadcrumb.getAllItems()).toEqual(['Personal Files', folderUser]); + }); + + test('[C280491] Location column redirect - file in site', async ({ sharedPage }) => { + await sharedPage.dataTable.clickItemLocation(fileAdmin); + await sharedPage.dataTable.spinnerWaitForReload(); + expect(await sharedPage.breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]); + }); +}); diff --git a/e2e/playwright/list-views/src/tests/trash.spec.ts b/e2e/playwright/list-views/src/tests/trash.spec.ts new file mode 100755 index 0000000000..6c47c8fb1f --- /dev/null +++ b/e2e/playwright/list-views/src/tests/trash.spec.ts @@ -0,0 +1,123 @@ +/*! + * 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 { expect } from '@playwright/test'; +import { ApiClientFactory, LoginPage, NodesApi, SitesApi, Utils, test } from '@alfresco/playwright-shared'; +import { Site } from '@alfresco/js-api'; + +test.describe('Trash', () => { + let nodesApi: NodesApi; + let siteActionsAdmin: SitesApi; + + const username = `user-${Utils.random()}`; + const siteName = `site-${Utils.random()}`; + const fileSite = `file1-${Utils.random()}.txt`; + const fileUser = `file-${Utils.random()}.txt`; + const fileDeleted = `file-${Utils.random()}.txt`; + const folderNotDeleted = `folder-${Utils.random()}`; + const fileInFolder = `file-${Utils.random()}.txt`; + + test.beforeAll(async () => { + try { + const apiClientFactory = new ApiClientFactory(); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username }); + siteActionsAdmin = await SitesApi.initialize('admin'); + nodesApi = await NodesApi.initialize(username, username); + const nodesApiAdmin = await NodesApi.initialize('admin'); + const folderDeleted = `folder-${Utils.random()}`; + + await siteActionsAdmin.createSite(siteName, Site.VisibilityEnum.PUBLIC); + const docLibId = await siteActionsAdmin.getDocLibId(siteName); + await siteActionsAdmin.addSiteMember(siteName, username, Site.RoleEnum.SiteManager); + const fileSiteId = (await nodesApiAdmin.createFile(fileSite, docLibId)).entry.id; + const fileUserId = (await nodesApi.createFile(fileUser)).entry.id; + + const folderDeletedId = (await nodesApi.createFolder(folderDeleted)).entry.id; + const folderNotDeletedId = (await nodesApi.createFolder(folderNotDeleted)).entry.id; + const fileDeletedId = (await nodesApi.createFile(fileDeleted, folderDeletedId)).entry.id; + const fileInFolderId = (await nodesApi.createFile(fileInFolder, folderNotDeletedId)).entry.id; + + await nodesApi.deleteNodes([fileSiteId, fileUserId, fileInFolderId, fileDeletedId, folderDeletedId], false); + } catch (error) { + console.error(`----- beforeAll failed : ${error}`); + } + }); + + test.afterAll(async () => { + await nodesApi.deleteCurrentUserNodes(); + await siteActionsAdmin.deleteSites([siteName]); + }); + + test.describe(`Regular user's personal files`, () => { + test.beforeEach(async ({ page }) => { + const loginPage = new LoginPage(page); + await loginPage.loginUser( + { username, password: username }, + { + withNavigation: true, + waitForLoading: true + } + ); + }); + + test.beforeEach(async ({ trashPage }) => { + await trashPage.navigate(); + }); + + test('[C280494] has the correct columns', async ({ trashPage }) => { + const expectedColumns = ['Name', 'Location', 'Size', 'Deleted']; + const actualColumns = await trashPage.dataTable.getColumnHeaders(); + + expect(actualColumns).toEqual(expectedColumns); + }); + + test('[C213219] default sorting column', async ({ trashPage }) => { + expect(await trashPage.dataTable.getSortedColumnHeaderText()).toBe('Deleted'); + expect(await trashPage.dataTable.getSortingOrder()).toBe('desc'); + }); + + test('[C280500] Location column is empty if parent folder no longer exists', async ({ trashPage }) => { + expect(await trashPage.dataTable.getItemLocationText(fileDeleted)).toEqual(''); + }); + + test('[C217144] Location column redirect - file in user Home', async ({ trashPage }) => { + await trashPage.dataTable.clickItemLocation(fileUser); + await trashPage.dataTable.spinnerWaitForReload(); + expect(await trashPage.breadcrumb.getAllItems()).toEqual(['Personal Files']); + }); + + test('[C280496] Location column redirect - file in folder', async ({ trashPage }) => { + await trashPage.dataTable.clickItemLocation(fileInFolder); + await trashPage.dataTable.spinnerWaitForReload(); + expect(await trashPage.breadcrumb.getAllItems()).toEqual(['Personal Files', folderNotDeleted]); + }); + + test('[C280497] Location column redirect - file in site', async ({ trashPage }) => { + await trashPage.dataTable.clickItemLocation(fileSite); + await trashPage.dataTable.spinnerWaitForReload(); + expect(await trashPage.breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]); + }); + }); +}); diff --git a/e2e/playwright/list-views/tsconfig.e2e.adf.json b/e2e/playwright/list-views/tsconfig.e2e.adf.json new file mode 100644 index 0000000000..87cbcf775a --- /dev/null +++ b/e2e/playwright/list-views/tsconfig.e2e.adf.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.adf.json", + "compilerOptions": { + "outDir": "../../out-tsc/e2e", + "baseUrl": "./", + "module": "commonjs", + "target": "es2017", + "types": ["jasmine", "jasminewd2", "node"], + "skipLibCheck": true, + "paths": { + "@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"] + } + }, + "exclude": ["node_modules"] +} diff --git a/e2e/playwright/list-views/tsconfig.e2e.json b/e2e/playwright/list-views/tsconfig.e2e.json new file mode 100755 index 0000000000..c317985239 --- /dev/null +++ b/e2e/playwright/list-views/tsconfig.e2e.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/e2e", + "baseUrl": "./", + "module": "commonjs", + "target": "es2017", + "types": ["jasmine", "jasminewd2", "node", "@playwright/test"], + "skipLibCheck": true, + "paths": { + "@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"] + } + }, + "exclude": ["node_modules"] +} diff --git a/e2e/playwright/pagination/src/tests/favorites.ts b/e2e/playwright/pagination/src/tests/favorites.ts index 5205165abc..f71491432e 100644 --- a/e2e/playwright/pagination/src/tests/favorites.ts +++ b/e2e/playwright/pagination/src/tests/favorites.ts @@ -44,21 +44,13 @@ export function favoritesTests(username: string) { expect(await favoritePage.pagination.isNextEnabled()).toBe(true); }); - test('[C280114] Items per page values', async ({ favoritePage }) => { - await favoritePage.pagination.openMaxItemsMenu(); - expect(await (await favoritePage.pagination.getNthItem(1)).innerText()).toBe('25'); - expect(await (await favoritePage.pagination.getNthItem(2)).innerText()).toBe('50'); - expect(await (await favoritePage.pagination.getNthItem(3)).innerText()).toBe('100'); - await favoritePage.pagination.closeMenu(); - }); - test('[C280115] current page menu items', async ({ favoritePage }) => { await favoritePage.pagination.openMaxItemsMenu(); + expect(await favoritePage.pagination.getItemsCount()).toBe(3); await favoritePage.pagination.clickMenuItem('25'); + await favoritePage.dataTable.spinnerWaitForReload(); expect(await favoritePage.pagination.getMaxItems()).toContain('25'); expect(await favoritePage.pagination.getTotalPages()).toContain('of 3'); - expect(await favoritePage.pagination.getItemsCount()).toBe(3); - await favoritePage.pagination.closeMenu(); await favoritePage.pagination.openMaxItemsMenu(); await favoritePage.pagination.clickMenuItem('50'); @@ -89,9 +81,10 @@ export function favoritesTests(username: string) { await favoritePage.pagination.clickMenuItem('25'); expect(await favoritePage.pagination.getMaxItems()).toContain('25'); await favoritePage.pagination.clickOnNextPage(); + await favoritePage.dataTable.spinnerWaitForReload(); expect(await favoritePage.pagination.getRange()).toContain('Showing 26-50 of 51'); - await favoritePage.pagination.clickOnPreviousPage(); + await favoritePage.dataTable.spinnerWaitForReload(); expect(await favoritePage.pagination.getRange()).toContain('Showing 1-25 of 51'); }); diff --git a/e2e/playwright/pagination/src/tests/personal-files.ts b/e2e/playwright/pagination/src/tests/personal-files.ts index c1b4d05c80..03f03b4ad4 100644 --- a/e2e/playwright/pagination/src/tests/personal-files.ts +++ b/e2e/playwright/pagination/src/tests/personal-files.ts @@ -44,20 +44,13 @@ export function personalFilesTests(userName: string, parentName: string) { expect(await personalFiles.pagination.isNextEnabled()).toBe(true); }); - test('[C280078] Items per page values', async ({ personalFiles }) => { - await personalFiles.pagination.openMaxItemsMenu(); - expect(await (await personalFiles.pagination.getNthItem(1)).innerText()).toBe('25'); - expect(await (await personalFiles.pagination.getNthItem(2)).innerText()).toBe('50'); - expect(await (await personalFiles.pagination.getNthItem(3)).innerText()).toBe('100'); - await personalFiles.closeMenu(); - }); - test('[C280079] current page menu items', async ({ personalFiles }) => { await personalFiles.pagination.openMaxItemsMenu(); + expect(await personalFiles.pagination.getItemsCount()).toBe(3); await personalFiles.pagination.clickMenuItem('25'); + await personalFiles.dataTable.spinnerWaitForReload(); expect(await personalFiles.pagination.getMaxItems()).toContain('25'); expect(await personalFiles.pagination.getTotalPages()).toContain('of 3'); - expect(await personalFiles.pagination.getItemsCount()).toBe(3); await personalFiles.pagination.openMaxItemsMenu(); await personalFiles.pagination.clickMenuItem('50'); @@ -86,9 +79,10 @@ export function personalFilesTests(userName: string, parentName: string) { await personalFiles.pagination.clickMenuItem('25'); expect(await personalFiles.pagination.getMaxItems()).toContain('25'); await personalFiles.pagination.clickOnNextPage(); + await personalFiles.dataTable.spinnerWaitForReload(); expect(await personalFiles.pagination.getRange()).toContain('Showing 26-50 of 51'); - await personalFiles.pagination.clickOnPreviousPage(); + await personalFiles.dataTable.spinnerWaitForReload(); expect(await personalFiles.pagination.getRange()).toContain('Showing 1-25 of 51'); }); diff --git a/e2e/protractor/suites/list-views/favorites.test.ts b/e2e/protractor/suites/list-views/favorites.test.ts deleted file mode 100755 index 649dd7c703..0000000000 --- a/e2e/protractor/suites/list-views/favorites.test.ts +++ /dev/null @@ -1,145 +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, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared'; - -describe('Favorites', () => { - const username = `user-${Utils.random()}`; - - const siteName = `site-${Utils.random()}`; - const favFolderName = `favFolder-${Utils.random()}`; - const parentFolder = `parent-${Utils.random()}`; - const fileName1 = `file1-${Utils.random()}.txt`; - const fileName2 = `file2-${Utils.random()}.txt`; - const fileName3 = `file3-${Utils.random()}.txt`; - const fileName4 = `file4-${Utils.random()}.txt`; - - const apis = { - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, breadcrumb } = page; - - const adminApiActions = new AdminActions(); - const userActions = new UserActions(); - - let parentId: string; - let folderId: string; - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - - await adminApiActions.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); - const docLibId = await adminApiActions.sites.getDocLibId(siteName); - await adminApiActions.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER.ROLE); - - const file1Id = (await adminApiActions.nodes.createFile(fileName1, docLibId)).entry.id; - folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id; - parentId = (await apis.user.nodes.createFolder(parentFolder)).entry.id; - const file2Id = (await apis.user.nodes.createFile(fileName2, parentId)).entry.id; - const file3Id = (await apis.user.nodes.createFile(fileName3, parentId)).entry.id; - const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).entry.id; - - await apis.user.favorites.addFavoriteById('file', file1Id); - await apis.user.favorites.addFavoriteById('folder', folderId); - await apis.user.favorites.addFavoriteById('file', file2Id); - await apis.user.favorites.addFavoriteById('file', file3Id); - await apis.user.favorites.addFavoriteById('file', file4Id); - - await userActions.login(username, username); - await userActions.deleteNodes([file3Id, file4Id], false); - await userActions.trashcanApi.restoreDeletedNode(file4Id); - await loginPage.loginWith(username); - }); - - beforeEach(async () => { - await page.clickFavoritesAndWait(); - }); - - afterAll(async () => { - await userActions.login(username, username); - await userActions.deleteNodes([folderId, parentId]); - await userActions.emptyTrashcan(); - - await adminApiActions.login(); - await adminApiActions.deleteSites([siteName]); - }); - - it('[C280482] has the correct columns', async () => { - const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by', 'Tags']; - const actualColumns = await dataTable.getColumnHeadersText(); - - await expect(actualColumns).toEqual(expectedColumns); - }); - - it('[C213226] displays the favorite files and folders', async () => { - expect(await dataTable.getRowsCount()).toEqual(4, 'Incorrect number of items displayed'); - expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`); - expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`); - expect(await dataTable.isItemPresent(favFolderName)).toBe(true, `${favFolderName} not displayed`); - }); - - it(`[C213228] deleted favorite file does not appear`, async () => { - expect(await dataTable.isItemPresent(fileName3)).not.toBe(true, `${fileName3} is displayed`); - }); - - it(`[C213229] file is displayed after it is restored from Trashcan`, async () => { - expect(await dataTable.isItemPresent(fileName4)).toBe(true, `${fileName4} not displayed`); - }); - - it('[C213231] Location column displays the parent folder of the files', async () => { - expect(await dataTable.getItemLocation(fileName1)).toEqual(siteName); - expect(await dataTable.getItemLocation(fileName2)).toEqual(parentFolder); - expect(await dataTable.getItemLocation(favFolderName)).toEqual('Personal Files'); - }); - - it('[C213671] Location column displays a tooltip with the entire path of the file', async () => { - expect(await dataTable.getItemLocationTooltip(fileName1)).toEqual(`File Libraries/${siteName}`); - expect(await dataTable.getItemLocationTooltip(fileName2)).toEqual(`Personal Files/${parentFolder}`); - expect(await dataTable.getItemLocationTooltip(favFolderName)).toEqual('Personal Files'); - }); - - it('[C213650] Location column redirect - item in user Home', async () => { - await dataTable.clickItemLocation(favFolderName); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); - }); - - it('[C280484] Location column redirect - file in folder', async () => { - await dataTable.clickItemLocation(fileName2); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]); - }); - - it('[C280485] Location column redirect - file in site', async () => { - await dataTable.clickItemLocation(fileName1); - expect(await breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]); - }); - - it('[C213230] Navigate into folder from Favorites', async () => { - await dataTable.doubleClickOnRowByName(favFolderName); - await dataTable.waitForEmptyState(); - expect(await breadcrumb.currentItem.getText()).toBe(favFolderName); - }); -}); diff --git a/e2e/protractor/suites/list-views/file-libraries.test.ts b/e2e/protractor/suites/list-views/file-libraries.test.ts deleted file mode 100755 index 7a9bc6dffb..0000000000 --- a/e2e/protractor/suites/list-views/file-libraries.test.ts +++ /dev/null @@ -1,234 +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, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared'; -import { Logger } from '@alfresco/adf-testing'; - -describe('File Libraries', () => { - const username = `user-${Utils.random()}`; - const password = username; - - 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 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'; - - const apis = { - user: new RepoClient(username, password) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - const adminApiActions = new AdminActions(); - - const sortAlphabetically = (a: string, b: string) => a.localeCompare(b); - const sortAndCompare = (actual: string[], expected: string[]) => { - actual.sort(sortAlphabetically); - expected.sort(sortAlphabetically); - expect(actual).toEqual(expected); - }; - - beforeAll(async () => { - try { - await adminApiActions.createUser({ username }); - - 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); - - 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.createSite(adminSite5, SITE_VISIBILITY.PUBLIC); - await adminApiActions.sites.createSite(adminSite6, 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.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); - } catch (error) { - Logger.error(`----- beforeAll failed : ${error}`); - } - }); - - afterAll(async () => { - await apis.user.sites.deleteSites([userSitePublic, userSiteModerated, userSitePrivate, siteId1, siteId2]); - await adminApiActions.sites.deleteSites([adminSite1, adminSite2, adminSite3, adminSite4, adminSite5, adminSite6]); - }); - - describe('My Libraries', () => { - beforeEach(async () => { - await page.goToMyLibrariesAndWait(); - }); - - it('[C217095] has the correct columns', async () => { - const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility']; - const actualColumns = await dataTable.getColumnHeadersText(); - - await expect(actualColumns).toEqual(expectedColumns); - }); - - it('[C280501] User can see only the sites he is a member of', async () => { - const sitesCount = await dataTable.getRowsCount(); - - expect(sitesCount).toEqual(10, 'Incorrect number of sites displayed'); - expect(await dataTable.isItemPresent(adminSite5)).toBe(false, `${adminSite5} should not appear in the list`); - }); - - it('[C289905] Library visibility is correctly displayed', async () => { - 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('[C289903] User role is correctly displayed', 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 sitesList = await dataTable.getSitesNameAndRole(); - - for (const site of Object.keys(expectedSitesRoles)) { - expect(sitesList[site]).toEqual(expectedSitesRoles[site]); - } - }); - - it('[C217098] Site ID is displayed when two sites have the same name', async () => { - const expectedSites = [`${siteName} (${siteId1})`, `${siteName} (${siteId2})`]; - const actualSites = await dataTable.getCellsContainingName(siteName); - sortAndCompare(actualSites, expectedSites); - }); - - it('[C217096] Tooltip for sites without description', async () => { - const tooltip = await dataTable.getItemNameTooltip(userSitePrivate); - expect(tooltip).toBe(`${userSitePrivate}`); - }); - - it('[C217097] Tooltip for sites with description', async () => { - const tooltip = await dataTable.getItemNameTooltip(userSiteModerated); - expect(tooltip).toBe(`${siteDescription}`); - }); - }); - - describe('Favorite Libraries', () => { - beforeEach(async () => { - await page.goToFavoriteLibrariesAndWait(); - }); - - it('[C289893] has the correct columns', async () => { - const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility']; - const actualColumns = await dataTable.getColumnHeadersText(); - - await expect(actualColumns).toEqual(expectedColumns); - }); - - it('[C289897] User can see only his favorite sites', async () => { - const sitesCount = await dataTable.getRowsCount(); - - expect(sitesCount).toEqual(9, 'Incorrect number of sites displayed'); - expect(await dataTable.isItemPresent(adminSite6)).toBe(false, `${adminSite6} should not appear`); - }); - - it('[C289906] Library visibility is correctly displayed', async () => { - 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('[C289904] User role is correctly displayed', 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 sitesList = await dataTable.getSitesNameAndRole(); - - for (const site of Object.keys(expectedSitesRoles)) { - expect(sitesList[site]).toEqual(expectedSitesRoles[site]); - } - }); - - it('[C289896] Site ID is displayed when two sites have the same name', async () => { - const expectedSites = [`${siteName} (${siteId1})`, `${siteName} (${siteId2})`]; - const actualSites = await dataTable.getCellsContainingName(siteName); - sortAndCompare(actualSites, expectedSites); - }); - - it('[C289894] Tooltip for sites without description', async () => { - const tooltip = await dataTable.getItemNameTooltip(userSitePrivate); - expect(tooltip).toBe(`${userSitePrivate}`); - }); - - it('[C289895] Tooltip for sites with description', async () => { - const tooltip = await dataTable.getItemNameTooltip(userSiteModerated); - expect(tooltip).toBe(`${siteDescription}`); - }); - }); -}); diff --git a/e2e/protractor/suites/list-views/personal-files.test.ts b/e2e/protractor/suites/list-views/personal-files.test.ts deleted file mode 100755 index 03d2e83852..0000000000 --- a/e2e/protractor/suites/list-views/personal-files.test.ts +++ /dev/null @@ -1,124 +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 { browser } from 'protractor'; - -import { AdminActions, APP_ROUTES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared'; - -describe('Personal Files', () => { - const username = `user-${Utils.random()}`; - - const apis = { - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - - const adminFolder = `admin-folder-${Utils.random()}`; - - const userFolder = `user-folder-${Utils.random()}`; - const userFile = `file-${Utils.random()}.txt`; - const adminApiActions = new AdminActions(); - - beforeAll(async () => { - await Promise.all([adminApiActions.createUser({ username }), adminApiActions.nodes.createFolders([adminFolder])]); - await apis.user.nodes.createFolders([userFolder]); - await apis.user.nodes.createFiles([userFile], userFolder); - }); - - afterAll(async () => { - await Promise.all([adminApiActions.nodes.deleteNodes([adminFolder]), apis.user.nodes.deleteNodes([userFolder])]); - }); - - describe(`Admin user's personal files`, () => { - beforeAll(async () => { - await loginPage.loginWithAdmin(); - }); - - beforeEach(async () => { - await page.clickPersonalFilesAndWait(); - }); - - it('[C213241] has Data Dictionary and created content', async () => { - expect(await dataTable.isItemPresent('Data Dictionary')).toBe(true, 'Data Dictionary not displayed'); - expect(await dataTable.isItemPresent(adminFolder)).toBe(true, 'admin folder not displayed'); - }); - }); - - describe(`Regular user's personal files`, () => { - beforeAll(async () => { - await loginPage.loginWith(username); - }); - - beforeEach(async () => { - await page.clickPersonalFilesAndWait(); - }); - - it('[C217142] has the correct columns', async () => { - const expectedColumns = ['Name', 'Size', 'Modified', 'Modified by', 'Tags']; - const actualColumns = await dataTable.getColumnHeadersText(); - - await expect(actualColumns).toEqual(expectedColumns); - }); - - it('[C217143] has default sorted column', async () => { - expect(await dataTable.getSortedColumnHeaderText()).toBe('Name'); - }); - - it('[C213242] has user created content', async () => { - expect(await dataTable.isItemPresent(userFolder)).toBe(true, 'user folder not displayed'); - }); - - it('[C213244] navigates to folder', async () => { - const nodeId = (await apis.user.nodes.getNodeByPath(`/${userFolder}`)).entry.id; - - await dataTable.doubleClickOnRowByName(userFolder); - await dataTable.waitForHeader(); - - expect(await browser.getCurrentUrl()).toContain(nodeId, 'Node ID is not in the URL'); - expect(await dataTable.isItemPresent(userFile)).toBe(true, 'user file is missing'); - }); - - it('[C213245] redirects to Personal Files on clicking the link from sidebar', async () => { - await page.dataTable.doubleClickOnRowByName(userFolder); - await page.clickPersonalFiles(); - const url = await browser.getCurrentUrl(); - expect(url.endsWith(APP_ROUTES.PERSONAL_FILES)).toBe(true, 'incorrect url'); - }); - - it('[C213246] page loads correctly after browser refresh', async () => { - await page.refresh(); - expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); - }); - - it('[C213247] page load by URL', async () => { - const url = await browser.getCurrentUrl(); - await page.clickTrash(); - await browser.get(url); - expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); - }); - }); -}); diff --git a/e2e/protractor/suites/list-views/recent-files.test.ts b/e2e/protractor/suites/list-views/recent-files.test.ts deleted file mode 100755 index 5a9231878f..0000000000 --- a/e2e/protractor/suites/list-views/recent-files.test.ts +++ /dev/null @@ -1,134 +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, SITE_VISIBILITY, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared'; - -describe('Recent Files', () => { - const username = `user-${Utils.random()}`; - - const folderName = `folder-${Utils.random()}`; - let folderId: string; - const fileName1 = `file-${Utils.random()}.txt`; - const fileName2 = `file-${Utils.random()}.txt`; - let file2Id: string; - const fileName3 = `file-${Utils.random()}.txt`; - - const siteName = `site-${Utils.random()}`; - const folderSite = `folder2-${Utils.random()}`; - let folderSiteId: string; - const fileSite = `file-${Utils.random()}.txt`; - - const apis = { - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, breadcrumb } = page; - - const adminApiActions = new AdminActions(); - const userActions = new UserActions(); - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - - folderId = (await apis.user.nodes.createFolders([folderName])).entry.id; - await apis.user.nodes.createFiles([fileName1], folderName); - file2Id = (await apis.user.nodes.createFiles([fileName2])).entry.id; - const id = (await apis.user.nodes.createFiles([fileName3])).entry.id; - - await userActions.login(username, username); - await userActions.deleteNodes([id], false); - - await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); - const docLibId = await apis.user.sites.getDocLibId(siteName); - folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id; - await apis.user.nodes.createFile(fileSite, folderSiteId); - - await apis.user.search.waitForApi(username, { expect: 3 }); - - await loginPage.loginWith(username); - }); - - beforeEach(async () => { - await page.clickRecentFilesAndWait(); - }); - - afterAll(async () => { - await userActions.login(username, username); - await userActions.deleteNodes([folderId, file2Id]); - await userActions.deleteSites([siteName]); - await userActions.emptyTrashcan(); - }); - - it('[C213168] has the correct columns', async () => { - const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Tags']; - const actualColumns = await dataTable.getColumnHeadersText(); - - await expect(actualColumns).toEqual(expectedColumns); - }); - - it('[C213171] default sorting column', async () => { - expect(await dataTable.getSortedColumnHeaderText()).toBe('Modified'); - expect(await dataTable.getSortingOrder()).toBe('desc'); - }); - - it('[C213170] displays the files added by the current user in the last 30 days', async () => { - expect(await dataTable.getRowsCount()).toEqual(3, 'Incorrect number of files displayed'); - expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`); - expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`); - expect(await dataTable.isItemPresent(fileSite)).toBe(true, `${fileSite} not displayed`); - }); - - it(`[C213174] file not displayed if it's been deleted`, async () => { - expect(await dataTable.isItemPresent(fileName3)).not.toBe(true, `${fileName3} is displayed`); - }); - - it('[C213175] Location column displays the parent folder of the file', async () => { - expect(await dataTable.getItemLocation(fileName1)).toEqual(folderName); - expect(await dataTable.getItemLocation(fileName2)).toEqual('Personal Files'); - expect(await dataTable.getItemLocation(fileSite)).toEqual(folderSite); - }); - - it('[C213177] Location column displays a tooltip with the entire path of the file', async () => { - expect(await dataTable.getItemLocationTooltip(fileName1)).toEqual(`Personal Files/${folderName}`); - expect(await dataTable.getItemLocationTooltip(fileName2)).toEqual('Personal Files'); - expect(await dataTable.getItemLocationTooltip(fileSite)).toEqual(`File Libraries/${siteName}/${folderSite}`); - }); - - it('[C213176] Location column redirect - file in user Home', async () => { - await dataTable.clickItemLocation(fileName2); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); - }); - - it('[C280486] Location column redirect - file in folder', async () => { - await dataTable.clickItemLocation(fileName1); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', folderName]); - }); - - it('[C280487] Location column redirect - file in site', async () => { - await dataTable.clickItemLocation(fileSite); - expect(await breadcrumb.getAllItems()).toEqual(['My Libraries', siteName, folderSite]); - }); -}); diff --git a/e2e/protractor/suites/list-views/shared-files.test.ts b/e2e/protractor/suites/list-views/shared-files.test.ts deleted file mode 100755 index 27b93a4aa7..0000000000 --- a/e2e/protractor/suites/list-views/shared-files.test.ts +++ /dev/null @@ -1,141 +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, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared'; - -describe('Shared Files', () => { - const username = `user-${Utils.random()}`; - const password = username; - - const siteName = `site-${Utils.random()}`; - const fileAdmin = `fileSite-${Utils.random()}.txt`; - - const folderUser = `folder-${Utils.random()}`; - let folderId: string; - const file1User = `file1-${Utils.random()}.txt`; - let file1Id: string; - const file2User = `file2-${Utils.random()}.txt`; - let file2Id: string; - const file3User = `file3-${Utils.random()}.txt`; - let file3Id: string; - const file4User = `file4-${Utils.random()}.txt`; - let file4Id: string; - - const apis = { - user: new RepoClient(username, password) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, breadcrumb } = page; - const adminApiActions = new AdminActions(); - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - await adminApiActions.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); - await adminApiActions.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER.ROLE); - const docLibId = await adminApiActions.sites.getDocLibId(siteName); - const nodeId = (await adminApiActions.nodes.createFile(fileAdmin, docLibId)).entry.id; - - await adminApiActions.shareNodes([nodeId]); - await adminApiActions.shared.waitForFilesToBeShared([nodeId]); - - folderId = (await apis.user.nodes.createFolder(folderUser)).entry.id; - file1Id = (await apis.user.nodes.createFile(file1User, folderId)).entry.id; - file2Id = (await apis.user.nodes.createFile(file2User)).entry.id; - file3Id = (await apis.user.nodes.createFile(file3User)).entry.id; - file4Id = (await apis.user.nodes.createFile(file4User)).entry.id; - - await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]); - await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]); - - await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.shared.unshareFileById(file3Id); - - await apis.user.shared.waitForFilesToNotBeShared([file2Id, file3Id]); - - await loginPage.loginWith(username); - }); - - beforeEach(async () => { - await page.clickSharedFilesAndWait(); - }); - - afterAll(async () => { - await adminApiActions.sites.deleteSite(siteName); - await apis.user.nodes.deleteNodeById(folderId); - await apis.user.nodes.deleteNodeById(file4Id); - }); - - it('[C213113] has the correct columns', async () => { - const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by', 'Tags']; - const actualColumns = await dataTable.getColumnHeadersText(); - - await expect(actualColumns).toEqual(expectedColumns); - }); - - it('[C213115] default sorting column', async () => { - expect(await dataTable.getSortedColumnHeaderText()).toBe('Modified'); - expect(await dataTable.getSortingOrder()).toBe('desc'); - }); - - it('[C213114] displays the files shared by everyone', async () => { - expect(await dataTable.isItemPresent(fileAdmin)).toBe(true, `${fileAdmin} not displayed`); - expect(await dataTable.isItemPresent(file1User)).toBe(true, `${file1User} not displayed`); - }); - - it(`[C213117] file not displayed if it's been deleted`, async () => { - expect(await dataTable.isItemPresent(file2User)).toBe(false, `${file2User} is displayed`); - }); - - it('[C213118] unshared file is not displayed', async () => { - expect(await dataTable.isItemPresent(file3User)).toBe(false, `${file3User} is displayed`); - }); - - it('[C213665] Location column displays the parent folder of the file', async () => { - expect(await dataTable.getItemLocationTooltip(file4User)).toEqual('Personal Files'); - expect(await dataTable.getItemLocation(fileAdmin)).toEqual(siteName); - expect(await dataTable.getItemLocation(file1User)).toEqual(folderUser); - }); - - it('[C213666] Location column redirect - file in user Home', async () => { - await dataTable.clickItemLocation(file4User); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); - }); - - it('[C280490] Location column redirect - file in folder', async () => { - await dataTable.clickItemLocation(file1User); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', folderUser]); - }); - - it('[C280491] Location column redirect - file in site', async () => { - await dataTable.clickItemLocation(fileAdmin); - expect(await breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]); - }); - - it('[C213667] Location column displays a tooltip with the entire path of the file', async () => { - expect(await dataTable.getItemLocationTooltip(fileAdmin)).toEqual(`File Libraries/${siteName}`); - expect(await dataTable.getItemLocationTooltip(file1User)).toEqual(`Personal Files/${folderUser}`); - }); -}); diff --git a/e2e/protractor/suites/list-views/tooltips.test.ts b/e2e/protractor/suites/list-views/tooltips.test.ts deleted file mode 100755 index 91702247bb..0000000000 --- a/e2e/protractor/suites/list-views/tooltips.test.ts +++ /dev/null @@ -1,278 +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, Utils, RepoClient } from '@alfresco/aca-testing-shared'; - -describe('File / folder tooltips', () => { - const username = `user-${Utils.random()}`; - - const apis = { - user: new RepoClient(username, username) - }; - - const parent = `parent-${Utils.random()}`; - - const file = `file1-${Utils.random()}`; - const fileWithDesc = `file2-${Utils.random()}`; - const fileWithTitle = `file3-${Utils.random()}`; - const fileWithTitleAndDesc = `file4-${Utils.random()}`; - const fileNameEqTitleEqDesc = `file5-${Utils.random()}`; - const fileNameEqTitleDiffDesc = `file6-${Utils.random()}`; - const fileNameEqDescDiffTitle = `file7-${Utils.random()}`; - const fileTitleEqDesc = `file8-${Utils.random()}`; - let parentId: string; - let file1Id: string; - let file2Id: string; - let file3Id: string; - let file4Id: string; - let file5Id: string; - let file6Id: string; - let file7Id: string; - let file8Id: string; - - const fileTitle = 'file title'; - const fileDescription = 'file description'; - - 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; - - file1Id = (await apis.user.nodes.createFile(file, parentId)).entry.id; - file2Id = (await apis.user.nodes.createFile(fileWithDesc, parentId, '', fileDescription)).entry.id; - file3Id = (await apis.user.nodes.createFile(fileWithTitle, parentId, fileTitle)).entry.id; - file4Id = (await apis.user.nodes.createFile(fileWithTitleAndDesc, parentId, fileTitle, fileDescription)).entry.id; - file5Id = (await apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)).entry.id; - file6Id = (await apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentId, fileNameEqTitleDiffDesc, fileDescription)).entry.id; - file7Id = (await apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentId, fileTitle, fileNameEqDescDiffTitle)).entry.id; - file8Id = (await apis.user.nodes.createFile(fileTitleEqDesc, parentId, fileTitle, fileTitle)).entry.id; - - await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id]); - await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id]); - - await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id]); - - await loginPage.loginWith(username); - }); - - afterAll(async () => { - await userActions.login(username, username); - await userActions.deleteNodes([parentId]); - await userActions.emptyTrashcan(); - }); - - describe('on Personal Files', () => { - beforeAll(async () => { - await page.clickPersonalFilesAndWait(); - await dataTable.doubleClickOnRowByName(parent); - }); - - it('[C255871] File with name, no title, no description', async () => { - expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`); - }); - - it('[C255872] File with name and description, no title', async () => { - expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); - }); - - it('[C255873] File with name and title, no description', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); - }); - - it('[C255874] File with name and title and description, all different', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); - }); - - it('[C255875] File with name and title and description, all equal', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); - }); - - it('[C255876] File with name = title, different description', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); - }); - - it('[C255877] File with name = description, different title', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); - }); - - it('[C255878] File with title = description, different name', async () => { - expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); - }); - }); - - describe('on Recent Files', () => { - beforeAll(async () => { - await apis.user.search.waitForApi(username, { expect: 8 }); - await page.clickRecentFilesAndWait(); - }); - - it('[C280135] File with name, no title, no description', async () => { - expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`); - }); - - it('[C280136] File with name and description, no title', async () => { - expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); - }); - - it('[C280137] File with name and title, no description', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); - }); - - it('[C280138] File with name and title and description, all different', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); - }); - - it('[C280139] File with name and title and description, all equal', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); - }); - - it('[C280140] File with name = title, different description', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); - }); - - it('[C280141] File with name = description, different title', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); - }); - - it('[C280142] File with title = description, different name', async () => { - expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); - }); - }); - - describe('on Favorites', () => { - beforeAll(async () => { - await page.clickFavoritesAndWait(); - }); - - it('[C280151] File with name, no title, no description', async () => { - expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`); - }); - - it('[C280152] File with name and description, no title', async () => { - expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); - }); - - it('[C280153] File with name and title, no description', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); - }); - - it('[C280154] File with name and title and description, all different', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); - }); - - it('[C280155] File with name and title and description, all equal', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); - }); - - it('[C280156] File with name = title, different description', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); - }); - - it('[C280157] File with name = description, different title', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); - }); - - it('[C280158] File with title = description, different name', async () => { - expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); - }); - }); - - describe('on Trash', () => { - const parentForTrash = `parent-${Utils.random()}`; - let parentForTrashId: string; - let file1TrashId: string; - let file2TrashId: string; - let file3TrashId: string; - let file4TrashId: string; - let file5TrashId: string; - let file6TrashId: string; - let file7TrashId: string; - let file8TrashId: string; - - beforeAll(async () => { - parentForTrashId = (await apis.user.nodes.createFolder(parentForTrash)).entry.id; - file1TrashId = (await apis.user.nodes.createFile(file, parentForTrashId)).entry.id; - file2TrashId = (await apis.user.nodes.createFile(fileWithDesc, parentForTrashId, '', fileDescription)).entry.id; - file3TrashId = (await apis.user.nodes.createFile(fileWithTitle, parentForTrashId, fileTitle)).entry.id; - file4TrashId = (await apis.user.nodes.createFile(fileWithTitleAndDesc, parentForTrashId, fileTitle, fileDescription)).entry.id; - file5TrashId = (await apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentForTrashId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)).entry - .id; - file6TrashId = (await apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentForTrashId, fileNameEqTitleDiffDesc, fileDescription)).entry.id; - file7TrashId = (await apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentForTrashId, fileTitle, fileNameEqDescDiffTitle)).entry.id; - file8TrashId = (await apis.user.nodes.createFile(fileTitleEqDesc, parentForTrashId, fileTitle, fileTitle)).entry.id; - - await apis.user.nodes.deleteNodesById( - [file1TrashId, file2TrashId, file3TrashId, file4TrashId, file5TrashId, file6TrashId, file7TrashId, file8TrashId], - false - ); - - await page.clickTrashAndWait(); - }); - - afterAll(async () => { - await userActions.login(username, username); - await userActions.deleteNodes([parentForTrashId]); - await userActions.emptyTrashcan(); - }); - - it('[C280159] File with name, no title, no description', async () => { - expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`); - }); - - it('[C280160] File with name and description, no title', async () => { - expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); - }); - - it('[C280161] File with name and title, no description', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); - }); - - it('[C280162] File with name and title and description, all different', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); - }); - - it('[C280163] File with name and title and description, all equal', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); - }); - - it('[C280164] File with name = title, different description', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); - }); - - it('[C280165] File with name = description, different title', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); - }); - - it('[C280166] File with title = description, different name', async () => { - expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); - }); - }); -}); diff --git a/e2e/protractor/suites/list-views/trash.test.ts b/e2e/protractor/suites/list-views/trash.test.ts index f6ca1aa37b..b6cae2a866 100755 --- a/e2e/protractor/suites/list-views/trash.test.ts +++ b/e2e/protractor/suites/list-views/trash.test.ts @@ -58,7 +58,7 @@ describe('Trash', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable, breadcrumb } = page; + const { dataTable } = page; const adminApiActions = new AdminActions(); const userActions = new UserActions(); @@ -119,75 +119,5 @@ describe('Trash', () => { expect(actualColumns).toEqual(expectedColumns); }); - - it('[C280493] displays the files and folders deleted by everyone', async () => { - expect(await dataTable.isItemPresent(fileAdmin)).toBe(true, `${fileAdmin} not displayed`); - expect(await dataTable.isItemPresent(folderAdmin)).toBe(true, `${folderAdmin} not displayed`); - expect(await dataTable.isItemPresent(fileUser)).toBe(true, `${fileUser} not displayed`); - expect(await dataTable.isItemPresent(folderUser)).toBe(true, `${folderUser} not displayed`); - expect(await dataTable.isItemPresent(fileSite)).toBe(true, `${fileSite} not displayed`); - }); - }); - - describe('as user', () => { - beforeAll(async () => { - await loginPage.loginWith(username); - }); - - beforeEach(async () => { - await page.clickTrashAndWait(); - }); - - it('[C280494] has the correct columns', async () => { - const expectedColumns = ['Name', 'Location', 'Size', 'Deleted']; - const actualColumns = await dataTable.getColumnHeadersText(); - - expect(actualColumns).toEqual(expectedColumns); - }); - - it('[C213218] displays the files and folders deleted by the user', async () => { - expect(await dataTable.getRowsCount()).toEqual(6, 'Incorrect number of deleted items displayed'); - - expect(await dataTable.isItemPresent(fileSite)).toBe(true, `${fileSite} not displayed`); - expect(await dataTable.isItemPresent(fileUser)).toBe(true, `${fileUser} not displayed`); - expect(await dataTable.isItemPresent(folderUser)).toBe(true, `${folderUser} not displayed`); - expect(await dataTable.isItemPresent(fileAdmin)).toBe(false, `${fileAdmin} is displayed`); - }); - - it('[C213219] default sorting column', async () => { - expect(await dataTable.getSortedColumnHeaderText()).toBe('Deleted'); - expect(await dataTable.getSortingOrder()).toBe('desc'); - }); - - it('[C280498] Location column displays the parent folder of the file', async () => { - expect(await dataTable.getItemLocation(fileInFolder)).toEqual(folderNotDeleted); - expect(await dataTable.getItemLocation(fileUser)).toEqual('Personal Files'); - expect(await dataTable.getItemLocation(fileSite)).toEqual(siteName); - }); - - it('[C280499] Location column displays a tooltip with the entire path of the file', async () => { - expect(await dataTable.getItemLocationTooltip(fileInFolder)).toEqual(`Personal Files/${folderNotDeleted}`); - expect(await dataTable.getItemLocationTooltip(fileUser)).toEqual('Personal Files'); - expect(await dataTable.getItemLocationTooltip(fileSite)).toEqual(`File Libraries/${siteName}`); - }); - - it('[C280500] Location column is empty if parent folder no longer exists', async () => { - expect(await dataTable.getItemLocation(fileDeleted)).toEqual(''); - }); - - it('[C217144] Location column redirect - file in user Home', async () => { - await dataTable.clickItemLocation(fileUser); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); - }); - - it('[C280496] Location column redirect - file in folder', async () => { - await dataTable.clickItemLocation(fileInFolder); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', folderNotDeleted]); - }); - - it('[C280497] Location column redirect - file in site', async () => { - await dataTable.clickItemLocation(fileSite); - expect(await breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]); - }); }); }); diff --git a/projects/aca-playwright-shared/src/api/shared-links-api.ts b/projects/aca-playwright-shared/src/api/shared-links-api.ts index 48800b8cc9..b7f995a32f 100755 --- a/projects/aca-playwright-shared/src/api/shared-links-api.ts +++ b/projects/aca-playwright-shared/src/api/shared-links-api.ts @@ -73,7 +73,7 @@ export class SharedLinksApi { return await this.apiService.share.listSharedLinks(opts); } catch (error) { console.error(`SharedLinksApi getSharedLinks : catch : `, error); - return new SharedLinkPaging; + return new SharedLinkPaging(); } } @@ -95,4 +95,47 @@ export class SharedLinksApi { console.error(`\tWait timeout reached waiting for files to be shared`); } } + + private async getSharedIdOfNode(fileId: string): Promise { + try { + const sharedLinksEntries = (await this.getSharedLinks())?.list.entries; + const found = sharedLinksEntries.find((sharedLink) => sharedLink.entry.nodeId === fileId); + return found?.entry.id; + } catch (error) { + console.error(`SharedLinksApi getSharedIdOfNode : catch : `, error); + return null; + } + } + + async unshareFileById(fileId: string): Promise { + try { + const sharedId = await this.getSharedIdOfNode(fileId); + return await this.apiService.share.deleteSharedLink(sharedId); + } catch (error) { + console.error(`SharedLinksApi unshareFileById : catch : `, error); + } + } + + async waitForFilesToNotBeShared(filesIds: string[]): Promise { + try { + const sharedFile = async () => { + const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId); + + const foundItems = filesIds.some((id) => { + return sharedFiles.includes(id); + }); + + if (foundItems) { + return Promise.reject(foundItems); + } else { + return Promise.resolve(foundItems); + } + }; + + return await Utils.retryCall(sharedFile); + } catch (error) { + console.error(`SharedLinksApi waitForFilesToNotBeShared : catch : ${error}`); + console.error(`\tWait timeout reached waiting for files to no longer be shared`); + } + } } diff --git a/projects/aca-playwright-shared/src/fixtures/page-initialization.ts b/projects/aca-playwright-shared/src/fixtures/page-initialization.ts index c4b28a0c26..62d66c3944 100644 --- a/projects/aca-playwright-shared/src/fixtures/page-initialization.ts +++ b/projects/aca-playwright-shared/src/fixtures/page-initialization.ts @@ -50,6 +50,7 @@ interface Pages { sharedPage: SharedPage; searchPage: SearchPage; favoritePage: FavoritesPage; + favoritesLibrariesPage: FavoritesLibrariesPage; trashPage: TrashPage; loginPage: LoginPage; favoriteLibrariesPage: FavoritesLibrariesPage; @@ -82,6 +83,9 @@ export const test = base.extend({ favoritePage: async ({ page }, use) => { await use(new FavoritesPage(page)); }, + favoritesLibrariesPage: async ({ page }, use) => { + await use(new FavoritesLibrariesPage(page)); + }, trashPage: async ({ page }, use) => { await use(new TrashPage(page)); }, diff --git a/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts index a9dee96d11..430c3de7ae 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts @@ -26,6 +26,7 @@ import { Locator, Page } from '@playwright/test'; import { BaseComponent } from '../base.component'; import { MatMenuComponent } from './mat-menu.component'; import { PaginationActionsType, PaginationComponent } from '../pagination.component'; +import { timeouts } from '../../../utils'; export class DataTableComponent extends BaseComponent { private static rootElement = 'adf-datatable'; @@ -40,6 +41,9 @@ export class DataTableComponent extends BaseComponent { getEmptyContentTitleLocator = this.getChild('adf-empty-content .adf-empty-content__title'); getEmptyContentSubTitleLocator = this.getChild('adf-empty-content .adf-empty-content__subtitle'); getSelectedRow = this.getChild('.adf-datatable-row.adf-is-selected'); + sortedColumnHeader = this.getChild(`.adf-datatable__header--sorted-asc .adf-datatable-cell-header-content .adf-datatable-cell-value, + .adf-datatable__header--sorted-desc .adf-datatable-cell-header-content .adf-datatable-cell-value`); + columnHeaders = this.getChild('.adf-datatable-row .adf-datatable-cell-header .adf-datatable-cell-value'); /** Locator for row (or rows) */ getRowLocator = this.getChild(`adf-datatable-row`); @@ -188,7 +192,7 @@ export class DataTableComponent extends BaseComponent { async goThroughPagesLookingForRowWithName(name: string | number): Promise { await this.spinnerWaitForReload(); - if (await this.getRowByName(name).isVisible()) { + if ((await this.getRowByName(name).isVisible()) || (await this.pagination.totalPageLocator.textContent()) === ' of 1 ') { return null; } @@ -234,4 +238,47 @@ export class DataTableComponent extends BaseComponent { const row = this.getRowByName(itemName); return await row.locator('.adf-datatable-selected').isVisible(); } + + async getColumnHeaders(): Promise> { + const columnNameLocator = this.columnHeaders; + await this.columnHeaders.nth(0).waitFor({ state: 'attached' }); + return columnNameLocator.allTextContents(); + } + + async getSortedColumnHeaderText(): Promise { + return this.sortedColumnHeader.innerText(); + } + + private getItemLocationEl(name: string): Locator { + return this.getRowByName(name).locator('.aca-location-link'); + } + + async getItemLocationText(name: string): Promise { + await this.getItemLocationEl(name).locator('a').waitFor({ state: 'attached' }); + return this.getItemLocationEl(name).innerText(); + } + + async getItemLocationTooltip(name: string): Promise { + const location = this.getItemLocationEl(name); + await location.hover(); + return location.locator('a').getAttribute('title', { timeout: timeouts.normal }); + } + + async clickItemLocation(name: string): Promise { + await this.getItemLocationEl(name).click(); + } + + async getSortingOrder(): Promise { + const str = await this.sortedColumnHeader.locator('../..').getAttribute('class'); + if (str.includes('asc')) { + return 'asc'; + } else if (str.includes('desc')) { + return 'desc'; + } + return 'none'; + } + + async getRowAllInnerTexts(name: string): Promise { + return (await this.getRowByName(name).locator('span').allInnerTexts()).toString(); + } } diff --git a/projects/aca-playwright-shared/src/page-objects/pages/favorites.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/favorites.page.ts index 8574042dc1..6a7c47c07e 100644 --- a/projects/aca-playwright-shared/src/page-objects/pages/favorites.page.ts +++ b/projects/aca-playwright-shared/src/page-objects/pages/favorites.page.ts @@ -24,7 +24,7 @@ import { Page } from '@playwright/test'; import { BasePage } from './base.page'; -import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, PaginationComponent } from '../components'; +import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, PaginationComponent, Breadcrumb } from '../components'; import { AcaHeader } from '../components/aca-header.component'; import { AdfFolderDialogComponent, ViewerOverlayDialogComponent } from '../components/dialogs'; @@ -43,6 +43,7 @@ export class FavoritesPage extends BasePage { public viewerDialog = new ViewerOverlayDialogComponent(this.page); public sidenav = new SidenavComponent(this.page); public pagination = new PaginationComponent(this.page); + public breadcrumb = new Breadcrumb(this.page); async waitForPageLoad() { await this.page.waitForURL(`**/${FavoritesPage.pageUrl}`); diff --git a/projects/aca-playwright-shared/src/page-objects/pages/recent-files.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/recent-files.page.ts index 2fedf41f6d..98d0ddb3fc 100644 --- a/projects/aca-playwright-shared/src/page-objects/pages/recent-files.page.ts +++ b/projects/aca-playwright-shared/src/page-objects/pages/recent-files.page.ts @@ -24,7 +24,7 @@ import { Page } from '@playwright/test'; import { BasePage } from './base.page'; -import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent } from '../components'; +import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb } from '../components'; import { AcaHeader } from '../components/aca-header.component'; import { AdfFolderDialogComponent } from '../components/dialogs'; @@ -41,4 +41,5 @@ export class RecentFilesPage extends BasePage { public dataTable = new DataTableComponent(this.page); public viewer = new ViewerComponent(this.page); public sidenav = new SidenavComponent(this.page); + public breadcrumb = new Breadcrumb(this.page); } diff --git a/projects/aca-playwright-shared/src/page-objects/pages/shared.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/shared.page.ts index 88372b5e9b..84ecb34ee0 100644 --- a/projects/aca-playwright-shared/src/page-objects/pages/shared.page.ts +++ b/projects/aca-playwright-shared/src/page-objects/pages/shared.page.ts @@ -24,7 +24,7 @@ import { Page } from '@playwright/test'; import { BasePage } from './base.page'; -import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent } from '../components'; +import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb } from '../components'; import { AcaHeader } from '../components/aca-header.component'; import { AdfFolderDialogComponent, ViewerOverlayDialogComponent } from '../components/dialogs'; @@ -42,4 +42,5 @@ export class SharedPage extends BasePage { public viewer = new ViewerComponent(this.page); public viewerDialog = new ViewerOverlayDialogComponent(this.page); public sidenav = new SidenavComponent(this.page); + public breadcrumb = new Breadcrumb(this.page); } diff --git a/projects/aca-playwright-shared/src/page-objects/pages/trash.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/trash.page.ts index b6a512a8de..09a57e123e 100644 --- a/projects/aca-playwright-shared/src/page-objects/pages/trash.page.ts +++ b/projects/aca-playwright-shared/src/page-objects/pages/trash.page.ts @@ -24,7 +24,7 @@ import { Page } from '@playwright/test'; import { BasePage } from './base.page'; -import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent } from '../components'; +import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb } from '../components'; import { AcaHeader } from '../components/aca-header.component'; import { AdfFolderDialogComponent, ViewerOverlayDialogComponent } from '../components/dialogs'; @@ -42,4 +42,5 @@ export class TrashPage extends BasePage { public viewer = new ViewerComponent(this.page); public viewerDialog = new ViewerOverlayDialogComponent(this.page); public sidenav = new SidenavComponent(this.page); + public breadcrumb = new Breadcrumb(this.page); }