mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-7294] Updated hooks - copy-move-actions (#3721)
* [ACS-7294] Updated hooks - copy-move-actions * [ACS-7294] fixed one comments test
This commit is contained in:
@@ -22,11 +22,12 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApiClientFactory, test, Utils, PersonalFilesPage, NodesApi, LoginPage } from '@alfresco/playwright-shared';
|
||||
import { ApiClientFactory, test, Utils, PersonalFilesPage, NodesApi, LoginPage, TrashcanApi } from '@alfresco/playwright-shared';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
test.describe('Copy actions', () => {
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
let sourceFile: string;
|
||||
@@ -44,13 +45,14 @@ test.describe('Copy actions', () => {
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username });
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
} catch {}
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
test.afterAll(async ({ nodesApiAction }) => {
|
||||
try {
|
||||
await nodesApiAction.deleteCurrentUserNodes();
|
||||
} catch {}
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ personalFiles, page }) => {
|
||||
@@ -60,21 +62,14 @@ test.describe('Copy actions', () => {
|
||||
destinationFolder = `destination-folder-${Utils.random()}`;
|
||||
|
||||
const loginPage = new LoginPage(page);
|
||||
try {
|
||||
await loginPage.loginUser(
|
||||
{ username, password: username },
|
||||
{
|
||||
withNavigation: true,
|
||||
waitForLoading: true
|
||||
}
|
||||
);
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
|
||||
destinationFolderId = (await nodesApi.createFolder(destinationFolder)).entry.id;
|
||||
const sourceFolderId = (await nodesApi.createFolder(sourceFolder)).entry.id;
|
||||
sourceFileInsideFolderId = (await nodesApi.createFile(sourceFileInsideFolder, sourceFolderId)).entry.id;
|
||||
sourceFileId = (await nodesApi.createFile(sourceFile)).entry.id;
|
||||
|
||||
await personalFiles.navigate();
|
||||
} catch {}
|
||||
});
|
||||
|
||||
const copyContentInPersonalFiles = async (personalFilesPage: PersonalFilesPage, sourceFileList: string[], destinationName: string) => {
|
||||
|
@@ -22,13 +22,14 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApiClientFactory, MyLibrariesPage, NodesApi, SitesApi, test, Utils } from '@alfresco/playwright-shared';
|
||||
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()}`;
|
||||
@@ -42,11 +43,13 @@ test.describe('Copy Move actions', () => {
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
const username = `user-${Utils.random()}`;
|
||||
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;
|
||||
@@ -66,10 +69,7 @@ test.describe('Copy Move actions', () => {
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
try {
|
||||
await nodesApi.deleteCurrentUserNodes();
|
||||
await sitesApi.deleteSites([siteId]);
|
||||
} catch {}
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', sitesApi, [siteId]);
|
||||
});
|
||||
|
||||
const copyContentInMyLibraries = async (myLibrariesPage: MyLibrariesPage) => {
|
||||
|
@@ -98,6 +98,7 @@ test.describe('Info Drawer - Comments', () => {
|
||||
await apiClientFactory.share.createSharedLink({ nodeId: sharedFileId });
|
||||
await fileActionsApi.waitForNodes(sharedFileName, { expect: 1 });
|
||||
await sharedPage.navigate();
|
||||
await Utils.reloadPageIfRowNotVisible(sharedPage, sharedFileName);
|
||||
await expect(sharedPage.dataTable.getRowByName(sharedFileName)).toBeVisible();
|
||||
await sharedPage.dataTable.getRowByName(sharedFileName).click();
|
||||
await sharedPage.acaHeader.viewDetails.click();
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
const crypto = require('crypto');
|
||||
import * as path from 'path';
|
||||
import { LoginPage, MyLibrariesPage, PersonalFilesPage, FavoritesLibrariesPage, SearchPage } from '../';
|
||||
import { LoginPage, MyLibrariesPage, PersonalFilesPage, FavoritesLibrariesPage, SearchPage, SharedPage } from '../';
|
||||
import { NodesApi, TrashcanApi, SitesApi } from '@alfresco/playwright-shared';
|
||||
|
||||
export class Utils {
|
||||
@@ -100,7 +100,7 @@ export class Utils {
|
||||
}
|
||||
|
||||
static async reloadPageIfRowNotVisible(
|
||||
pageContext: PersonalFilesPage | MyLibrariesPage | FavoritesLibrariesPage | SearchPage,
|
||||
pageContext: PersonalFilesPage | MyLibrariesPage | FavoritesLibrariesPage | SearchPage | SharedPage,
|
||||
nodeName: string,
|
||||
errorMessage = 'Error '
|
||||
): Promise<void> {
|
||||
|
Reference in New Issue
Block a user