diff --git a/e2e/playwright/copy-move-actions/src/tests/move.e2e.ts b/e2e/playwright/copy-move-actions/src/tests/move.e2e.ts index 7e1dd7597..533cac683 100644 --- a/e2e/playwright/copy-move-actions/src/tests/move.e2e.ts +++ b/e2e/playwright/copy-move-actions/src/tests/move.e2e.ts @@ -100,7 +100,6 @@ test.describe('Move actions', () => { test('[XAT-4999] Move a file with a name that already exists on the destination', async ({ personalFiles }) => { await nodesApi.createFile(sourceFile, destinationFolderId); - const expectedNameForCopiedFile = sourceFile.replace('.', '-1.'); await Utils.reloadPageIfRowNotVisible(personalFiles, sourceFile); await moveContentInPersonalFiles(personalFiles, [sourceFile], destinationFolder); const msg = await personalFiles.snackBar.message.innerText(); @@ -108,14 +107,12 @@ test.describe('Move actions', () => { await personalFiles.snackBar.closeIcon.click(); expect.soft(await personalFiles.dataTable.isItemPresent(sourceFile)).toBe(true); await personalFiles.dataTable.performClickFolderOrFileToOpen(destinationFolder); - expect(await personalFiles.dataTable.isItemPresent(sourceFile)).toBe(true); - expect(await personalFiles.dataTable.isItemPresent(expectedNameForCopiedFile)).toBe(false); + expect(await personalFiles.dataTable.getRowsCount()).toBe(1); }); test('[XAT-5000] Move a folder with a name that already exists on the destination', async ({ personalFiles }) => { const existingFolderId = (await nodesApi.createFolder(sourceFolder, destinationFolderId)).entry.id; await nodesApi.createFile(sourceFileInsideFolder, existingFolderId); - const expectedNameForCopiedFile = sourceFileInsideFolder.replace('.', '-1.'); await Utils.reloadPageIfRowNotVisible(personalFiles, sourceFolder); await moveContentInPersonalFiles(personalFiles, [sourceFolder], destinationFolder); const msg = await personalFiles.snackBar.message.innerText(); @@ -125,8 +122,7 @@ test.describe('Move actions', () => { await personalFiles.dataTable.performClickFolderOrFileToOpen(destinationFolder); expect(await personalFiles.dataTable.isItemPresent(sourceFolder)).toBe(true); await personalFiles.dataTable.performClickFolderOrFileToOpen(sourceFolder); - expect(await personalFiles.dataTable.isItemPresent(sourceFileInsideFolder)).toBe(true); - expect(await personalFiles.dataTable.isItemPresent(expectedNameForCopiedFile)).toBe(false); + expect(await personalFiles.dataTable.getRowsCount()).toBe(1); }); test('[XAT-4989] Move locked file', async ({ personalFiles }) => { diff --git a/e2e/playwright/delete-actions/exclude.tests.json b/e2e/playwright/delete-actions/exclude.tests.json index 7507194dc..8d013e76e 100644 --- a/e2e/playwright/delete-actions/exclude.tests.json +++ b/e2e/playwright/delete-actions/exclude.tests.json @@ -1,3 +1,6 @@ { - "all": {} + "all": { + "XAT-5019": "locked files and folders shouldn't be able to be deleted", + "XAT-5021": "ocked files and folders shouldn't be able to be deleted" + } } diff --git a/e2e/playwright/special-permissions-actions-available/src/tests/collaborator-actions.e2e.ts b/e2e/playwright/special-permissions-actions-available/src/tests/collaborator-actions.e2e.ts new file mode 100644 index 000000000..5f4511c87 --- /dev/null +++ b/e2e/playwright/special-permissions-actions-available/src/tests/collaborator-actions.e2e.ts @@ -0,0 +1,238 @@ +/*! + * Copyright © 2005-2026 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 { + ApiClientFactory, + FavoritesApi, + FileActionsApi, + NodesApi, + SearchApi, + SharedLinksApi, + SitesApi, + TEST_FILES, + test, + timeouts, + Utils +} from '@alfresco/aca-playwright-shared'; +import { Site } from '@alfresco/js-api'; +import { checkActionsAvailable, checkActionsViewerAvailable } from './permissions-actions-helpers'; + +const collaboratorToolbarPrimary = ['View', 'View Details', 'More Actions']; +const collaboratorEditRowToolbarMore = [ + 'Edit Offline', + 'Upload New Version', + 'Remove Favorite', + 'Copy', + 'Manage Versions', + 'Edit Aspects', + 'Permissions' +]; +const favoritesCollaboratorToolbarMore = [ + 'Edit Offline', + 'Upload New Version', + 'Remove Favorite', + 'Move', + 'Copy', + 'Delete', + 'Manage Versions', + 'Edit Aspects', + 'Permissions' +]; +const collaboratorSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Print', 'View Details', 'More Actions']; +const collaboratorDocToolbarMore = [ + 'Edit in Microsoft Office™', + 'Edit Offline', + 'Upload New Version', + 'Remove Favorite', + 'Copy', + 'Manage Versions', + 'Edit Aspects', + 'Permissions' +]; + +interface CollaboratorFile { + name: string; + random: string; + office: boolean; + id?: string; +} + +const buildFile = (buildName: (fileRandom: string) => string, office: boolean): CollaboratorFile => { + const fileRandom = Utils.random(); + return { name: buildName(fileRandom), random: fileRandom, office }; +}; + +test.describe('Special permissions - Collaborator available actions : ', () => { + const random = Utils.random(); + const apiClientFactory = new ApiClientFactory(); + const sitePrivate = `site-private-collaborator-${random}`; + const userManager = `manager-collaborator-${random}`; + const userCollaborator = `collaborator-${random}`; + + let docLibId: string; + let managerNodeActions: NodesApi; + let managerSiteActions: SitesApi; + let managerFileActions: FileActionsApi; + let managerSearchActions: SearchApi; + let managerShareActions: SharedLinksApi; + let collaboratorFavoritesActions: FavoritesApi; + + const provisionFile = async (item: CollaboratorFile): Promise => { + test.setTimeout(timeouts.extendedTest); + const collaboratorFavoritesTotalItems = await collaboratorFavoritesActions.getFavoritesTotalItems(userCollaborator); + const managerSearchTotalItems = await managerSearchActions.getTotalItems(userManager); + + if (item.office) { + item.id = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, item.name, docLibId)).entry.id; + } else { + item.id = (await managerNodeActions.createFile(item.name, docLibId, '', '', '', true, ['cm:versionable'])).entry.id; + } + + await managerShareActions.shareFileById(item.id); + await collaboratorFavoritesActions.addFavoriteById('file', item.id); + + await collaboratorFavoritesActions.isFavoriteWithRetry(userCollaborator, item.id, { expect: true }); + await Promise.all([ + collaboratorFavoritesActions.waitForApi(userCollaborator, { expect: collaboratorFavoritesTotalItems + 1 }), + managerShareActions.waitForFilesToBeShared([item.id]), + managerSearchActions.waitForApi(userManager, { expect: managerSearchTotalItems + 1 }) + ]); + }; + + test.beforeAll(async () => { + test.setTimeout(timeouts.extendedTest); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username: userManager }); + await apiClientFactory.createUser({ username: userCollaborator }); + + managerNodeActions = await NodesApi.initialize(userManager, userManager); + managerSiteActions = await SitesApi.initialize(userManager, userManager); + managerFileActions = await FileActionsApi.initialize(userManager, userManager); + managerSearchActions = await SearchApi.initialize(userManager, userManager); + managerShareActions = await SharedLinksApi.initialize(userManager, userManager); + collaboratorFavoritesActions = await FavoritesApi.initialize(userCollaborator, userCollaborator); + + await managerSiteActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); + docLibId = await managerSiteActions.getDocLibId(sitePrivate); + await managerSiteActions.addSiteMember(sitePrivate, userCollaborator, Site.RoleEnum.SiteCollaborator); + }); + + test.beforeEach(async ({ loginPage }) => { + await Utils.tryLoginUser(loginPage, userCollaborator, userCollaborator, 'beforeEach failed'); + }); + + test.afterAll(async () => { + await Utils.deleteNodesSitesEmptyTrashcan(undefined, undefined, 'afterAll failed', managerSiteActions, [sitePrivate]); + }); + + test.describe('My Libraries - row actions', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav.txt`, false); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4844] Toolbar - Actions appear correctly for a file - Collaborator - My Libraries', async ({ myLibrariesPage }) => { + await myLibrariesPage.navigate(); + await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(sitePrivate); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, collaboratorEditRowToolbarMore); + }); + }); + + test.describe('Shared - row actions', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav.txt`, false); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4845] Toolbar - Actions appear correctly for a file - Collaborator - Shared', async ({ sharedPage, myLibrariesPage }) => { + await sharedPage.navigate(); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, collaboratorEditRowToolbarMore); + }); + }); + + test.describe('Favorites - row actions', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav.txt`, false); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4846] Toolbar - Actions appear correctly for a file - Collaborator - Favorites', async ({ favoritePage, myLibrariesPage }) => { + await favoritePage.navigate(); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, favoritesCollaboratorToolbarMore); + }); + }); + + test.describe('Search Results - row actions', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav.txt`, false); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4847] Toolbar - Actions appear correctly for a file - Collaborator - Search Results', async ({ searchPage, myLibrariesPage }) => { + await searchPage.searchWithin(item.random, 'filesAndFolders', 'formula'); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, collaboratorEditRowToolbarMore); + }); + }); + + test.describe('My Libraries - viewer actions', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared-fav.docx`, true); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4848] Correct actions appear for file in viewer - Collaborator - My Libraries', async ({ myLibrariesPage }) => { + await myLibrariesPage.navigate(); + await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(sitePrivate); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorSharedToolbarPrimary, collaboratorDocToolbarMore); + }); + }); + + test.describe('Shared - viewer actions', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared-fav.docx`, true); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4849] Correct actions appear for file in viewer - Collaborator - Shared', async ({ sharedPage, myLibrariesPage }) => { + await sharedPage.navigate(); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorSharedToolbarPrimary, collaboratorDocToolbarMore); + }); + }); + + test.describe('Favorites - viewer actions', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared-fav.docx`, true); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4850] Correct actions appear for file in viewer - Collaborator - Favorites', async ({ favoritePage, myLibrariesPage }) => { + await favoritePage.navigate(); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorSharedToolbarPrimary, collaboratorDocToolbarMore); + }); + }); + + test.describe('Search - viewer actions', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared-fav.docx`, true); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4851] Correct actions appear for file in viewer - Collaborator - Search', async ({ searchPage, myLibrariesPage }) => { + await searchPage.searchWithin(item.random, 'filesAndFolders', 'formula'); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorSharedToolbarPrimary, collaboratorDocToolbarMore); + }); + }); +}); diff --git a/e2e/playwright/special-permissions-actions-available/src/tests/consumer-viewer-actions.e2e.ts b/e2e/playwright/special-permissions-actions-available/src/tests/consumer-viewer-actions.e2e.ts new file mode 100644 index 000000000..bdf287dc3 --- /dev/null +++ b/e2e/playwright/special-permissions-actions-available/src/tests/consumer-viewer-actions.e2e.ts @@ -0,0 +1,813 @@ +/*! + * Copyright © 2005-2026 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 { + ApiClientFactory, + FavoritesApi, + FavoritesPage, + FileActionsApi, + LoginPage, + MyLibrariesPage, + NodesApi, + SearchApi, + SearchPage, + SharedLinksApi, + SharedPage, + SitesApi, + TEST_FILES, + test, + timeouts, + Utils +} from '@alfresco/aca-playwright-shared'; +import { Site } from '@alfresco/js-api'; +import { expect } from '@playwright/test'; + +const viewerPrimary = ['Activate full-screen mode', 'Share', 'Download', 'Print', 'View Details', 'More Actions']; +const viewerSharedPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; +const viewerLockedPrimary = ['Activate full-screen mode', 'View Details', 'More Actions']; +const viewerMore = ['Favorite', 'Copy', 'Manage Versions']; +const viewerFavMore = ['Remove Favorite', 'Copy', 'Manage Versions']; +const viewerLockedMore = ['Favorite', 'Copy']; +const viewerLockedFavMore = ['Favorite', 'Copy']; +const viewerNotVersionableMore = ['Favorite', 'Copy']; + +interface ConsumerFile { + name: string; + random: string; + office: boolean; + versionable: boolean; + favorite: boolean; + shared: boolean; + locked: boolean; + viewerToolbarPrimary: string[]; + viewerToolbarMore: string[]; + expectNoManageVersions?: boolean; + id?: string; +} + +type FileSpec = Pick & + Partial>; + +const buildFile = (buildName: (fileRandom: string) => string, spec: FileSpec): ConsumerFile => { + const fileRandom = Utils.random(); + return { + name: buildName(fileRandom), + random: fileRandom, + office: false, + versionable: false, + favorite: false, + shared: false, + locked: false, + ...spec + }; +}; + +test.describe('Special permissions - Consumer viewer actions : ', () => { + const random = Utils.random(); + const apiClientFactory = new ApiClientFactory(); + const sitePrivate = `site-private-consumer-${random}`; + const userManager = `manager-consumer-${random}`; + const userConsumer = `consumer-${random}`; + + let docLibId: string; + let managerNodeActions: NodesApi; + let managerSiteActions: SitesApi; + let managerFileActions: FileActionsApi; + let managerSearchActions: SearchApi; + let consumerFavoritesActions: FavoritesApi; + let consumerShareActions: SharedLinksApi; + + const login = async (loginPage: LoginPage): Promise => { + await loginPage.navigate(); + await loginPage.loginUser({ username: userConsumer, password: userConsumer }); + }; + + const provisionFile = async (item: ConsumerFile): Promise => { + test.setTimeout(timeouts.extendedTest); + const searchTotalBefore = await managerSearchActions.getTotalItems(userManager); + + if (item.office) { + item.id = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, item.name, docLibId)).entry.id; + } else { + item.id = (await managerNodeActions.createFile(item.name, docLibId, '', '', '', true, item.versionable ? ['cm:versionable'] : [])).entry.id; + } + + if (item.favorite) { + await consumerFavoritesActions.addFavoriteById('file', item.id); + await consumerFavoritesActions.isFavoriteWithRetry(userConsumer, item.id, { expect: true }); + } + if (item.shared) { + await consumerShareActions.shareFileById(item.id); + await consumerShareActions.waitForFilesToBeShared([item.id]); + } + if (item.locked) { + await managerNodeActions.checkoutNodes([item.id]); + } + + await managerSearchActions.waitForApi(userManager, { expect: searchTotalBefore + 1 }); + }; + + const verifyViewerActions = async (page: MyLibrariesPage | FavoritesPage | SharedPage | SearchPage, data: ConsumerFile): Promise => { + expect(await page.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); + await page.viewer.verifyViewerPrimaryActions(data.viewerToolbarPrimary); + await page.viewer.toolbar.clickMoreActions(); + await page.matMenu.verifyActualMoreActions(data.viewerToolbarMore); + + if (data.expectNoManageVersions) { + const actualMoreActions = await page.matMenu.getActualMoreActions(); + expect(actualMoreActions.includes('Manage Versions'), 'Manage Versions should not be visible for a non-versionable file').toBe(false); + } + }; + + const openInLibraries = async (myLibrariesPage: MyLibrariesPage, loginPage: LoginPage, item: string): Promise => { + await login(loginPage); + await myLibrariesPage.navigate(); + await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(sitePrivate); + await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(item); + }; + + const openInFavorites = async (favoritePage: FavoritesPage, loginPage: LoginPage, item: string): Promise => { + await login(loginPage); + await favoritePage.navigate(); + await favoritePage.dataTable.performClickFolderOrFileToOpen(item); + }; + + const openInShared = async (sharedPage: SharedPage, loginPage: LoginPage, item: string): Promise => { + await login(loginPage); + await sharedPage.navigate(); + await sharedPage.dataTable.performClickFolderOrFileToOpen(item); + }; + + const openInSearch = async (searchPage: SearchPage, loginPage: LoginPage, data: ConsumerFile): Promise => { + await login(loginPage); + await searchPage.searchWithin(data.random, 'filesAndFolders', 'formula'); + await searchPage.dataTable.performClickFolderOrFileToOpen(data.name); + }; + + test.beforeAll(async () => { + test.setTimeout(timeouts.extendedTest); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username: userManager }); + await apiClientFactory.createUser({ username: userConsumer }); + + managerNodeActions = await NodesApi.initialize(userManager, userManager); + managerSiteActions = await SitesApi.initialize(userManager, userManager); + managerFileActions = await FileActionsApi.initialize(userManager, userManager); + managerSearchActions = await SearchApi.initialize(userManager, userManager); + consumerFavoritesActions = await FavoritesApi.initialize(userConsumer, userConsumer); + consumerShareActions = await SharedLinksApi.initialize(userConsumer, userConsumer); + + await managerSiteActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); + docLibId = await managerSiteActions.getDocLibId(sitePrivate); + await managerSiteActions.addSiteMember(sitePrivate, userConsumer, Site.RoleEnum.SiteConsumer); + }); + + test.afterAll(async () => { + await Utils.deleteNodesSitesEmptyTrashcan(undefined, undefined, 'afterAll failed', managerSiteActions, [sitePrivate]); + }); + + test.describe('File Libraries - Office file', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx.docx`, { + office: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4808] Actions for Consumer on a file Office', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - Office file, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-fav.docx`, { + office: true, + favorite: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4809] Actions for Consumer on a file Office, favorite', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - non-Office file', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}.txt`, { + versionable: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4810] Actions for Consumer on a file, not Office', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - non-Office file, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-fav.txt`, { + versionable: true, + favorite: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4811] Actions for Consumer on a file, not Office, favorite', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - non-versionable file', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-not-versionable.txt`, { + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerNotVersionableMore, + expectNoManageVersions: true + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-20145] Manage Versions is not shown for a file without cm:versionable aspect', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - Office file, shared', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared.docx`, { + office: true, + shared: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4814] Actions for Consumer on a file Office, shared', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - Office file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared-fav.docx`, { + office: true, + shared: true, + favorite: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4815] Actions for Consumer on a file Office, shared, favorite', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - non-Office file, shared', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared.txt`, { + versionable: true, + shared: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4816] Actions for Consumer on a file, not Office, shared', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - non-Office file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav.txt`, { + versionable: true, + shared: true, + favorite: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4817] Actions for Consumer on a file, not Office, shared, favorite', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - locked file', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-locked`, { + versionable: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4812] Actions for Consumer on a file, locked', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - locked file, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-fav-locked`, { + versionable: true, + favorite: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4813] Actions for Consumer on a file, locked, favorite', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - locked file, shared', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-locked`, { + versionable: true, + shared: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4818] Actions for Consumer on a file, locked, shared', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('File Libraries - locked file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav-locked`, { + versionable: true, + shared: true, + favorite: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4819] Actions for Consumer on a file, locked, shared, favorite', async ({ loginPage, myLibrariesPage }) => { + await openInLibraries(myLibrariesPage, loginPage, item.name); + await verifyViewerActions(myLibrariesPage, item); + }); + }); + + test.describe('Favorites - Office file, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-fav.docx`, { + office: true, + favorite: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4820] File Office, favorite - ', async ({ loginPage, favoritePage }) => { + await openInFavorites(favoritePage, loginPage, item.name); + await verifyViewerActions(favoritePage, item); + }); + }); + + test.describe('Favorites - non-Office file, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-fav.txt`, { + versionable: true, + favorite: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4821] Actions for Consumer on a file, not Office, favorite', async ({ loginPage, favoritePage }) => { + await openInFavorites(favoritePage, loginPage, item.name); + await verifyViewerActions(favoritePage, item); + }); + }); + + test.describe('Favorites - Office file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared-fav.docx`, { + office: true, + shared: true, + favorite: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4823] Actions for Consumer on a file Office, shared, favorite', async ({ loginPage, favoritePage }) => { + await openInFavorites(favoritePage, loginPage, item.name); + await verifyViewerActions(favoritePage, item); + }); + }); + + test.describe('Favorites - non-Office file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav.txt`, { + versionable: true, + shared: true, + favorite: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4824] Actions for Consumer on a file, not Office, shared, favorite', async ({ loginPage, favoritePage }) => { + await openInFavorites(favoritePage, loginPage, item.name); + await verifyViewerActions(favoritePage, item); + }); + }); + + test.describe('Favorites - locked file, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-fav-locked`, { + versionable: true, + favorite: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4822] Actions for Consumer on a file, locked, favorite', async ({ loginPage, favoritePage }) => { + await openInFavorites(favoritePage, loginPage, item.name); + await verifyViewerActions(favoritePage, item); + }); + }); + + test.describe('Favorites - locked file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav-locked`, { + versionable: true, + shared: true, + favorite: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4825] Actions for Consumer on a file, locked, shared, favorite', async ({ loginPage, favoritePage }) => { + await openInFavorites(favoritePage, loginPage, item.name); + await verifyViewerActions(favoritePage, item); + }); + }); + + test.describe('Shared Files - Office file, shared', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared.docx`, { + office: true, + shared: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4826] Actions for Consumer on a file Office, shared', async ({ loginPage, sharedPage }) => { + await openInShared(sharedPage, loginPage, item.name); + await verifyViewerActions(sharedPage, item); + }); + }); + + test.describe('Shared Files - Office file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared-fav.docx`, { + office: true, + shared: true, + favorite: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4827] Actions for Consumer on a file Office, shared, favorite', async ({ loginPage, sharedPage }) => { + await openInShared(sharedPage, loginPage, item.name); + await verifyViewerActions(sharedPage, item); + }); + }); + + test.describe('Shared Files - non-Office file, shared', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared.txt`, { + versionable: true, + shared: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4828] Actions for Consumer on a file, not Office, shared', async ({ loginPage, sharedPage }) => { + await openInShared(sharedPage, loginPage, item.name); + await verifyViewerActions(sharedPage, item); + }); + }); + + test.describe('Shared Files - non-Office file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav.txt`, { + versionable: true, + shared: true, + favorite: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4829] Actions for Consumer on a file, not Office, shared, favorite', async ({ loginPage, sharedPage }) => { + await openInShared(sharedPage, loginPage, item.name); + await verifyViewerActions(sharedPage, item); + }); + }); + + test.describe('Shared Files - locked file, shared', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-locked`, { + versionable: true, + shared: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4830] Actions for Consumer on a file, locked, shared', async ({ loginPage, sharedPage }) => { + await openInShared(sharedPage, loginPage, item.name); + await verifyViewerActions(sharedPage, item); + }); + }); + + test.describe('Shared Files - locked file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav-locked`, { + versionable: true, + shared: true, + favorite: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4831] Actions for Consumer on a file, locked, shared, favorite', async ({ loginPage, sharedPage }) => { + await openInShared(sharedPage, loginPage, item.name); + await verifyViewerActions(sharedPage, item); + }); + }); + + test.describe('Search Results - Office file', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx.docx`, { + office: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4832] Actions for Consumer on a file Office', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - Office file, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-fav.docx`, { + office: true, + favorite: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4833] Actions for Consumer on a file Office, favorite', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - non-Office file', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}.txt`, { + versionable: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4834] Actions for Consumer on a file, not Office', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - non-Office file, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-fav.txt`, { + versionable: true, + favorite: true, + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4835] Actions for Consumer on a file, not Office, favorite', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - non-versionable file', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-not-versionable.txt`, { + viewerToolbarPrimary: viewerPrimary, + viewerToolbarMore: viewerNotVersionableMore, + expectNoManageVersions: true + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-20146] Manage Versions is not shown for a file without cm:versionable aspect - Search Results', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - Office file, shared', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared.docx`, { + office: true, + shared: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4838] Actions for Consumer on a file Office, shared', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - Office file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-docx-shared-fav.docx`, { + office: true, + shared: true, + favorite: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4839] Actions for Consumer on a file Office, shared, favorite', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - non-Office file, shared', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared.txt`, { + versionable: true, + shared: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4840] Actions for Consumer on a file, not Office, shared', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - non-Office file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav.txt`, { + versionable: true, + shared: true, + favorite: true, + viewerToolbarPrimary: viewerSharedPrimary, + viewerToolbarMore: viewerFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4841] Actions for Consumer on a file, not Office, shared, favorite', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - locked file', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-locked`, { + versionable: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4836] Actions for Consumer on a file, locked', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - locked file, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-fav-locked`, { + versionable: true, + favorite: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4837] Actions for Consumer on a file, locked, favorite', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - locked file, shared', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-locked`, { + versionable: true, + shared: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4842] Actions for Consumer on a file, locked, shared', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); + + test.describe('Search Results - locked file, shared, favorite', () => { + const item = buildFile((fileRandom) => `file-${fileRandom}-shared-fav-locked`, { + versionable: true, + shared: true, + favorite: true, + locked: true, + viewerToolbarPrimary: viewerLockedPrimary, + viewerToolbarMore: viewerLockedFavMore + }); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4843] Actions for Consumer on a file, locked, shared, favorite', async ({ loginPage, searchPage }) => { + await openInSearch(searchPage, loginPage, item); + await verifyViewerActions(searchPage, item); + }); + }); +}); diff --git a/e2e/playwright/special-permissions-actions-available/src/tests/file-locked-by-current-user-actions.e2e.ts b/e2e/playwright/special-permissions-actions-available/src/tests/file-locked-by-current-user-actions.e2e.ts new file mode 100644 index 000000000..001642d77 --- /dev/null +++ b/e2e/playwright/special-permissions-actions-available/src/tests/file-locked-by-current-user-actions.e2e.ts @@ -0,0 +1,207 @@ +/*! + * Copyright © 2005-2026 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 { + ApiClientFactory, + FavoritesApi, + NodesApi, + SearchApi, + SharedLinksApi, + SitesApi, + test, + timeouts, + Utils +} from '@alfresco/aca-playwright-shared'; +import { Site } from '@alfresco/js-api'; +import { checkActionsAvailable, checkActionsViewerAvailable } from './permissions-actions-helpers'; + +const collaboratorToolbarPrimary = ['View', 'View Details', 'More Actions']; +const collaboratorViewerLockedToolbarPrimary = ['Activate full-screen mode', 'View Details', 'More Actions']; +const lockCurrentUserToolbarMore = ['Cancel Editing', 'Upload New Version', 'Copy']; + +interface LockedFile { + name: string; + random: string; + id?: string; +} + +const buildFile = (): LockedFile => { + const random = Utils.random(); + return { name: `file-${random}-my-locked`, random }; +}; + +test.describe('Special permissions - File locked, user is lock owner : ', () => { + const random = Utils.random(); + const apiClientFactory = new ApiClientFactory(); + const sitePrivate = `site-private-locked-owner-${random}`; + const userManager = `manager-locked-owner-${random}`; + const userDemoted = `demoted-owner-${random}`; + + let docLibId: string; + let managerNodeActions: NodesApi; + let managerSiteActions: SitesApi; + let managerSearchActions: SearchApi; + let demotedUserActions: NodesApi; + let demotedUserFavoritesActions: FavoritesApi; + let demotedUserShareActions: SharedLinksApi; + + const provisionFile = async (item: LockedFile): Promise => { + test.setTimeout(timeouts.extendedTest); + const demotedUserFavoritesTotalItems = await demotedUserFavoritesActions.getFavoritesTotalItems(userDemoted); + const managerSearchTotalItems = await managerSearchActions.getTotalItems(userManager); + + await managerSiteActions.updateSiteMember(sitePrivate, userDemoted, Site.RoleEnum.SiteManager); + + item.id = (await managerNodeActions.createFile(item.name, docLibId, '', '', '', true, ['cm:versionable'])).entry.id; + await demotedUserActions.checkoutNodes([item.id]); + await demotedUserFavoritesActions.addFavoriteById('file', item.id); + await demotedUserShareActions.shareFileById(item.id); + + await managerSiteActions.updateSiteMember(sitePrivate, userDemoted, Site.RoleEnum.SiteConsumer); + + await demotedUserFavoritesActions.isFavoriteWithRetry(userDemoted, item.id, { expect: true }); + await Promise.all([ + demotedUserFavoritesActions.waitForApi(userDemoted, { expect: demotedUserFavoritesTotalItems + 1 }), + demotedUserShareActions.waitForFilesToBeShared([item.id]), + managerSearchActions.waitForApi(userManager, { expect: managerSearchTotalItems + 1 }) + ]); + }; + + test.beforeAll(async () => { + test.setTimeout(timeouts.extendedTest); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username: userManager }); + await apiClientFactory.createUser({ username: userDemoted }); + + managerNodeActions = await NodesApi.initialize(userManager, userManager); + managerSiteActions = await SitesApi.initialize(userManager, userManager); + managerSearchActions = await SearchApi.initialize(userManager, userManager); + demotedUserActions = await NodesApi.initialize(userDemoted, userDemoted); + demotedUserFavoritesActions = await FavoritesApi.initialize(userDemoted, userDemoted); + demotedUserShareActions = await SharedLinksApi.initialize(userDemoted, userDemoted); + + await managerSiteActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); + docLibId = await managerSiteActions.getDocLibId(sitePrivate); + await managerSiteActions.addSiteMember(sitePrivate, userDemoted, Site.RoleEnum.SiteManager); + }); + + test.beforeEach(async ({ loginPage }) => { + await loginPage.navigate(); + await loginPage.loginUser({ username: userDemoted, password: userDemoted }); + }); + + test.afterAll(async () => { + await Utils.deleteNodesSitesEmptyTrashcan(undefined, undefined, 'afterAll failed', managerSiteActions, [sitePrivate]); + }); + + test.describe('File Libraries - row actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4852] Toolbar - Correct actions appear for file - on File Libraries - Locked File', async ({ myLibrariesPage }) => { + await myLibrariesPage.navigate(); + await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(sitePrivate); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, lockCurrentUserToolbarMore); + }); + }); + + test.describe('Shared Files - row actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4853] Toolbar - Correct actions appear for file - on Shared Files - Locked File', async ({ sharedPage, myLibrariesPage }) => { + await sharedPage.navigate(); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, lockCurrentUserToolbarMore); + }); + }); + + test.describe('Favorites - row actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4854] Toolbar - Correct actions appear for file - on Favorites - Locked File', async ({ favoritePage, myLibrariesPage }) => { + await favoritePage.navigate(); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, lockCurrentUserToolbarMore); + }); + }); + + test.describe('Search Results - row actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4855] Toolbar - Correct actions appear for file - on Search Results - Locked File', async ({ searchPage, myLibrariesPage }) => { + await searchPage.searchWithin(item.random, 'filesAndFolders', 'formula'); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, lockCurrentUserToolbarMore); + }); + }); + + test.describe('File Libraries - viewer actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4856] Correct actions appear for file opened from File Libraries - Locked File', async ({ myLibrariesPage }) => { + await myLibrariesPage.navigate(); + await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(sitePrivate); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorViewerLockedToolbarPrimary, lockCurrentUserToolbarMore); + }); + }); + + test.describe('Shared Files - viewer actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4857] Correct actions appear for file opened from Shared Files - Locked File', async ({ sharedPage, myLibrariesPage }) => { + await sharedPage.navigate(); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorViewerLockedToolbarPrimary, lockCurrentUserToolbarMore); + }); + }); + + test.describe('Favorites - viewer actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4858] Correct actions appear for file opened from Favorites - Locked File', async ({ favoritePage, myLibrariesPage }) => { + await favoritePage.navigate(); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorViewerLockedToolbarPrimary, lockCurrentUserToolbarMore); + }); + }); + + test.describe('Search Results - viewer actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4859] Correct actions appear for file opened from Search Results - Locked File', async ({ searchPage, myLibrariesPage }) => { + await searchPage.searchWithin(item.random, 'filesAndFolders', 'formula'); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorViewerLockedToolbarPrimary, lockCurrentUserToolbarMore); + }); + }); +}); diff --git a/e2e/playwright/special-permissions-actions-available/src/tests/file-locked-by-other-user-actions.e2e.ts b/e2e/playwright/special-permissions-actions-available/src/tests/file-locked-by-other-user-actions.e2e.ts new file mode 100644 index 000000000..f70204583 --- /dev/null +++ b/e2e/playwright/special-permissions-actions-available/src/tests/file-locked-by-other-user-actions.e2e.ts @@ -0,0 +1,212 @@ +/*! + * Copyright © 2005-2026 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 { + ApiClientFactory, + FavoritesApi, + NodesApi, + SearchApi, + SharedLinksApi, + SitesApi, + test, + timeouts, + Utils +} from '@alfresco/aca-playwright-shared'; +import { Site } from '@alfresco/js-api'; +import { checkActionsAvailable, checkActionsViewerAvailable } from './permissions-actions-helpers'; + +const collaboratorToolbarPrimary = ['View', 'View Details', 'More Actions']; +const collaboratorViewerLockedToolbarPrimary = ['Activate full-screen mode', 'View Details', 'More Actions']; +const lockOtherUserToolbarMore = ['Cancel Editing', 'Favorite', 'Move', 'Copy', 'Permissions']; +const lockOtherUserSearchToolbarMore = ['Cancel Editing', 'Favorite', 'Copy', 'Permissions']; + +interface LockedFile { + name: string; + random: string; + id?: string; +} + +const buildFile = (): LockedFile => { + const random = Utils.random(); + return { name: `file-${random}-my-locked`, random }; +}; + +test.describe('Special permissions - File locked by other user, user is manager : ', () => { + const random = Utils.random(); + const apiClientFactory = new ApiClientFactory(); + const sitePrivate = `site-private-locked-other-${random}`; + const userManager = `manager-locked-other-${random}`; + const userDemoted = `demoted-other-${random}`; + + let docLibId: string; + let managerNodeActions: NodesApi; + let managerSiteActions: SitesApi; + let managerSearchActions: SearchApi; + let managerFavoritesActions: FavoritesApi; + let demotedUserActions: NodesApi; + let demotedUserShareActions: SharedLinksApi; + + const provisionFile = async (item: LockedFile): Promise => { + test.setTimeout(timeouts.extendedTest); + const managerFavoritesTotalItems = await managerFavoritesActions.getFavoritesTotalItems(userManager); + const managerSearchTotalItems = await managerSearchActions.getTotalItems(userManager); + + item.id = (await managerNodeActions.createFile(item.name, docLibId, '', '', '', true, ['cm:versionable'])).entry.id; + await demotedUserActions.checkoutNodes([item.id]); + await demotedUserShareActions.shareFileById(item.id); + await managerFavoritesActions.addFavoriteById('file', item.id); + + await managerFavoritesActions.isFavoriteWithRetry(userManager, item.id, { expect: true }); + await Promise.all([ + managerFavoritesActions.waitForApi(userManager, { expect: managerFavoritesTotalItems + 1 }), + demotedUserShareActions.waitForFilesToBeShared([item.id]), + managerSearchActions.waitForApi(userManager, { expect: managerSearchTotalItems + 1 }) + ]); + }; + + test.beforeAll(async () => { + test.setTimeout(timeouts.extendedTest); + await apiClientFactory.setUpAcaBackend('admin'); + await apiClientFactory.createUser({ username: userManager }); + await apiClientFactory.createUser({ username: userDemoted }); + + managerNodeActions = await NodesApi.initialize(userManager, userManager); + managerSiteActions = await SitesApi.initialize(userManager, userManager); + managerSearchActions = await SearchApi.initialize(userManager, userManager); + managerFavoritesActions = await FavoritesApi.initialize(userManager, userManager); + demotedUserActions = await NodesApi.initialize(userDemoted, userDemoted); + demotedUserShareActions = await SharedLinksApi.initialize(userDemoted, userDemoted); + + await managerSiteActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); + docLibId = await managerSiteActions.getDocLibId(sitePrivate); + await managerSiteActions.addSiteMember(sitePrivate, userDemoted, Site.RoleEnum.SiteManager); + }); + + test.beforeEach(async ({ loginPage }) => { + await Utils.tryLoginUser(loginPage, userManager, userManager, 'beforeEach failed'); + }); + + test.afterAll(async () => { + await Utils.deleteNodesSitesEmptyTrashcan(undefined, undefined, 'afterAll failed', managerSiteActions, [sitePrivate]); + }); + + test.describe('File Libraries - row actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4860] Toolbar - Correct actions appear for file - on File Libraries - Locked File - Other User', async ({ myLibrariesPage }) => { + await myLibrariesPage.navigate(); + await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(sitePrivate); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, lockOtherUserToolbarMore); + }); + }); + + test.describe('Shared Files - row actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4861] Toolbar - Correct actions appear for file - on Shared Files - Locked File - Other User', async ({ + sharedPage, + myLibrariesPage + }) => { + await sharedPage.navigate(); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, lockOtherUserToolbarMore); + }); + }); + + test.describe('Favorites - row actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4862] Toolbar - Correct actions appear for file - on Favorites - Locked File - Other User', async ({ + favoritePage, + myLibrariesPage + }) => { + await favoritePage.navigate(); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, lockOtherUserToolbarMore); + }); + }); + + test.describe('Search Results - row actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4863] Toolbar - Correct actions appear for file - on Search Results - Locked File - Other User', async ({ + searchPage, + myLibrariesPage + }) => { + await searchPage.searchWithin(item.random, 'filesAndFolders', 'formula'); + await checkActionsAvailable(myLibrariesPage, item.name, collaboratorToolbarPrimary, lockOtherUserSearchToolbarMore); + }); + }); + + test.describe('File Libraries - viewer actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4864] Correct actions appear for file opened from File Libraries - viewer - locked', async ({ myLibrariesPage }) => { + await myLibrariesPage.navigate(); + await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(sitePrivate); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorViewerLockedToolbarPrimary, lockOtherUserToolbarMore); + }); + }); + + test.describe('Shared Files - viewer actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4865] Correct actions appear for file opened from Shared Files - viewer - locked', async ({ sharedPage, myLibrariesPage }) => { + await sharedPage.navigate(); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorViewerLockedToolbarPrimary, lockOtherUserToolbarMore); + }); + }); + + test.describe('Favorites - viewer actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4866] Correct actions appear for file opened from Favorites - viewer - locked', async ({ favoritePage, myLibrariesPage }) => { + await favoritePage.navigate(); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorViewerLockedToolbarPrimary, lockOtherUserToolbarMore); + }); + }); + + test.describe('Search Results - viewer actions', () => { + const item = buildFile(); + + test.beforeAll(() => provisionFile(item)); + + test('[XAT-4867] Correct actions appear for file opened from Search Results - viewer - locked', async ({ searchPage, myLibrariesPage }) => { + await searchPage.searchWithin(item.random, 'filesAndFolders', 'formula'); + await checkActionsViewerAvailable(myLibrariesPage, item.name, collaboratorViewerLockedToolbarPrimary, lockOtherUserSearchToolbarMore); + }); + }); +}); diff --git a/e2e/playwright/special-permissions-actions-available/src/tests/other-permissions.ts b/e2e/playwright/special-permissions-actions-available/src/tests/other-permissions.ts deleted file mode 100644 index de00882a2..000000000 --- a/e2e/playwright/special-permissions-actions-available/src/tests/other-permissions.ts +++ /dev/null @@ -1,340 +0,0 @@ -/*! - * Copyright © 2005-2026 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 { MyLibrariesPage, test, Utils } from '@alfresco/aca-playwright-shared'; -import * as testData from '@alfresco/aca-playwright-shared'; -import { expect } from '@playwright/test'; - -async function checkActionsAvailable( - myLibrariesPage: MyLibrariesPage, - item: string, - expectedToolbarPrimary: string[], - expectedToolbarMore: string[] -): Promise { - await myLibrariesPage.dataTable.selectItems(item); - await myLibrariesPage.acaHeader.verifyToolbarPrimaryActions(expectedToolbarPrimary); - await myLibrariesPage.acaHeader.clickMoreActions(); - await myLibrariesPage.matMenu.verifyActualMoreActions(expectedToolbarMore); -} - -async function checkActionsViewerAvailable( - myLibrariesPage: MyLibrariesPage, - item: string, - expectedToolbarPrimary: string[], - expectedToolbarMore: string[] -): Promise { - await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(item); - expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); - await myLibrariesPage.viewer.verifyViewerPrimaryActions(expectedToolbarPrimary); - await myLibrariesPage.viewer.toolbar.clickMoreActions(); - await myLibrariesPage.matMenu.verifyActualMoreActions(expectedToolbarMore); -} - -export function collaboratorTests(userCollaborator: string, siteName: string) { - test.describe('available actions : ', () => { - test.beforeEach(async ({ loginPage }) => { - await Utils.tryLoginUser(loginPage, userCollaborator, userCollaborator, 'beforeEach failed'); - }); - - test('[XAT-4844] Toolbar - Actions appear correctly for a file - Collaborator - My Libraries', async ({ myLibrariesPage }) => { - await myLibrariesPage.navigate(); - await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName); - await checkActionsAvailable( - myLibrariesPage, - testData.fileSharedFav.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorEditRowToolbarMore - ); - }); - - test('[XAT-4845] Toolbar - Actions appear correctly for a file - Collaborator - Shared', async ({ sharedPage, myLibrariesPage }) => { - await sharedPage.navigate(); - await checkActionsAvailable( - myLibrariesPage, - testData.fileSharedFav.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorEditRowToolbarMore - ); - }); - - test('[XAT-4846] Toolbar - Actions appear correctly for a file - Collaborator - Favorites', async ({ favoritePage, myLibrariesPage }) => { - await favoritePage.navigate(); - await checkActionsAvailable( - myLibrariesPage, - testData.fileSharedFav.name, - testData.collaboratorToolbarPrimary, - testData.favoritesCollaboratorToolbarMore - ); - }); - - test('[XAT-4847] Toolbar - Actions appear correctly for a file - Collaborator - Search Results', async ({ searchPage, myLibrariesPage }) => { - await searchPage.searchWithin(testData.fileSharedFav.random, 'filesAndFolders', 'formula'); - await checkActionsAvailable( - myLibrariesPage, - testData.fileSharedFav.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorEditRowToolbarMore - ); - }); - - test.describe('available actions in the viewer : ', () => { - test('[XAT-4848] Correct actions appear for file in viewer - Collaborator - My Libraries', async ({ myLibrariesPage }) => { - await myLibrariesPage.navigate(); - await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileDocxSharedFav.name, - testData.collaboratorSharedToolbarPrimary, - testData.collaboratorDocToolbarMore - ); - }); - - test('[XAT-4849] Correct actions appear for file in viewer - Collaborator - Shared', async ({ sharedPage, myLibrariesPage }) => { - await sharedPage.navigate(); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileDocxSharedFav.name, - testData.collaboratorSharedToolbarPrimary, - testData.collaboratorDocToolbarMore - ); - }); - - test('[XAT-4850] Correct actions appear for file in viewer - Collaborator - Favorites', async ({ favoritePage, myLibrariesPage }) => { - await favoritePage.navigate(); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileDocxSharedFav.name, - testData.collaboratorSharedToolbarPrimary, - testData.collaboratorDocToolbarMore - ); - }); - - test('[XAT-4851] Correct actions appear for file in viewer - Collaborator - Search', async ({ searchPage, myLibrariesPage }) => { - await searchPage.searchWithin(testData.fileDocxSharedFav.random, 'filesAndFolders', 'formula'); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileDocxSharedFav.name, - testData.collaboratorSharedToolbarPrimary, - testData.collaboratorDocToolbarMore - ); - }); - }); - }); -} - -export function filesLockedByCurrentUser(userDemoted: string, siteName: string) { - test.describe('available actions : ', () => { - test.beforeEach(async ({ loginPage }) => { - await loginPage.navigate(); - await loginPage.loginUser({ username: userDemoted, password: userDemoted }); - }); - - test.describe('available actions in the file select : ', () => { - test('[XAT-4852] Toolbar - Correct actions appear for file - on File Libraries - Locked File', async ({ myLibrariesPage }) => { - await myLibrariesPage.navigate(); - await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName); - await checkActionsAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorLockCurrentUserToolbarMore - ); - }); - - test('[XAT-4853] Toolbar - Correct actions appear for file - on Shared Files - Locked File', async ({ sharedPage, myLibrariesPage }) => { - await sharedPage.navigate(); - await checkActionsAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorLockCurrentUserToolbarMore - ); - }); - - test('[XAT-4854] Toolbar - Correct actions appear for file - on Favorites - Locked File', async ({ favoritePage, myLibrariesPage }) => { - await favoritePage.navigate(); - await checkActionsAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorLockCurrentUserToolbarMore - ); - }); - - test('[XAT-4855] Toolbar - Correct actions appear for file - on Search Results - Locked File', async ({ searchPage, myLibrariesPage }) => { - await searchPage.searchWithin(testData.fileLockedByUser.random, 'filesAndFolders', 'formula'); - await checkActionsAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorLockCurrentUserToolbarMore - ); - }); - }); - - test.describe('available actions in the viewer : ', () => { - test('[XAT-4856] Correct actions appear for file opened from File Libraries - Locked File', async ({ myLibrariesPage }) => { - await myLibrariesPage.navigate(); - await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorViewerLockedToolbarPrimary, - testData.collaboratorLockCurrentUserToolbarMore - ); - }); - - test('[XAT-4857] Correct actions appear for file opened from Shared Files - Locked File', async ({ sharedPage, myLibrariesPage }) => { - await sharedPage.navigate(); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorViewerLockedToolbarPrimary, - testData.collaboratorLockCurrentUserToolbarMore - ); - }); - - test('[XAT-4858] Correct actions appear for file opened from Favorites - Locked File', async ({ favoritePage, myLibrariesPage }) => { - await favoritePage.navigate(); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorViewerLockedToolbarPrimary, - testData.collaboratorLockCurrentUserToolbarMore - ); - }); - - test('[XAT-4859] Correct actions appear for file opened from Search Results - Locked File', async ({ searchPage, myLibrariesPage }) => { - await searchPage.searchWithin(testData.fileLockedByUser.random, 'filesAndFolders', 'formula'); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorViewerLockedToolbarPrimary, - testData.collaboratorLockCurrentUserToolbarMore - ); - }); - }); - }); -} - -export function filesLockedByOtherUser(userManager: string, siteName: string) { - test.describe('available actions : ', () => { - test.beforeEach(async ({ loginPage }) => { - await Utils.tryLoginUser(loginPage, userManager, userManager, 'beforeEach failed'); - }); - - test('[XAT-4860] Toolbar - Correct actions appear for file - on File Libraries - Locked File - Other User', async ({ myLibrariesPage }) => { - await myLibrariesPage.navigate(); - await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName); - await checkActionsAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorLockOtherUserToolbarMore - ); - }); - - test('[XAT-4861] Toolbar - Correct actions appear for file - on Shared Files - Locked File - Other User', async ({ - sharedPage, - myLibrariesPage - }) => { - await sharedPage.navigate(); - await checkActionsAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorLockOtherUserToolbarMore - ); - }); - - test('[XAT-4862] Toolbar - Correct actions appear for file - on Favorites - Locked File - Other User', async ({ - favoritePage, - myLibrariesPage - }) => { - await favoritePage.navigate(); - await checkActionsAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorLockOtherUserToolbarMore - ); - }); - - test('[XAT-4863] Toolbar - Correct actions appear for file - on Search Results - Locked File - Other User', async ({ - searchPage, - myLibrariesPage - }) => { - await searchPage.searchWithin(testData.fileLockedByUser.random, 'filesAndFolders', 'formula'); - await checkActionsAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorToolbarPrimary, - testData.collaboratorLockOtherUserSearchToolbarMore - ); - }); - - test.describe('available actions in the viewer : ', () => { - test('[XAT-4864] Correct actions appear for file opened from File Libraries - viewer - locked', async ({ myLibrariesPage }) => { - await myLibrariesPage.navigate(); - await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorViewerLockedToolbarPrimary, - testData.collaboratorLockOtherUserToolbarMore - ); - }); - - test('[XAT-4865] Correct actions appear for file opened from Shared Files - viewer - locked', async ({ sharedPage, myLibrariesPage }) => { - await sharedPage.navigate(); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorViewerLockedToolbarPrimary, - testData.collaboratorLockOtherUserToolbarMore - ); - }); - - test('[XAT-4866] Correct actions appear for file opened from Favorites - viewer - locked', async ({ favoritePage, myLibrariesPage }) => { - await favoritePage.navigate(); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorViewerLockedToolbarPrimary, - testData.collaboratorLockOtherUserToolbarMore - ); - }); - - test('[XAT-4867] Correct actions appear for file opened from Search Results - viewer - locked', async ({ searchPage, myLibrariesPage }) => { - await searchPage.searchWithin(testData.fileLockedByUser.random, 'filesAndFolders', 'formula'); - await checkActionsViewerAvailable( - myLibrariesPage, - testData.fileLockedByUser.name, - testData.collaboratorViewerLockedToolbarPrimary, - testData.collaboratorLockOtherUserSearchToolbarMore - ); - }); - }); - }); -} diff --git a/e2e/playwright/special-permissions-actions-available/src/tests/permissions-actions-helpers.ts b/e2e/playwright/special-permissions-actions-available/src/tests/permissions-actions-helpers.ts new file mode 100644 index 000000000..adcbc9f5f --- /dev/null +++ b/e2e/playwright/special-permissions-actions-available/src/tests/permissions-actions-helpers.ts @@ -0,0 +1,51 @@ +/*! + * Copyright © 2005-2026 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 { MyLibrariesPage } from '@alfresco/aca-playwright-shared'; +import { expect } from '@playwright/test'; + +export async function checkActionsAvailable( + myLibrariesPage: MyLibrariesPage, + item: string, + expectedToolbarPrimary: string[], + expectedToolbarMore: string[] +): Promise { + await myLibrariesPage.dataTable.selectItems(item); + await myLibrariesPage.acaHeader.verifyToolbarPrimaryActions(expectedToolbarPrimary); + await myLibrariesPage.acaHeader.clickMoreActions(); + await myLibrariesPage.matMenu.verifyActualMoreActions(expectedToolbarMore); +} + +export async function checkActionsViewerAvailable( + myLibrariesPage: MyLibrariesPage, + item: string, + expectedToolbarPrimary: string[], + expectedToolbarMore: string[] +): Promise { + await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(item); + expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); + await myLibrariesPage.viewer.verifyViewerPrimaryActions(expectedToolbarPrimary); + await myLibrariesPage.viewer.toolbar.clickMoreActions(); + await myLibrariesPage.matMenu.verifyActualMoreActions(expectedToolbarMore); +} diff --git a/e2e/playwright/special-permissions-actions-available/src/tests/special-permissions-actions.e2e.ts b/e2e/playwright/special-permissions-actions-available/src/tests/special-permissions-actions.e2e.ts deleted file mode 100644 index 650efa31a..000000000 --- a/e2e/playwright/special-permissions-actions-available/src/tests/special-permissions-actions.e2e.ts +++ /dev/null @@ -1,322 +0,0 @@ -/*! - * Copyright © 2005-2026 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 * as testData from '@alfresco/aca-playwright-shared'; -import { viewerTests } from './viewer'; -import { collaboratorTests, filesLockedByCurrentUser, filesLockedByOtherUser } from './other-permissions'; -import { - ApiClientFactory, - FavoritesApi, - FileActionsApi, - TEST_FILES, - NodesApi, - SitesApi, - test, - SharedLinksApi, - SearchApi, - timeouts, - Utils -} from '@alfresco/aca-playwright-shared'; -import { Site } from '@alfresco/js-api'; - -test.describe('Special permissions : ', () => { - const random = Utils.random(); - - test.describe('Consumer', () => { - const apiClientFactory = new ApiClientFactory(); - const sitePrivate = `site-private-consumer-${random}`; - const userManager = `manager-consumer-${random}`; - const userConsumer = `consumer-${random}`; - - let docLibId: string; - let fileDocxFavId: string; - let fileFavId: string; - let fileDocxSharedId: string; - let fileDocxSharedFavId: string; - let fileSharedId: string; - let fileSharedFavId: string; - let fileLockedId: string; - let fileFavLockedId: string; - let fileSharedLockedId: string; - let fileSharedFavLockedId: string; - - let managerNodeActions: NodesApi; - let managerSiteActions: SitesApi; - let managerFileActions: FileActionsApi; - let managerSearchActions: SearchApi; - let consumerFavoritesActions: FavoritesApi; - let consumerShareActions: SharedLinksApi; - - test.beforeAll(async () => { - test.setTimeout(timeouts.extendedLongTest); - await apiClientFactory.setUpAcaBackend('admin'); - await apiClientFactory.createUser({ username: userManager }); - await apiClientFactory.createUser({ username: userConsumer }); - - managerNodeActions = await NodesApi.initialize(userManager, userManager); - managerSiteActions = await SitesApi.initialize(userManager, userManager); - managerFileActions = await FileActionsApi.initialize(userManager, userManager); - managerSearchActions = await SearchApi.initialize(userManager, userManager); - consumerFavoritesActions = await FavoritesApi.initialize(userConsumer, userConsumer); - consumerShareActions = await SharedLinksApi.initialize(userConsumer, userConsumer); - - const consumerFavoritesTotalItems = await consumerFavoritesActions.getFavoritesTotalItems(userConsumer); - const managerSearchTotalItems = await managerSearchActions.getTotalItems(userManager); - - await managerSiteActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); - docLibId = await managerSiteActions.getDocLibId(sitePrivate); - await managerSiteActions.addSiteMember(sitePrivate, userConsumer, Site.RoleEnum.SiteConsumer); - - await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, testData.fileDocx.name, docLibId); - fileDocxFavId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, testData.fileDocxFav.name, docLibId)).entry.id; - await managerNodeActions.createFile(testData.file.name, docLibId, '', '', '', true, ['cm:versionable']); - fileFavId = (await managerNodeActions.createFile(testData.fileFav.name, docLibId, '', '', '', true, ['cm:versionable'])).entry.id; - await managerNodeActions.createFile(testData.fileNotVersionable.name, docLibId, '', '', '', true, []); - fileDocxSharedId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, testData.fileDocxShared.name, docLibId)).entry.id; - fileDocxSharedFavId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, testData.fileDocxSharedFav.name, docLibId)).entry.id; - fileSharedId = (await managerNodeActions.createFile(testData.fileShared.name, docLibId, '', '', '', true, ['cm:versionable'])).entry.id; - fileSharedFavId = (await managerNodeActions.createFile(testData.fileSharedFav.name, docLibId, '', '', '', true, ['cm:versionable'])).entry.id; - fileLockedId = (await managerNodeActions.createFile(testData.fileLocked.name, docLibId, '', '', '', true, ['cm:versionable'])).entry.id; - fileFavLockedId = (await managerNodeActions.createFile(testData.fileFavLocked.name, docLibId, '', '', '', true, ['cm:versionable'])).entry.id; - fileSharedLockedId = (await managerNodeActions.createFile(testData.fileSharedLocked.name, docLibId, '', '', '', true, ['cm:versionable'])).entry - .id; - fileSharedFavLockedId = (await managerNodeActions.createFile(testData.fileSharedFavLocked.name, docLibId, '', '', '', true, ['cm:versionable'])) - .entry.id; - - await consumerFavoritesActions.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId - ]); - - await consumerShareActions.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId - ]); - - await managerNodeActions.checkoutNodes([fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId]); - - await Promise.all([ - consumerFavoritesActions.waitForApi(userConsumer, { expect: consumerFavoritesTotalItems + 6 }), - consumerShareActions.waitForFilesToBeShared([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId - ]), - managerSearchActions.waitForApi(userManager, { expect: managerSearchTotalItems + 13 }) - ]); - }); - - test.afterAll(async () => { - await Utils.deleteNodesSitesEmptyTrashcan(undefined, undefined, 'afterAll failed', managerSiteActions, [sitePrivate]); - }); - - test.describe('on Viewer', () => { - viewerTests(userConsumer, sitePrivate); - }); - }); - - test.describe('Collaborator', () => { - const apiClientFactory = new ApiClientFactory(); - const sitePrivate = `site-private-collaborator-${random}`; - const userManager = `manager-collaborator-${random}`; - const userCollaborator = `collaborator-${random}`; - - let docLibId: string; - let fileDocxSharedFavId: string; - let fileSharedFavId: string; - - let managerNodeActions: NodesApi; - let managerSiteActions: SitesApi; - let managerFileActions: FileActionsApi; - let managerSearchActions: SearchApi; - let managerShareActions: SharedLinksApi; - let collaboratorFavoritesActions: FavoritesApi; - - test.beforeAll(async () => { - test.setTimeout(timeouts.extendedLongTest); - await apiClientFactory.setUpAcaBackend('admin'); - await apiClientFactory.createUser({ username: userManager }); - await apiClientFactory.createUser({ username: userCollaborator }); - - managerNodeActions = await NodesApi.initialize(userManager, userManager); - managerSiteActions = await SitesApi.initialize(userManager, userManager); - managerFileActions = await FileActionsApi.initialize(userManager, userManager); - managerSearchActions = await SearchApi.initialize(userManager, userManager); - managerShareActions = await SharedLinksApi.initialize(userManager, userManager); - collaboratorFavoritesActions = await FavoritesApi.initialize(userCollaborator, userCollaborator); - - const collaboratorFavoritesTotalItems = await collaboratorFavoritesActions.getFavoritesTotalItems(userCollaborator); - const managerSearchTotalItems = await managerSearchActions.getTotalItems(userManager); - - await managerSiteActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); - docLibId = await managerSiteActions.getDocLibId(sitePrivate); - await managerSiteActions.addSiteMember(sitePrivate, userCollaborator, Site.RoleEnum.SiteCollaborator); - - fileDocxSharedFavId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, testData.fileDocxSharedFav.name, docLibId)).entry.id; - fileSharedFavId = (await managerNodeActions.createFile(testData.fileSharedFav.name, docLibId, '', '', '', true, ['cm:versionable'])).entry.id; - - await managerShareActions.shareFilesByIds([fileDocxSharedFavId, fileSharedFavId]); - await collaboratorFavoritesActions.addFavoritesByIds('file', [fileDocxSharedFavId, fileSharedFavId]); - - await collaboratorFavoritesActions.isFavoriteWithRetry(userCollaborator, fileSharedFavId, { expect: true }); - await Promise.all([ - collaboratorFavoritesActions.waitForApi(userCollaborator, { expect: collaboratorFavoritesTotalItems + 2 }), - managerShareActions.waitForFilesToBeShared([fileDocxSharedFavId, fileSharedFavId]), - managerSearchActions.waitForApi(userManager, { expect: managerSearchTotalItems + 2 }) - ]); - }); - - test.afterAll(async () => { - await Utils.deleteNodesSitesEmptyTrashcan(undefined, undefined, 'afterAll failed', managerSiteActions, [sitePrivate]); - }); - - collaboratorTests(userCollaborator, sitePrivate); - }); - - test.describe('File locked - user is lock owner', () => { - const apiClientFactory = new ApiClientFactory(); - const sitePrivate = `site-private-locked-owner-${random}`; - const userManager = `manager-locked-owner-${random}`; - const userDemoted = `demoted-owner-${random}`; - - let docLibId: string; - let fileLockedByUserId: string; - - let managerNodeActions: NodesApi; - let managerSiteActions: SitesApi; - let managerSearchActions: SearchApi; - let demotedUserActions: NodesApi; - let demotedUserFavoritesActions: FavoritesApi; - let demotedUserShareActions: SharedLinksApi; - - test.beforeAll(async () => { - test.setTimeout(timeouts.extendedLongTest); - await apiClientFactory.setUpAcaBackend('admin'); - await apiClientFactory.createUser({ username: userManager }); - await apiClientFactory.createUser({ username: userDemoted }); - - managerNodeActions = await NodesApi.initialize(userManager, userManager); - managerSiteActions = await SitesApi.initialize(userManager, userManager); - managerSearchActions = await SearchApi.initialize(userManager, userManager); - demotedUserActions = await NodesApi.initialize(userDemoted, userDemoted); - demotedUserFavoritesActions = await FavoritesApi.initialize(userDemoted, userDemoted); - demotedUserShareActions = await SharedLinksApi.initialize(userDemoted, userDemoted); - - const demotedUserFavoritesTotalItems = await demotedUserFavoritesActions.getFavoritesTotalItems(userDemoted); - const managerSearchTotalItems = await managerSearchActions.getTotalItems(userManager); - - await managerSiteActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); - docLibId = await managerSiteActions.getDocLibId(sitePrivate); - await managerSiteActions.addSiteMember(sitePrivate, userDemoted, Site.RoleEnum.SiteManager); - - fileLockedByUserId = (await managerNodeActions.createFile(testData.fileLockedByUser.name, docLibId, '', '', '', true, ['cm:versionable'])).entry - .id; - await demotedUserActions.checkoutNodes([fileLockedByUserId]); - await demotedUserFavoritesActions.addFavoriteById('file', fileLockedByUserId); - await demotedUserShareActions.shareFileById(fileLockedByUserId); - await managerSiteActions.updateSiteMember(sitePrivate, userDemoted, Site.RoleEnum.SiteConsumer); - - await demotedUserFavoritesActions.isFavoriteWithRetry(userDemoted, fileLockedByUserId, { expect: true }); - await Promise.all([ - demotedUserFavoritesActions.waitForApi(userDemoted, { expect: demotedUserFavoritesTotalItems + 1 }), - demotedUserShareActions.waitForFilesToBeShared([fileLockedByUserId]), - managerSearchActions.waitForApi(userManager, { expect: managerSearchTotalItems + 1 }) - ]); - }); - - test.afterAll(async () => { - await Utils.deleteNodesSitesEmptyTrashcan(undefined, undefined, 'afterAll failed', managerSiteActions, [sitePrivate]); - }); - - filesLockedByCurrentUser(userDemoted, sitePrivate); - }); - - test.describe('File locked by other user - user is manager', () => { - const apiClientFactory = new ApiClientFactory(); - const sitePrivate = `site-private-locked-other-${random}`; - const userManager = `manager-locked-other-${random}`; - const userDemoted = `demoted-other-${random}`; - - let docLibId: string; - let fileLockedByUserId: string; - - let managerNodeActions: NodesApi; - let managerSiteActions: SitesApi; - let managerSearchActions: SearchApi; - let managerFavoritesActions: FavoritesApi; - let demotedUserActions: NodesApi; - let demotedUserShareActions: SharedLinksApi; - - test.beforeAll(async () => { - test.setTimeout(timeouts.extendedLongTest); - await apiClientFactory.setUpAcaBackend('admin'); - await apiClientFactory.createUser({ username: userManager }); - await apiClientFactory.createUser({ username: userDemoted }); - - managerNodeActions = await NodesApi.initialize(userManager, userManager); - managerSiteActions = await SitesApi.initialize(userManager, userManager); - managerSearchActions = await SearchApi.initialize(userManager, userManager); - managerFavoritesActions = await FavoritesApi.initialize(userManager, userManager); - demotedUserActions = await NodesApi.initialize(userDemoted, userDemoted); - demotedUserShareActions = await SharedLinksApi.initialize(userDemoted, userDemoted); - - const managerFavoritesTotalItems = await managerFavoritesActions.getFavoritesTotalItems(userManager); - const managerSearchTotalItems = await managerSearchActions.getTotalItems(userManager); - - await managerSiteActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); - docLibId = await managerSiteActions.getDocLibId(sitePrivate); - await managerSiteActions.addSiteMember(sitePrivate, userDemoted, Site.RoleEnum.SiteManager); - - fileLockedByUserId = (await managerNodeActions.createFile(testData.fileLockedByUser.name, docLibId, '', '', '', true, ['cm:versionable'])).entry - .id; - await demotedUserActions.checkoutNodes([fileLockedByUserId]); - await demotedUserShareActions.shareFileById(fileLockedByUserId); - await managerFavoritesActions.addFavoriteById('file', fileLockedByUserId); - - await managerFavoritesActions.isFavoriteWithRetry(userManager, fileLockedByUserId, { expect: true }); - await Promise.all([ - managerFavoritesActions.waitForApi(userManager, { expect: managerFavoritesTotalItems + 1 }), - demotedUserShareActions.waitForFilesToBeShared([fileLockedByUserId]), - managerSearchActions.waitForApi(userManager, { expect: managerSearchTotalItems + 1 }) - ]); - }); - - test.afterAll(async () => { - await Utils.deleteNodesSitesEmptyTrashcan(undefined, undefined, 'afterAll failed', managerSiteActions, [sitePrivate]); - }); - - filesLockedByOtherUser(userManager, sitePrivate); - }); -}); diff --git a/e2e/playwright/special-permissions-actions-available/src/tests/viewer.ts b/e2e/playwright/special-permissions-actions-available/src/tests/viewer.ts deleted file mode 100644 index 9be4dff97..000000000 --- a/e2e/playwright/special-permissions-actions-available/src/tests/viewer.ts +++ /dev/null @@ -1,276 +0,0 @@ -/*! - * Copyright © 2005-2026 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 { FavoritesPage, LoginPage, MyLibrariesPage, SearchPage, SharedPage, TestFileData, test } from '@alfresco/aca-playwright-shared'; -import * as testData from '@alfresco/aca-playwright-shared'; - -type ViewerCapablePage = MyLibrariesPage | FavoritesPage | SharedPage | SearchPage; - -export function viewerTests(userConsumer: string, siteName: string) { - const login = async (loginPage: LoginPage): Promise => { - await loginPage.navigate(); - await loginPage.loginUser({ username: userConsumer, password: userConsumer }); - }; - - const verifyViewerActions = async (page: ViewerCapablePage, data: TestFileData, expectNoManageVersions = false): Promise => { - expect(await page.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); - await page.viewer.verifyViewerPrimaryActions(data.viewerToolbarPrimary); - await page.viewer.toolbar.clickMoreActions(); - await page.matMenu.verifyActualMoreActions(data.viewerToolbarMore); - - if (expectNoManageVersions) { - const actualMoreActions = await page.matMenu.getActualMoreActions(); - expect(actualMoreActions.includes('Manage Versions'), 'Manage Versions should not be visible for a non-versionable file').toBe(false); - } - }; - - test.describe('Consumer available actions : ', () => { - test.describe('file opened from File Libraries', () => { - const openInViewer = async (myLibrariesPage: MyLibrariesPage, loginPage: LoginPage, item: string): Promise => { - await login(loginPage); - await myLibrariesPage.navigate(); - await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName); - await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(item); - }; - - test('[XAT-4808] Actions for Consumer on a file Office', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileDocx.name); - await verifyViewerActions(myLibrariesPage, testData.fileDocx); - }); - - test('[XAT-4809] Actions for Consumer on a file Office, favorite', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileDocxFav.name); - await verifyViewerActions(myLibrariesPage, testData.fileDocxFav); - }); - - test('[XAT-4810] Actions for Consumer on a file, not Office', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.file.name); - await verifyViewerActions(myLibrariesPage, testData.file); - }); - - test('[XAT-4811] Actions for Consumer on a file, not Office, favorite', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileFav.name); - await verifyViewerActions(myLibrariesPage, testData.fileFav); - }); - - test('[XAT-20145] Manage Versions is not shown for a file without cm:versionable aspect', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileNotVersionable.name); - await verifyViewerActions(myLibrariesPage, testData.fileNotVersionable, true); - }); - - test('[XAT-4814] Actions for Consumer on a file Office, shared', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileDocxShared.name); - await verifyViewerActions(myLibrariesPage, testData.fileDocxShared); - }); - - test('[XAT-4815] Actions for Consumer on a file Office, shared, favorite', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileDocxSharedFav.name); - await verifyViewerActions(myLibrariesPage, testData.fileDocxSharedFav); - }); - - test('[XAT-4816] Actions for Consumer on a file, not Office, shared', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileShared.name); - await verifyViewerActions(myLibrariesPage, testData.fileShared); - }); - - test('[XAT-4817] Actions for Consumer on a file, not Office, shared, favorite', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileSharedFav.name); - await verifyViewerActions(myLibrariesPage, testData.fileSharedFav); - }); - - test('[XAT-4812] Actions for Consumer on a file, locked', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileLocked.name); - await verifyViewerActions(myLibrariesPage, testData.fileLocked); - }); - - test('[XAT-4813] Actions for Consumer on a file, locked, favorite', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileFavLocked.name); - await verifyViewerActions(myLibrariesPage, testData.fileFavLocked); - }); - - test('[XAT-4818] Actions for Consumer on a file, locked, shared', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileSharedLocked.name); - await verifyViewerActions(myLibrariesPage, testData.fileSharedLocked); - }); - - test('[XAT-4819] Actions for Consumer on a file, locked, shared, favorite', async ({ loginPage, myLibrariesPage }) => { - await openInViewer(myLibrariesPage, loginPage, testData.fileSharedFavLocked.name); - await verifyViewerActions(myLibrariesPage, testData.fileSharedFavLocked); - }); - }); - - test.describe('file opened from Favorites', () => { - const openInViewer = async (favoritePage: FavoritesPage, loginPage: LoginPage, item: string): Promise => { - await login(loginPage); - await favoritePage.navigate(); - await favoritePage.dataTable.performClickFolderOrFileToOpen(item); - }; - - test('[XAT-4820] File Office, favorite - ', async ({ loginPage, favoritePage }) => { - await openInViewer(favoritePage, loginPage, testData.fileDocxFav.name); - await verifyViewerActions(favoritePage, testData.fileDocxFav); - }); - - test('[XAT-4821] Actions for Consumer on a file, not Office, favorite', async ({ loginPage, favoritePage }) => { - await openInViewer(favoritePage, loginPage, testData.fileFav.name); - await verifyViewerActions(favoritePage, testData.fileFav); - }); - - test('[XAT-4823] Actions for Consumer on a file Office, shared, favorite', async ({ loginPage, favoritePage }) => { - await openInViewer(favoritePage, loginPage, testData.fileDocxSharedFav.name); - await verifyViewerActions(favoritePage, testData.fileDocxSharedFav); - }); - - test('[XAT-4824] Actions for Consumer on a file, not Office, shared, favorite', async ({ loginPage, favoritePage }) => { - await openInViewer(favoritePage, loginPage, testData.fileSharedFav.name); - await verifyViewerActions(favoritePage, testData.fileSharedFav); - }); - - test('[XAT-4822] Actions for Consumer on a file, locked, favorite', async ({ loginPage, favoritePage }) => { - await openInViewer(favoritePage, loginPage, testData.fileFavLocked.name); - await verifyViewerActions(favoritePage, testData.fileFavLocked); - }); - - test('[XAT-4825] Actions for Consumer on a file, locked, shared, favorite', async ({ loginPage, favoritePage }) => { - await openInViewer(favoritePage, loginPage, testData.fileSharedFavLocked.name); - await verifyViewerActions(favoritePage, testData.fileSharedFavLocked); - }); - }); - - test.describe('file opened from Shared Files', () => { - const openInViewer = async (sharedPage: SharedPage, loginPage: LoginPage, item: string): Promise => { - await login(loginPage); - await sharedPage.navigate(); - await sharedPage.dataTable.performClickFolderOrFileToOpen(item); - }; - - test('[XAT-4826] Actions for Consumer on a file Office, shared', async ({ loginPage, sharedPage }) => { - await openInViewer(sharedPage, loginPage, testData.fileDocxShared.name); - await verifyViewerActions(sharedPage, testData.fileDocxShared); - }); - - test('[XAT-4827] Actions for Consumer on a file Office, shared, favorite', async ({ loginPage, sharedPage }) => { - await openInViewer(sharedPage, loginPage, testData.fileDocxSharedFav.name); - await verifyViewerActions(sharedPage, testData.fileDocxSharedFav); - }); - - test('[XAT-4828] Actions for Consumer on a file, not Office, shared', async ({ loginPage, sharedPage }) => { - await openInViewer(sharedPage, loginPage, testData.fileShared.name); - await verifyViewerActions(sharedPage, testData.fileShared); - }); - - test('[XAT-4829] Actions for Consumer on a file, not Office, shared, favorite', async ({ loginPage, sharedPage }) => { - await openInViewer(sharedPage, loginPage, testData.fileSharedFav.name); - await verifyViewerActions(sharedPage, testData.fileSharedFav); - }); - - test('[XAT-4830] Actions for Consumer on a file, locked, shared', async ({ loginPage, sharedPage }) => { - await openInViewer(sharedPage, loginPage, testData.fileSharedLocked.name); - await verifyViewerActions(sharedPage, testData.fileSharedLocked); - }); - - test('[XAT-4831] Actions for Consumer on a file, locked, shared, favorite', async ({ loginPage, sharedPage }) => { - await openInViewer(sharedPage, loginPage, testData.fileSharedFavLocked.name); - await verifyViewerActions(sharedPage, testData.fileSharedFavLocked); - }); - }); - - test.describe('file opened from Search Results', () => { - const openInViewer = async (searchPage: SearchPage, loginPage: LoginPage, data: TestFileData): Promise => { - await login(loginPage); - await searchPage.searchWithin(data.random, 'filesAndFolders', 'formula'); - await searchPage.dataTable.performClickFolderOrFileToOpen(data.name); - }; - - test('[XAT-4832] Actions for Consumer on a file Office', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileDocx); - await verifyViewerActions(searchPage, testData.fileDocx); - }); - - test('[XAT-4833] Actions for Consumer on a file Office, favorite', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileDocxFav); - await verifyViewerActions(searchPage, testData.fileDocxFav); - }); - - test('[XAT-4834] Actions for Consumer on a file, not Office', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.file); - await verifyViewerActions(searchPage, testData.file); - }); - - test('[XAT-4835] Actions for Consumer on a file, not Office, favorite', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileFav); - await verifyViewerActions(searchPage, testData.fileFav); - }); - - test('[XAT-20146] Manage Versions is not shown for a file without cm:versionable aspect - Search Results', async ({ - loginPage, - searchPage - }) => { - await openInViewer(searchPage, loginPage, testData.fileNotVersionable); - await verifyViewerActions(searchPage, testData.fileNotVersionable, true); - }); - - test('[XAT-4838] Actions for Consumer on a file Office, shared', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileDocxShared); - await verifyViewerActions(searchPage, testData.fileDocxShared); - }); - - test('[XAT-4839] Actions for Consumer on a file Office, shared, favorite', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileDocxSharedFav); - await verifyViewerActions(searchPage, testData.fileDocxSharedFav); - }); - - test('[XAT-4840] Actions for Consumer on a file, not Office, shared', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileShared); - await verifyViewerActions(searchPage, testData.fileShared); - }); - - test('[XAT-4841] Actions for Consumer on a file, not Office, shared, favorite', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileSharedFav); - await verifyViewerActions(searchPage, testData.fileSharedFav); - }); - - test('[XAT-4836] Actions for Consumer on a file, locked', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileLocked); - await verifyViewerActions(searchPage, testData.fileLocked); - }); - - test('[XAT-4837] Actions for Consumer on a file, locked, favorite', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileFavLocked); - await verifyViewerActions(searchPage, testData.fileFavLocked); - }); - - test('[XAT-4842] Actions for Consumer on a file, locked, shared', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileSharedLocked); - await verifyViewerActions(searchPage, testData.fileSharedLocked); - }); - - test('[XAT-4843] Actions for Consumer on a file, locked, shared, favorite', async ({ loginPage, searchPage }) => { - await openInViewer(searchPage, loginPage, testData.fileSharedFavLocked); - await verifyViewerActions(searchPage, testData.fileSharedFavLocked); - }); - }); - }); -} diff --git a/projects/aca-playwright-shared/src/resources/test-data/index.ts b/projects/aca-playwright-shared/src/resources/test-data/index.ts index 93e95af2b..c9f3c7b08 100644 --- a/projects/aca-playwright-shared/src/resources/test-data/index.ts +++ b/projects/aca-playwright-shared/src/resources/test-data/index.ts @@ -22,5 +22,4 @@ * from Hyland Software. If not, see . */ -export * from './test-data-permissions'; export * from './test-data-files-folders'; diff --git a/projects/aca-playwright-shared/src/resources/test-data/test-data-files-folders.ts b/projects/aca-playwright-shared/src/resources/test-data/test-data-files-folders.ts index 2c0434e94..f6f3703a3 100644 --- a/projects/aca-playwright-shared/src/resources/test-data/test-data-files-folders.ts +++ b/projects/aca-playwright-shared/src/resources/test-data/test-data-files-folders.ts @@ -41,6 +41,10 @@ export interface MultiSelectionData { toolbarMore: string[]; } +// ---- files --- + +export const file = { name: `file-${Utils.random()}.txt` }; + // ---- folders --- const folderContextMenu = ['Download', 'Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions', 'Manage Rules']; diff --git a/projects/aca-playwright-shared/src/resources/test-data/test-data-permissions.ts b/projects/aca-playwright-shared/src/resources/test-data/test-data-permissions.ts deleted file mode 100644 index 65dedf26d..000000000 --- a/projects/aca-playwright-shared/src/resources/test-data/test-data-permissions.ts +++ /dev/null @@ -1,426 +0,0 @@ -/*! - * Copyright © 2005-2026 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 { Utils } from '../../utils'; - -export interface TestNode { - /** Unique token in the name; use it as a precise search term. */ - random: string; - name: string; -} - -export interface TestFileData extends TestNode { - description: string; - contextMenu: string[]; - toolbarPrimary: string[]; - toolbarMore: string[]; - viewerToolbarPrimary: string[]; - viewerToolbarMore: string[]; - searchToolbarPrimary: string[]; - favoritesToolbarMore?: string[]; - favoritesContextMenu?: string[]; - sharedToolbarMore?: string[]; - sharedContextMenu?: string[]; -} - -export interface TestFolderData { - name: string; - description: string; - contextMenu?: string[]; - toolbarPrimary?: string[]; - toolbarMore?: string[]; - searchToolbarPrimary?: string[]; - favoritesContextMenu?: string[]; - favoritesToolbarMore?: string[]; -} - -const buildFileData = (buildName: (fileRandom: string) => string, data: Omit): TestFileData => { - const fileRandom = Utils.random(); - return { random: fileRandom, name: buildName(fileRandom), ...data }; -}; - -const buildNode = (buildName: (fileRandom: string) => string): TestNode => { - const fileRandom = Utils.random(); - return { random: fileRandom, name: buildName(fileRandom) }; -}; - -// ----- files ----- - -const consumerContextMenu = ['Share', 'Download', 'View', 'Favorite', 'Copy', 'Manage Versions']; -const consumerFavContextMenu = ['Share', 'Download', 'View', 'Remove Favorite', 'Copy', 'Manage Versions']; -const consumerSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Favorite', 'Copy', 'Manage Versions']; -const consumerSharedFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Remove Favorite', 'Copy', 'Manage Versions']; - -const consumerToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions']; -const consumerSharedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; - -const searchConsumerToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions']; -const searchConsumerSharedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; - -const consumerToolbarMore = ['Favorite', 'Copy', 'Manage Versions']; -const consumerFavToolbarMore = ['Remove Favorite', 'Copy', 'Manage Versions']; - -export const collaboratorToolbarPrimary = ['View', 'View Details', 'More Actions']; -export const collaboratorEditRowToolbarMore = [ - 'Edit Offline', - 'Upload New Version', - 'Remove Favorite', - 'Copy', - 'Manage Versions', - 'Edit Aspects', - 'Permissions' -]; -export const favoritesCollaboratorToolbarMore = [ - 'Edit Offline', - 'Upload New Version', - 'Remove Favorite', - 'Move', - 'Copy', - 'Delete', - 'Manage Versions', - 'Edit Aspects', - 'Permissions' -]; -export const collaboratorSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Print', 'View Details', 'More Actions']; -export const collaboratorViewerLockedToolbarPrimary = ['Activate full-screen mode', 'View Details', 'More Actions']; -export const collaboratorDocToolbarMore = [ - 'Edit in Microsoft Office™', - 'Edit Offline', - 'Upload New Version', - 'Remove Favorite', - 'Copy', - 'Manage Versions', - 'Edit Aspects', - 'Permissions' -]; -export const collaboratorLockCurrentUserToolbarMore = ['Cancel Editing', 'Upload New Version', 'Copy']; -export const collaboratorLockOtherUserToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Permissions']; -export const collaboratorLockOtherUserSearchToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Copy', 'Permissions']; - -// ---- VIEWER ---- - -const consumerViewerSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; -const consumerViewerToolbarPrimary = ['Activate full-screen mode', 'Share', 'Download', 'Print', 'View Details', 'More Actions']; -const consumerViewerLockedToolbarPrimary = ['Activate full-screen mode', 'View Details', 'More Actions']; -const consumerViewerFavToolbarMore = ['Remove Favorite', 'Copy', 'Manage Versions']; -const consumerViewerToolbarMore = ['Favorite', 'Copy', 'Manage Versions']; -const consumerViewerLockedToolbarMore = ['Favorite', 'Copy']; -const consumerViewerLockedFavToolbarMore = ['Remove Favorite', 'Copy']; - -// ---- FAVORITES workarounds ---- - -const favoritesConsumerToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; - -const favoritesConsumerContextMenu = [ - 'Share', - 'Download', - 'View', - 'Upload New Version', - 'Remove Favorite', - 'Move', - 'Copy', - 'Delete', - 'Manage Versions' -]; - -const favoritesConsumerSharedContextMenu = [ - 'Shared Link Settings', - 'Download', - 'View', - 'Upload New Version', - 'Remove Favorite', - 'Move', - 'Copy', - 'Delete', - 'Manage Versions' -]; - -// ---- SHARED FILES workaround ---- - -const sharedConsumerToolbarMore = ['Upload New Version', 'Favorite', 'Copy', 'Manage Versions']; -const sharedConsumerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions']; -const sharedConsumerFavToolbarMore = ['Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; -const sharedConsumerFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; -const sharedConsumerContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions']; -const sharedConsumerLockedContextMenu = [ - 'Shared Link Settings', - 'Download', - 'View', - 'Cancel Editing', - 'Upload New Version', - 'Favorite', - 'Copy', - 'Manage Versions' -]; - -const sharedConsumerFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; - -const sharedConsumerFavLockedContextMenu = [ - 'Shared Link Settings', - 'Download', - 'View', - 'Cancel Editing', - 'Upload New Version', - 'Remove Favorite', - 'Copy', - 'Manage Versions' -]; - -export const fileDocx = buildFileData((fileRandom) => `file-${fileRandom}-docx.docx`, { - description: 'file not shared, not fav, office, not locked', - - contextMenu: consumerContextMenu, - toolbarPrimary: consumerToolbarPrimary, - toolbarMore: consumerToolbarMore, - viewerToolbarPrimary: consumerViewerToolbarPrimary, - viewerToolbarMore: consumerViewerToolbarMore, - - searchToolbarPrimary: searchConsumerToolbarPrimary -}); - -export const fileDocxFav = buildFileData((fileRandom) => `file-${fileRandom}-docx-fav.docx`, { - description: 'file not shared, fav, office, not locked', - - contextMenu: consumerFavContextMenu, - toolbarPrimary: consumerToolbarPrimary, - toolbarMore: consumerFavToolbarMore, - viewerToolbarPrimary: consumerViewerToolbarPrimary, - viewerToolbarMore: consumerViewerFavToolbarMore, - - favoritesToolbarMore: favoritesConsumerToolbarMore, - favoritesContextMenu: favoritesConsumerContextMenu, - - searchToolbarPrimary: searchConsumerToolbarPrimary -}); - -export const file = buildFileData((fileRandom) => `file-${fileRandom}.txt`, { - description: 'file not shared, not fav, not office, not locked', - - contextMenu: consumerContextMenu, - toolbarPrimary: consumerToolbarPrimary, - toolbarMore: consumerToolbarMore, - viewerToolbarPrimary: consumerViewerToolbarPrimary, - viewerToolbarMore: consumerViewerToolbarMore, - - searchToolbarPrimary: searchConsumerToolbarPrimary -}); - -export const fileFav = buildFileData((fileRandom) => `file-${fileRandom}-fav.txt`, { - description: 'file not shared, fav, not office, not locked', - - contextMenu: consumerFavContextMenu, - toolbarPrimary: consumerToolbarPrimary, - toolbarMore: consumerFavToolbarMore, - viewerToolbarPrimary: consumerViewerToolbarPrimary, - viewerToolbarMore: consumerViewerFavToolbarMore, - - favoritesToolbarMore: favoritesConsumerToolbarMore, - favoritesContextMenu: favoritesConsumerContextMenu, - - searchToolbarPrimary: searchConsumerToolbarPrimary -}); - -export const fileDocxShared = buildFileData((fileRandom) => `file-${fileRandom}-docx-shared.docx`, { - description: 'file shared, not fav, office, not locked', - - contextMenu: consumerSharedContextMenu, - toolbarPrimary: consumerSharedToolbarPrimary, - toolbarMore: consumerToolbarMore, - viewerToolbarPrimary: consumerViewerSharedToolbarPrimary, - viewerToolbarMore: consumerViewerToolbarMore, - - sharedToolbarMore: sharedConsumerToolbarMore, - sharedContextMenu: sharedConsumerContextMenu, - - searchToolbarPrimary: searchConsumerSharedToolbarPrimary -}); - -export const fileDocxSharedFav = buildFileData((fileRandom) => `file-${fileRandom}-docx-shared-fav.docx`, { - description: 'file shared, fav, office, not locked', - - contextMenu: consumerSharedFavContextMenu, - toolbarPrimary: consumerSharedToolbarPrimary, - toolbarMore: consumerFavToolbarMore, - viewerToolbarPrimary: consumerViewerSharedToolbarPrimary, - viewerToolbarMore: consumerViewerFavToolbarMore, - - favoritesToolbarMore: favoritesConsumerToolbarMore, - favoritesContextMenu: favoritesConsumerSharedContextMenu, - - sharedToolbarMore: sharedConsumerFavToolbarMore, - sharedContextMenu: sharedConsumerFavContextMenu, - - searchToolbarPrimary: searchConsumerSharedToolbarPrimary -}); - -export const fileShared = buildFileData((fileRandom) => `file-${fileRandom}-shared.txt`, { - description: 'file shared, not fav, not office, not locked', - - contextMenu: consumerSharedContextMenu, - toolbarPrimary: consumerSharedToolbarPrimary, - toolbarMore: consumerToolbarMore, - viewerToolbarPrimary: consumerViewerSharedToolbarPrimary, - viewerToolbarMore: consumerViewerToolbarMore, - - sharedToolbarMore: sharedConsumerToolbarMore, - sharedContextMenu: sharedConsumerContextMenu, - - searchToolbarPrimary: searchConsumerSharedToolbarPrimary -}); - -export const fileSharedFav = buildFileData((fileRandom) => `file-${fileRandom}-shared-fav.txt`, { - description: 'file shared, fav, not office, not locked', - - contextMenu: consumerSharedFavContextMenu, - toolbarPrimary: consumerSharedToolbarPrimary, - toolbarMore: consumerFavToolbarMore, - viewerToolbarPrimary: consumerViewerSharedToolbarPrimary, - viewerToolbarMore: consumerViewerFavToolbarMore, - - favoritesToolbarMore: favoritesConsumerToolbarMore, - favoritesContextMenu: favoritesConsumerSharedContextMenu, - - sharedToolbarMore: sharedConsumerFavToolbarMore, - sharedContextMenu: sharedConsumerFavContextMenu, - - searchToolbarPrimary: searchConsumerSharedToolbarPrimary -}); - -export const fileLocked = buildFileData((fileRandom) => `file-${fileRandom}-locked`, { - description: 'file not shared, not fav, not office, locked', - - contextMenu: consumerContextMenu, - toolbarPrimary: consumerToolbarPrimary, - toolbarMore: consumerToolbarMore, - viewerToolbarPrimary: consumerViewerLockedToolbarPrimary, - viewerToolbarMore: consumerViewerLockedToolbarMore, - - searchToolbarPrimary: searchConsumerToolbarPrimary -}); - -export const fileFavLocked = buildFileData((fileRandom) => `file-${fileRandom}-fav-locked`, { - description: 'file not shared, fav, not office, locked', - - contextMenu: consumerFavContextMenu, - toolbarPrimary: consumerToolbarPrimary, - toolbarMore: consumerFavToolbarMore, - viewerToolbarPrimary: consumerViewerLockedToolbarPrimary, - viewerToolbarMore: consumerViewerLockedFavToolbarMore, - - favoritesToolbarMore: favoritesConsumerToolbarMore, - favoritesContextMenu: favoritesConsumerContextMenu, - - searchToolbarPrimary: searchConsumerToolbarPrimary -}); - -export const fileSharedLocked = buildFileData((fileRandom) => `file-${fileRandom}-shared-locked`, { - description: 'file shared, not fav, not office, locked', - - contextMenu: consumerSharedContextMenu, - toolbarPrimary: consumerSharedToolbarPrimary, - toolbarMore: consumerToolbarMore, - viewerToolbarPrimary: consumerViewerLockedToolbarPrimary, - viewerToolbarMore: consumerViewerLockedToolbarMore, - - sharedToolbarMore: sharedConsumerLockedToolbarMore, - sharedContextMenu: sharedConsumerLockedContextMenu, - - searchToolbarPrimary: searchConsumerSharedToolbarPrimary -}); - -export const fileSharedFavLocked = buildFileData((fileRandom) => `file-${fileRandom}-shared-fav-locked`, { - description: 'file shared, fav, not office, locked', - - contextMenu: consumerSharedFavContextMenu, - toolbarPrimary: consumerSharedToolbarPrimary, - toolbarMore: consumerFavToolbarMore, - viewerToolbarPrimary: consumerViewerLockedToolbarPrimary, - viewerToolbarMore: consumerViewerLockedFavToolbarMore, - - favoritesToolbarMore: favoritesConsumerToolbarMore, - favoritesContextMenu: favoritesConsumerSharedContextMenu, - - sharedToolbarMore: sharedConsumerFavLockedToolbarMore, - sharedContextMenu: sharedConsumerFavLockedContextMenu, - - searchToolbarPrimary: searchConsumerSharedToolbarPrimary -}); - -export const fileLockedByUser = buildNode((fileRandom) => `file-${fileRandom}-my-locked`); - -// ---- non-versionable file (no cm:versionable aspect) ---- - -const consumerNotVersionableToolbarMore = ['Favorite', 'Copy']; -const consumerNotVersionableContextMenu = ['Share', 'Download', 'View', 'Favorite', 'Copy']; -const consumerViewerNotVersionableToolbarMore = ['Favorite', 'Copy']; - -export const fileNotVersionable = buildFileData((fileRandom) => `file-${fileRandom}-not-versionable.txt`, { - description: 'file not shared, not fav, not office, not locked, not versionable - should not show Manage Versions', - - contextMenu: consumerNotVersionableContextMenu, - toolbarPrimary: consumerToolbarPrimary, - toolbarMore: consumerNotVersionableToolbarMore, - viewerToolbarPrimary: consumerViewerToolbarPrimary, - viewerToolbarMore: consumerViewerNotVersionableToolbarMore, - - searchToolbarPrimary: searchConsumerToolbarPrimary -}); - -// ---- multiple selection --- - -const multipleSelContextMenu = ['Download', 'Favorite', 'Copy']; -const multipleSelAllFavContextMenu = ['Download', 'Remove Favorite', 'Copy']; -const multipleSelToolbarPrimary = ['Download', 'View Details', 'More Actions']; -const multipleSelToolbarMore = ['Favorite', 'Copy']; -const multipleSelAllFavToolbarMore = ['Remove Favorite', 'Copy']; -const searchMultipleSelToolbarPrimary = ['Download', 'View Details', 'More Actions']; - -// ---- FAVORITES workarounds ---- - -const favoritesMultipleSelContextMenu = ['Download', 'Favorite', 'Move', 'Copy', 'Delete']; -const favoritesMultipleSelToolbarMore = ['Favorite', 'Move', 'Copy', 'Delete']; -const favoritesMultipleSelAllFavContextMenu = ['Download', 'Remove Favorite', 'Move', 'Copy', 'Delete']; -const favoritesMultipleSelAllFavToolbarMore = ['Remove Favorite', 'Move', 'Copy', 'Delete']; - -export const multipleSel = { - contextMenu: multipleSelContextMenu, - toolbarPrimary: multipleSelToolbarPrimary, - toolbarMore: multipleSelToolbarMore, - - favoritesContextMenu: favoritesMultipleSelContextMenu, - favoritesToolbarMore: favoritesMultipleSelToolbarMore, - - searchToolbarPrimary: searchMultipleSelToolbarPrimary -}; - -export const multipleSelAllFav = { - contextMenu: multipleSelAllFavContextMenu, - toolbarPrimary: multipleSelToolbarPrimary, - toolbarMore: multipleSelAllFavToolbarMore, - - favoritesContextMenu: favoritesMultipleSelAllFavContextMenu, - favoritesToolbarMore: favoritesMultipleSelAllFavToolbarMore, - - searchToolbarPrimary: searchMultipleSelToolbarPrimary -};