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/>.
|
* 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';
|
import { expect } from '@playwright/test';
|
||||||
|
|
||||||
test.describe('Copy actions', () => {
|
test.describe('Copy actions', () => {
|
||||||
let nodesApi: NodesApi;
|
let nodesApi: NodesApi;
|
||||||
|
let trashcanApi: TrashcanApi;
|
||||||
const username = `user-${Utils.random()}`;
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
let sourceFile: string;
|
let sourceFile: string;
|
||||||
@@ -44,13 +45,14 @@ test.describe('Copy actions', () => {
|
|||||||
await apiClientFactory.setUpAcaBackend('admin');
|
await apiClientFactory.setUpAcaBackend('admin');
|
||||||
await apiClientFactory.createUser({ username });
|
await apiClientFactory.createUser({ username });
|
||||||
nodesApi = await NodesApi.initialize(username, 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 }) => {
|
test.afterAll(async () => {
|
||||||
try {
|
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||||
await nodesApiAction.deleteCurrentUserNodes();
|
|
||||||
} catch {}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test.beforeEach(async ({ personalFiles, page }) => {
|
test.beforeEach(async ({ personalFiles, page }) => {
|
||||||
@@ -60,21 +62,14 @@ test.describe('Copy actions', () => {
|
|||||||
destinationFolder = `destination-folder-${Utils.random()}`;
|
destinationFolder = `destination-folder-${Utils.random()}`;
|
||||||
|
|
||||||
const loginPage = new LoginPage(page);
|
const loginPage = new LoginPage(page);
|
||||||
try {
|
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||||
await loginPage.loginUser(
|
|
||||||
{ username, password: username },
|
|
||||||
{
|
|
||||||
withNavigation: true,
|
|
||||||
waitForLoading: true
|
|
||||||
}
|
|
||||||
);
|
|
||||||
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();
|
destinationFolderId = (await nodesApi.createFolder(destinationFolder)).entry.id;
|
||||||
} catch {}
|
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();
|
||||||
});
|
});
|
||||||
|
|
||||||
const copyContentInPersonalFiles = async (personalFilesPage: PersonalFilesPage, sourceFileList: string[], destinationName: string) => {
|
const copyContentInPersonalFiles = async (personalFilesPage: PersonalFilesPage, sourceFileList: string[], destinationName: string) => {
|
||||||
|
@@ -22,13 +22,14 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* 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 { expect } from '@playwright/test';
|
||||||
import { Site } from '@alfresco/js-api';
|
import { Site } from '@alfresco/js-api';
|
||||||
|
|
||||||
test.describe('Copy Move actions', () => {
|
test.describe('Copy Move actions', () => {
|
||||||
let nodesApi: NodesApi;
|
let nodesApi: NodesApi;
|
||||||
let sitesApi: SitesApi;
|
let sitesApi: SitesApi;
|
||||||
|
let trashcanApi: TrashcanApi;
|
||||||
|
|
||||||
const site = `site-${Utils.random()}`;
|
const site = `site-${Utils.random()}`;
|
||||||
const consumerUser = `consumer-${Utils.random()}`;
|
const consumerUser = `consumer-${Utils.random()}`;
|
||||||
@@ -42,11 +43,13 @@ test.describe('Copy Move actions', () => {
|
|||||||
|
|
||||||
test.beforeAll(async () => {
|
test.beforeAll(async () => {
|
||||||
try {
|
try {
|
||||||
|
const username = `user-${Utils.random()}`;
|
||||||
const apiClientFactory = new ApiClientFactory();
|
const apiClientFactory = new ApiClientFactory();
|
||||||
await apiClientFactory.setUpAcaBackend('admin');
|
await apiClientFactory.setUpAcaBackend('admin');
|
||||||
const username = `user-${Utils.random()}`;
|
|
||||||
await apiClientFactory.createUser({ username });
|
await apiClientFactory.createUser({ username });
|
||||||
|
|
||||||
nodesApi = await NodesApi.initialize(username, username);
|
nodesApi = await NodesApi.initialize(username, username);
|
||||||
|
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||||
sitesApi = await SitesApi.initialize(username, username);
|
sitesApi = await SitesApi.initialize(username, username);
|
||||||
|
|
||||||
siteId = (await sitesApi.createSite(site, Site.VisibilityEnum.PRIVATE)).entry.id;
|
siteId = (await sitesApi.createSite(site, Site.VisibilityEnum.PRIVATE)).entry.id;
|
||||||
@@ -66,10 +69,7 @@ test.describe('Copy Move actions', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.afterAll(async () => {
|
test.afterAll(async () => {
|
||||||
try {
|
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', sitesApi, [siteId]);
|
||||||
await nodesApi.deleteCurrentUserNodes();
|
|
||||||
await sitesApi.deleteSites([siteId]);
|
|
||||||
} catch {}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const copyContentInMyLibraries = async (myLibrariesPage: MyLibrariesPage) => {
|
const copyContentInMyLibraries = async (myLibrariesPage: MyLibrariesPage) => {
|
||||||
|
@@ -98,6 +98,7 @@ test.describe('Info Drawer - Comments', () => {
|
|||||||
await apiClientFactory.share.createSharedLink({ nodeId: sharedFileId });
|
await apiClientFactory.share.createSharedLink({ nodeId: sharedFileId });
|
||||||
await fileActionsApi.waitForNodes(sharedFileName, { expect: 1 });
|
await fileActionsApi.waitForNodes(sharedFileName, { expect: 1 });
|
||||||
await sharedPage.navigate();
|
await sharedPage.navigate();
|
||||||
|
await Utils.reloadPageIfRowNotVisible(sharedPage, sharedFileName);
|
||||||
await expect(sharedPage.dataTable.getRowByName(sharedFileName)).toBeVisible();
|
await expect(sharedPage.dataTable.getRowByName(sharedFileName)).toBeVisible();
|
||||||
await sharedPage.dataTable.getRowByName(sharedFileName).click();
|
await sharedPage.dataTable.getRowByName(sharedFileName).click();
|
||||||
await sharedPage.acaHeader.viewDetails.click();
|
await sharedPage.acaHeader.viewDetails.click();
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
import * as path from 'path';
|
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';
|
import { NodesApi, TrashcanApi, SitesApi } from '@alfresco/playwright-shared';
|
||||||
|
|
||||||
export class Utils {
|
export class Utils {
|
||||||
@@ -100,7 +100,7 @@ export class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async reloadPageIfRowNotVisible(
|
static async reloadPageIfRowNotVisible(
|
||||||
pageContext: PersonalFilesPage | MyLibrariesPage | FavoritesLibrariesPage | SearchPage,
|
pageContext: PersonalFilesPage | MyLibrariesPage | FavoritesLibrariesPage | SearchPage | SharedPage,
|
||||||
nodeName: string,
|
nodeName: string,
|
||||||
errorMessage = 'Error '
|
errorMessage = 'Error '
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
Reference in New Issue
Block a user