Files
alfresco-content-app/e2e/playwright/copy-move-actions/src/tests/destination-picker-dialog.e2e.ts
Adam Świderski a20f8d9ac8 [ACS-7360] aca playwright e2e file name rename with .e2e.ts extension (#3738)
* [ACS-7360] authentication updated to e2e.ts

* [ACS-7360] copy-move-actions tests updated to e2e.ts

* [ACS-7360] create-actions tests updated to e2e.ts

* [ACS-7360] folder-rules tests updated to e2e.ts

* [ACS-7360] info-drawer tests updates to e2e.ts

* [ACS-7360] library-actions tests updated to e2e.ts

* [ACS_7360] list-views tests updated to e2e.ts

* [ACS-7360] navigation tests updated to e2e.ts

* [ACS-7360] pagination tests updated to e2e.ts

* [ACS-7360] search tests updated to e2e.ts

* [ACS-7360] share-actions tests updated to e2e.ts

* [ACS-7360] special-permissions tests updated to e2e.ts

* [ACS-7360] viewer tests updated to e2e.ts

* [ACS-7360] replaced every .spec.ts and .test.ts with .e2e.ts

* [ACS-7360] undo .spec.ts chages for non test files

* [ACS-7360] hardcoded credentials sonarcloud fix 1

* [ACS-7360] hardcoded credentials sonarcloud fix 2
2024-03-27 15:27:56 +01:00

103 lines
4.9 KiB
TypeScript

/*!
* 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 { ApiClientFactory, MyLibrariesPage, NodesApi, SitesApi, test, Utils, TrashcanApi } from '@alfresco/playwright-shared';
import { expect } from '@playwright/test';
import { Site } from '@alfresco/js-api';
test.describe('Copy Move actions', () => {
let nodesApi: NodesApi;
let sitesApi: SitesApi;
let trashcanApi: TrashcanApi;
const site = `site-${Utils.random()}`;
const consumerUser = `consumer-${Utils.random()}`;
const contributorUser = `contributor-${Utils.random()}`;
const collaboratorUser = `collaborator-${Utils.random()}`;
const sourceFile = `source-file-${Utils.random()}.txt`;
const destinationFolder = `destination-folder-${Utils.random()}`;
let siteId: string;
test.beforeAll(async () => {
try {
const username = `user-${Utils.random()}`;
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
nodesApi = await NodesApi.initialize(username, username);
trashcanApi = await TrashcanApi.initialize(username, username);
sitesApi = await SitesApi.initialize(username, username);
siteId = (await sitesApi.createSite(site, Site.VisibilityEnum.PRIVATE)).entry.id;
const docLibId = await sitesApi.getDocLibId(siteId);
const consumerId = (await apiClientFactory.createUser({ username: consumerUser })).entry.id;
const contributorId = (await apiClientFactory.createUser({ username: contributorUser })).entry.id;
const collaboratorId = (await apiClientFactory.createUser({ username: collaboratorUser })).entry.id;
await sitesApi.addSiteMember(siteId, consumerId, Site.RoleEnum.SiteConsumer);
await sitesApi.addSiteMember(siteId, contributorId, Site.RoleEnum.SiteContributor);
await sitesApi.addSiteMember(siteId, collaboratorId, Site.RoleEnum.SiteCollaborator);
await nodesApi.createFile(sourceFile, docLibId);
await nodesApi.createFolder(destinationFolder, docLibId);
} catch {}
});
test.afterAll(async () => {
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', sitesApi, [siteId]);
});
const copyContentInMyLibraries = async (myLibrariesPage: MyLibrariesPage) => {
await myLibrariesPage.dataTable.performClickFolderOrFileToOpen(site);
await myLibrariesPage.dataTable.selectItem(sourceFile);
await myLibrariesPage.clickMoreActionsButton('Copy');
await myLibrariesPage.contentNodeSelector.selectDestination(destinationFolder);
};
test('[C263876] Consumer user cannot select the folder as destination', async ({ loginPage, myLibrariesPage }) => {
await loginPage.loginUser({ username: consumerUser, password: consumerUser }, { withNavigation: true, waitForLoading: true });
await myLibrariesPage.navigate();
await copyContentInMyLibraries(myLibrariesPage);
expect(await myLibrariesPage.contentNodeSelector.actionButton.isEnabled()).toBe(false);
});
test('[C263877] Contributor user can select the folder as destination', async ({ loginPage, myLibrariesPage }) => {
await loginPage.loginUser({ username: contributorUser, password: contributorUser }, { withNavigation: true, waitForLoading: true });
await myLibrariesPage.navigate();
await copyContentInMyLibraries(myLibrariesPage);
expect(await myLibrariesPage.contentNodeSelector.actionButton.isEnabled()).toBe(true);
});
test('[C263878] Collaborator user can select the folder as destination', async ({ loginPage, myLibrariesPage }) => {
await loginPage.loginUser({ username: collaboratorUser, password: collaboratorUser }, { withNavigation: true, waitForLoading: true });
await myLibrariesPage.navigate();
await copyContentInMyLibraries(myLibrariesPage);
expect(await myLibrariesPage.contentNodeSelector.actionButton.isEnabled()).toBe(true);
});
});