[ACS-6066 ] playwright e2e other permissions (#3510)

* ACS-6066 other permissions test

* ACS-6066 other permissions test remove protractor

* ACS-6066 other permissions test remove protracto

* ACS-6066 other permissions remove code Duplicate

* ACS-6066 other permissions rebase

* ACS-6066 other permissions code cleanup

* code fix and remove protractor test

* review code fix

* review code fix

* fail test code fix
This commit is contained in:
Akash Rathod
2023-11-14 12:32:24 +01:00
committed by GitHub
parent 57ac20a8c5
commit 4877a0549b
14 changed files with 440 additions and 418 deletions

View File

@@ -7,6 +7,9 @@
"target": "es2017",
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"],
"skipLibCheck": true,
"paths": {
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
}
},
"exclude": ["node_modules"]
}

View File

@@ -7,6 +7,9 @@
"target": "es2017",
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"],
"skipLibCheck": true,
"paths": {
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
}
},
"exclude": ["node_modules"]
}

View File

@@ -7,6 +7,9 @@
"target": "es2017",
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"],
"skipLibCheck": true,
"paths": {
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
}
},
"exclude": ["node_modules"]
}

View File

@@ -37,6 +37,7 @@ test.describe('viewer action file', () => {
const fileName1 = `file1-${Utils.random()}.txt`;
const siteName = `site-${Utils.random()}`;
let docLibId: string;
const parentFromSite = `parent-in-site-${Utils.random()}`;
let parentFromSiteId: string;
const subFolder1FromSite = `subFolder1-in-site-${Utils.random()}`;
@@ -62,15 +63,16 @@ test.describe('viewer action file', () => {
folder1Id = (await nodesApiAction.createFolder(folder1, parent2Id)).entry.id;
await sitesApiAction.createSite(siteName, Site.VisibilityEnum.PUBLIC);
const docLibId = await sitesApiAction.getDocLibId(siteName);
docLibId = await sitesApiAction.getDocLibId(siteName);
parentFromSiteId = (await nodesApiAction.createFolder(parentFromSite, docLibId)).entry.id;
subFolder1FromSiteId = (await nodesApiAction.createFolder(subFolder1FromSite, parentFromSiteId)).entry.id;
subFolder2FromSiteId = (await nodesApiAction.createFolder(subFolder2FromSite, subFolder1FromSiteId)).entry.id;
await nodesApiAction.createFile(fileName1FromSite, subFolder2FromSiteId);
});
test.afterAll(async ({ nodesApiAction }) => {
test.afterAll(async ({ nodesApiAction, sitesApiAction }) => {
await nodesApiAction.deleteNodes([parentId, parent2Id], true);
await sitesApiAction.deleteSites([docLibId]);
});
test('[C260964] Personal Files breadcrumb main node', async ({ personalFiles }) => {

View File

@@ -7,6 +7,9 @@
"target": "es2017",
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"],
"skipLibCheck": true,
"paths": {
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
}
},
"exclude": ["node_modules"]
}

View File

@@ -0,0 +1,339 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { MyLibrariesPage, test } from '@alfresco/playwright-shared';
import * as testData from '@alfresco/playwright-shared';
import { expect } from '@playwright/test';
async function checkActionsAvailable(
myLibrariesPage: MyLibrariesPage,
item: string,
expectedToolbarPrimary: string[],
expectedToolbarMore: string[]
): Promise<void> {
await myLibrariesPage.dataTable.selectItem(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<void> {
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(item);
expect(await myLibrariesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true);
await myLibrariesPage.viewer.verifyViewerPrimaryActions(expectedToolbarPrimary);
await myLibrariesPage.acaHeader.clickViewerMoreActions();
await myLibrariesPage.matMenu.verifyActualMoreActions(expectedToolbarMore);
}
export function collaboratorTests(userCollaborator: string, siteName: string) {
test.describe('available actions : ', () => {
test.beforeEach(async ({ loginPage }) => {
await loginPage.navigate();
await loginPage.loginUser({ username: userCollaborator, password: userCollaborator });
});
test('on File Libraries - [C297647]', async ({ myLibrariesPage }) => {
await myLibrariesPage.navigate();
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName);
await checkActionsAvailable(
myLibrariesPage,
testData.fileSharedFav.name,
testData.collaboratorToolbarPrimary,
testData.collaboratorEditRowToolbarMore
);
});
test('on Shared Files - [C297651]', async ({ sharedPage, myLibrariesPage }) => {
await sharedPage.navigate();
await checkActionsAvailable(
myLibrariesPage,
testData.fileSharedFav.name,
testData.collaboratorToolbarPrimary,
testData.collaboratorEditRowToolbarMore
);
});
test('on Favorites - [C297652]', async ({ favoritePage, myLibrariesPage }) => {
await favoritePage.navigate();
await checkActionsAvailable(
myLibrariesPage,
testData.fileSharedFav.name,
testData.collaboratorToolbarPrimary,
testData.favoritesCollaboratorToolbarMore
);
});
test('on Search Results - [C297653]', async ({ searchPage, myLibrariesPage }) => {
await searchPage.navigate({ remoteUrl: `#/search;q=${testData.fileSharedFav.name}` });
await checkActionsAvailable(
myLibrariesPage,
testData.fileSharedFav.name,
testData.collaboratorToolbarPrimary,
testData.collaboratorEditRowToolbarMore
);
});
test.describe('available actions in the viewer : ', () => {
test('file opened from File Libraries - [C297654]', async ({ myLibrariesPage }) => {
await myLibrariesPage.navigate();
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName);
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileDocxSharedFav.name,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorDocToolbarMore
);
});
test('file opened from Shared Files - [C297655]', async ({ sharedPage, myLibrariesPage }) => {
await sharedPage.navigate();
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileDocxSharedFav.name,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorDocToolbarMore
);
});
test('file opened from Favorites - [C297656]', async ({ favoritePage, myLibrariesPage }) => {
await favoritePage.navigate();
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileDocxSharedFav.name,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorDocToolbarMore
);
});
test('file opened from Search Results - [C306992]', async ({ searchPage, myLibrariesPage }) => {
await searchPage.navigate({ remoteUrl: `#/search;q=${testData.fileDocxSharedFav.name}` });
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('on File Libraries - [C297657]', async ({ myLibrariesPage }) => {
await myLibrariesPage.navigate();
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName);
await checkActionsAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorToolbarPrimary,
testData.collaboratorLockCurrentUserToolbarMore
);
});
test('on Shared Files - [C297658]', async ({ sharedPage, myLibrariesPage }) => {
await sharedPage.navigate();
await checkActionsAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorToolbarPrimary,
testData.collaboratorLockCurrentUserToolbarMore
);
});
test('on Favorites - [C297659]', async ({ favoritePage, myLibrariesPage }) => {
await favoritePage.navigate();
await checkActionsAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorToolbarPrimary,
testData.favoritesCollaboratorToolbarMore
);
});
test('on Search Results - [C297660]', async ({ searchPage, myLibrariesPage }) => {
await searchPage.navigate({ remoteUrl: `#/search;q=${testData.fileLockedByUser}` });
await checkActionsAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorToolbarPrimary,
testData.collaboratorLockCurrentUserToolbarMore
);
});
});
test.describe('available actions in the viewer : ', () => {
test('file opened from File Libraries - [C297661]', async ({ myLibrariesPage }) => {
await myLibrariesPage.navigate();
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName);
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorLockCurrentUserToolbarMore
);
});
test('file opened from Shared Files - [C297662]', async ({ sharedPage, myLibrariesPage }) => {
await sharedPage.navigate();
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorLockCurrentUserToolbarMore
);
});
test('file opened from Favorites - [C297663]', async ({ favoritePage, myLibrariesPage }) => {
await favoritePage.navigate();
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorLockCurrentUserToolbarMore
);
});
test('file opened from Search Results - [C306993]', async ({ searchPage, myLibrariesPage }) => {
await searchPage.navigate({ remoteUrl: `#/search;q=${testData.fileLockedByUser}` });
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorLockCurrentUserToolbarMore
);
});
});
});
}
export function filesLockedByOtherUser(userManager: string, siteName?: string) {
test.describe('available actions : ', () => {
test.beforeEach(async ({ loginPage }) => {
await loginPage.navigate();
await loginPage.loginUser({ username: userManager, password: userManager });
});
test('on File Libraries - [C297664]', async ({ myLibrariesPage }) => {
await myLibrariesPage.navigate();
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName);
await checkActionsAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorToolbarPrimary,
testData.collaboratorLockOtherUserToolbarMore
);
});
test('on Shared Files - [C297665]', async ({ sharedPage, myLibrariesPage }) => {
const expectedToolbarMore = [
'Cancel Editing',
'Upload New Version',
'Remove Favorite',
'Move',
'Copy',
'Delete',
'Manage Versions',
'Permissions'
];
await sharedPage.navigate();
await checkActionsAvailable(myLibrariesPage, testData.fileLockedByUser, testData.collaboratorToolbarPrimary, expectedToolbarMore);
});
test('on Favorites - [C297666]', async ({ favoritePage, myLibrariesPage }) => {
await favoritePage.navigate();
await checkActionsAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorToolbarPrimary,
testData.favoritesCollaboratorToolbarMore
);
});
test('on Search Results - [C297667]', async ({ searchPage, myLibrariesPage }) => {
await searchPage.navigate({ remoteUrl: `#/search;q=${testData.fileLockedByUser}` });
await checkActionsAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorToolbarPrimary,
testData.collaboratorLockOtherUserSearchToolbarMore
);
});
test.describe('available actions in the viewer : ', () => {
test('file opened from File Libraries - [C297671]', async ({ myLibrariesPage }) => {
await myLibrariesPage.navigate();
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(siteName);
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorLockOtherUserToolbarMore
);
});
test('file opened from Shared Files - [C297672]', async ({ sharedPage, myLibrariesPage }) => {
await sharedPage.navigate();
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorLockOtherUserToolbarMore
);
});
test('file opened from Favorites - [C297673]', async ({ favoritePage, myLibrariesPage }) => {
await favoritePage.navigate();
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorLockOtherUserToolbarMore
);
});
// TODO: add 'Move' and 'Delete' when ACA-2319 is fixed
test('file opened from Search Results - [C306994]', async ({ searchPage, myLibrariesPage }) => {
await searchPage.navigate({ remoteUrl: `#/search;q=${testData.fileLockedByUser}` });
await checkActionsViewerAvailable(
myLibrariesPage,
testData.fileLockedByUser,
testData.collaboratorSharedToolbarPrimary,
testData.collaboratorLockOtherUserSearchToolbarMore
);
});
});
});
}

View File

@@ -24,6 +24,7 @@
import * as testData from '@alfresco/playwright-shared';
import { viewerTests } from './viewer';
import { collaboratorTests, filesLockedByCurrentUser, filesLockedByOtherUser } from './other-permissions';
import {
ApiClientFactory,
FavoritesPageApi,
@@ -78,7 +79,7 @@ test.describe('Special permissions : ', () => {
let managerSearchActions: SearchPageApi;
test.beforeAll(async () => {
test.setTimeout(120000);
test.setTimeout(140000);
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username: userManager });
await apiClientFactory.createUser({ username: userConsumer });
@@ -131,8 +132,10 @@ test.describe('Special permissions : ', () => {
await managerNodeActions.createFolder(testData.folder.name, docLibId);
folderFavId = (await managerNodeActions.createFolder(testData.folderFav.name, docLibId)).entry.id;
folderFav2Id = (await managerNodeActions.createFolder(testData.folderFav2.name, docLibId)).entry.id;
await consumerFavoritesActions.addFavoritesByIds('folder', [folderFavId, folderFav2Id]);
await consumerFavoritesActions.addFavoritesByIds('folder', [folderFavId, folderFav2Id]);
await collaboratorFavoritesActions.addFavoritesByIds('file', [fileDocxSharedFavId, fileSharedFavId]);
await managerFavoritesActions.addFavoriteById('file', fileLockedByUserId);
await consumerFavoritesActions.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
@@ -153,14 +156,11 @@ test.describe('Special permissions : ', () => {
fileGranularPermissionId
]);
await collaboratorFavoritesActions.addFavoritesByIds('file', [fileDocxSharedFavId, fileSharedFavId]);
await managerNodeActions.lockNodes([fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId]);
await managerNodeActions.setGranularPermission(fileGranularPermissionId, false, userConsumer, Site.RoleEnum.SiteManager);
await managerFavoritesActions.addFavoriteById('file', fileLockedByUserId);
await collaboratorFavoritesActions.isFavoriteWithRetry(userCollaborator, fileSharedFavId, { expect: true });
await Promise.all([
consumerFavoritesActions.waitForApi(userConsumer, { expect: consumerFavoritesTotalItems + 9 }),
managerUserShareActions.waitForFilesToBeShared([
@@ -187,4 +187,16 @@ test.describe('Special permissions : ', () => {
viewerTests(userConsumer, sitePrivate);
});
});
test.describe('Collaborator', () => {
collaboratorTests(userCollaborator, sitePrivate);
});
test.describe('File locked - user is lock owner', () => {
filesLockedByCurrentUser(userDemoted, sitePrivate);
});
test.describe('File locked by other user - user is manager', () => {
filesLockedByOtherUser(userManager, sitePrivate);
});
});

View File

@@ -7,6 +7,9 @@
"target": "es2017",
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"],
"skipLibCheck": true,
"paths": {
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
}
},
"exclude": ["node_modules"]
}

View File

@@ -7,6 +7,9 @@
"target": "es2017",
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"],
"skipLibCheck": true,
"paths": {
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
}
},
"exclude": ["node_modules"]
}

View File

@@ -1,371 +0,0 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { BrowsingPage, SearchResultsPage, Utils } from '@alfresco/aca-testing-shared';
import * as testData from './test-data-permissions';
import * as testUtil from '../test-util';
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.pageLayoutHeader;
export function collaboratorTests(siteName?: string) {
describe('available actions : ', () => {
beforeEach(async () => {
await Utils.pressEscape();
});
afterEach(async () => {
await page.closeOpenDialogs();
});
it('on File Libraries - [C297647]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Edit Aspects', 'Permissions'];
await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
});
it('on Shared Files - [C297651]', async () => {
await page.clickSharedFilesAndWait();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Edit Aspects', 'Permissions'];
await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
});
it('on Favorites - [C297652]', async () => {
await page.clickFavoritesAndWait();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
// TODO: investigate why 'Edit Offline' is not displayed and raise issue
// TODO: remove 'Move' and 'Delete' when ACA-1737 is done
const expectedToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
});
it('on Search Results - [C297653]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileSharedFav.name);
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Edit Aspects', 'Permissions'];
await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
});
describe('available actions in the viewer : ', () => {
it('file opened from File Libraries - [C297654]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = [
'Edit in Microsoft Office™',
'Edit Offline',
'Upload New Version',
'Remove Favorite',
'Copy',
'Manage Versions',
'Edit Aspects',
'Permissions'
];
await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
});
it('file opened from Shared Files - [C297655]', async () => {
await page.clickSharedFilesAndWait();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = [
'Edit in Microsoft Office™',
'Edit Offline',
'Upload New Version',
'Remove Favorite',
'Copy',
'Manage Versions',
'Edit Aspects',
'Permissions'
];
await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
});
it('file opened from Favorites - [C297656]', async () => {
await page.clickFavoritesAndWait();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = [
'Edit in Microsoft Office™',
'Edit Offline',
'Upload New Version',
'Remove Favorite',
'Copy',
'Manage Versions',
'Edit Aspects',
'Permissions'
];
await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
});
it('file opened from Search Results - [C306992]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileDocxSharedFav.name);
await searchResultsPage.waitForResults();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = [
'Edit in Microsoft Office™',
'Edit Offline',
'Upload New Version',
'Remove Favorite',
'Copy',
'Manage Versions',
'Edit Aspects',
'Permissions'
];
await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
});
});
});
}
export function filesLockedByCurrentUser(siteName?: string) {
describe('available actions : ', () => {
beforeEach(async () => {
await Utils.pressEscape();
});
afterEach(async () => {
await page.closeOpenDialogs();
});
it('on File Libraries - [C297657]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('on Shared Files - [C297658]', async () => {
await page.clickSharedFilesAndWait();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('on Favorites - [C297659]', async () => {
await page.clickFavoritesAndWait();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
// TODO: remove 'Move' and 'Delete' when ACA-1737 is fixed
const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('on Search Results - [C297660]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileLockedByUser);
await searchResultsPage.waitForResults();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
describe('available actions in the viewer : ', () => {
it('file opened from File Libraries - [C297661]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('file opened from Shared Files - [C297662]', async () => {
await page.clickSharedFilesAndWait();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('file opened from Favorites - [C297663]', async () => {
await page.clickFavoritesAndWait();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('file opened from Search Results - [C306993]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileLockedByUser);
await searchResultsPage.waitForResults();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
});
});
}
export function filesLockedByOtherUser(siteName?: string) {
describe('available actions : ', () => {
beforeEach(async () => {
await Utils.pressEscape();
});
afterEach(async () => {
await page.closeOpenDialogs();
});
it('on File Libraries - [C297664]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('on Shared Files - [C297665]', async () => {
await page.clickSharedFilesAndWait();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
// TODO: investigate why 'Upload New Version' appears and raise issue
const expectedToolbarMore = [
'Cancel Editing',
'Upload New Version',
'Remove Favorite',
'Move',
'Copy',
'Delete',
'Manage Versions',
'Permissions'
];
await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('on Favorites - [C297666]', async () => {
await page.clickFavoritesAndWait();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
// TODO: investigate why 'Cancel Editing' doesn't appear and raise issue
// TODO: remove 'Upload New Version' when ACA-1737 is done
const expectedToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('on Search Results - [C297667]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileLockedByUser);
await searchResultsPage.waitForResults();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
describe('available actions in the viewer : ', () => {
it('file opened from File Libraries - [C297671]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('file opened from Shared Files - [C297672]', async () => {
await page.clickSharedFilesAndWait();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('file opened from Favorites - [C297673]', async () => {
await page.clickFavoritesAndWait();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
it('file opened from Search Results - [C306994]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileLockedByUser);
await searchResultsPage.waitForResults();
const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
// TODO: add 'Move' and 'Delete' when ACA-2319 is fixed
const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore);
});
});
});
}

View File

@@ -28,7 +28,6 @@ import { librariesTests } from './my-libraries';
import { favoritesTests } from './favorites';
import { searchResultsTests } from './search-results';
import { sharedFilesTests } from './shared-files';
import { collaboratorTests, filesLockedByCurrentUser, filesLockedByOtherUser } from './other-permissions';
describe('Special permissions : ', () => {
const random = testData.random;
@@ -37,7 +36,6 @@ describe('Special permissions : ', () => {
const userManager = `manager-${random}`;
const userConsumer = `consumer-${random}`;
const userCollaborator = `collaborator-${random}`;
const userDemoted = `demoted-${random}`;
let fileDocxFavId: string;
@@ -61,7 +59,6 @@ describe('Special permissions : ', () => {
const userManagerApi = new RepoClient(userManager, userManager);
const userConsumerApi = new RepoClient(userConsumer, userConsumer);
const userCollaboratorApi = new RepoClient(userCollaborator, userCollaborator);
const userDemotedApi = new RepoClient(userDemoted, userDemoted);
const loginPage = new LoginPage();
@@ -69,7 +66,6 @@ describe('Special permissions : ', () => {
beforeAll(async () => {
await adminApiActions.createUser({ username: userManager });
await adminApiActions.createUser({ username: userConsumer });
await adminApiActions.createUser({ username: userCollaborator });
await adminApiActions.createUser({ username: userDemoted });
await managerActions.login(userManager, userManager);
@@ -77,12 +73,10 @@ describe('Special permissions : ', () => {
const consumerFavoritesTotalItems = await userConsumerApi.favorites.getFavoritesTotalItems();
const managerSearchTotalItems = await userManagerApi.search.getTotalItems(userManager);
const collaboratorFavoritesTotalItems = await userCollaboratorApi.favorites.getFavoritesTotalItems();
await userManagerApi.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await userManagerApi.sites.getDocLibId(sitePrivate);
await userManagerApi.sites.addSiteConsumer(sitePrivate, userConsumer);
await userManagerApi.sites.addSiteCollaborator(sitePrivate, userCollaborator);
await userManagerApi.sites.addSiteManager(sitePrivate, userDemoted);
await userManagerApi.upload.uploadFileWithRename(FILES.docxFile, docLibId, testData.fileDocx.name);
@@ -130,8 +124,6 @@ describe('Special permissions : ', () => {
fileGranularPermissionId
]);
await userCollaboratorApi.favorites.addFavoritesByIds('file', [fileDocxSharedFavId, fileSharedFavId]);
await managerActions.lockNodes([fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId]);
await userManagerApi.nodes.setGranularPermission(fileGranularPermissionId, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE);
@@ -150,8 +142,7 @@ describe('Special permissions : ', () => {
fileGranularPermissionId,
fileLockedByUserId
]),
userManagerApi.search.waitForApi(userManager, { expect: managerSearchTotalItems + 14 }),
userCollaboratorApi.favorites.waitForApi({ expect: collaboratorFavoritesTotalItems + 2 })
userManagerApi.search.waitForApi(userManager, { expect: managerSearchTotalItems + 14 })
]);
});
@@ -184,28 +175,4 @@ describe('Special permissions : ', () => {
sharedFilesTests();
});
});
describe('Collaborator', () => {
beforeAll(async () => {
await loginPage.loginWith(userCollaborator);
});
collaboratorTests(sitePrivate);
});
describe('File locked - user is lock owner', () => {
beforeAll(async () => {
await loginPage.loginWith(userDemoted);
});
filesLockedByCurrentUser(sitePrivate);
});
describe('File locked by other user - user is manager', () => {
beforeAll(async () => {
await loginPage.loginWith(userManager);
});
filesLockedByOtherUser(sitePrivate);
});
});

View File

@@ -22,12 +22,14 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';
import { Page, expect } from '@playwright/test';
import { MatMenuComponent } from './dataTable';
import { BaseComponent } from './base.component';
export class AcaHeader extends BaseComponent {
private static rootElement = 'aca-toolbar';
private moreActionsButton = this.getChild('button[id="app.viewer.toolbar.more"]');
private toolbarMoreActions = this.getChild('button[id="app.toolbar.more"]');
public createButton = this.getChild('[id="app.toolbar.create"]');
public viewDetails = this.getChild('[title="View Details"]');
public viewButton = this.getChild('button[title="View"]');
@@ -46,11 +48,30 @@ export class AcaHeader extends BaseComponent {
await this.moreActionsButton.click();
}
async clickMoreActions(): Promise<void> {
await this.toolbarMoreActions.waitFor({ state: 'attached' });
await this.toolbarMoreActions.click();
}
async clickCreateFolderFromTemplate(): Promise<void> {
await this.createButton.click();
await this.matMenu.createFolderFromTemplate.click();
}
async verifyToolbarPrimaryActions(expectedToolbarPrimary: string[]): Promise<void> {
let buttons = await this.page.$$('aca-toolbar button');
let actualPrimaryActions: string[] = await Promise.all(
buttons.map(async (button) => {
const title = await button.getAttribute('title');
return title || '';
})
);
for (const action of expectedToolbarPrimary) {
expect(actualPrimaryActions.includes(action), `Expected to contain ${action}`).toBe(true);
}
}
async clickCreateFileFromTemplate(): Promise<void> {
await this.createButton.click();
await this.matMenu.createFileFromTemplate.click();

View File

@@ -45,7 +45,7 @@ export class DataTableComponent extends BaseComponent {
getRowLocator = this.getChild(`adf-datatable-row`);
/** Locator to get "No results found" message */
getNoResultsFoundMessage = this.getChild('adf-custom-empty-content-template', { hasText: "No results found" });
getNoResultsFoundMessage = this.getChild('adf-custom-empty-content-template', { hasText: 'No results found' });
/**
* Method used in cases where we want to check that some record is visible in the datatable. It will consider whole row
@@ -210,13 +210,14 @@ export class DataTableComponent extends BaseComponent {
async selectItem(name: string): Promise<void> {
const isSelected = await this.hasCheckMarkIcon(name);
if (!isSelected) {
const row = this.getRowByName(name);
await row.locator('.mat-checkbox[id*="mat-checkbox"]').check();
let row = this.getRowByName(name);
await row.locator('[title="Size"]').click();
await row.locator('.adf-datatable-selected').waitFor({ state: 'attached' });
}
}
async hasCheckMarkIcon(itemName: string): Promise<boolean> {
const row = this.getRowByName(itemName);
return await row.locator('.mat-checkbox[class*="checked"]').isVisible();
return await row.locator('.adf-datatable-selected').isVisible();
}
}

View File

@@ -42,6 +42,39 @@ const searchConsumerSharedToolbarPrimary = ['Shared Link Settings', 'Download',
const consumerToolbarMore = ['Favorite', 'Copy', 'Manage Versions'];
const consumerFavToolbarMore = ['Remove Favorite', 'Copy', 'Manage Versions'];
export const collaboratorToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
export const collaboratorEditRowToolbarMore = [
'Edit Offline',
'Upload New Version',
'Remove Favorite',
'Copy',
'Manage Versions',
'Edit Aspects',
'Permissions'
];
export const favoritesCollaboratorToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
export const collaboratorSharedToolbarPrimary = [
'Activate full-screen mode',
'Shared Link Settings',
'Download',
'Print',
'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', 'Remove Favorite', 'Copy', 'Manage Versions'];
export const collaboratorLockOtherUserToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
export const collaboratorLockOtherUserSearchToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
// ---- VIEWER ----
const consumerViewerSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];