diff --git a/e2e/playwright/navigation/src/tests/breadcrumb.spec.ts b/e2e/playwright/navigation/src/tests/breadcrumb.spec.ts index c7983a4171..3de3fc76eb 100644 --- a/e2e/playwright/navigation/src/tests/breadcrumb.spec.ts +++ b/e2e/playwright/navigation/src/tests/breadcrumb.spec.ts @@ -23,12 +23,11 @@ */ import { expect } from '@playwright/test'; -import { ApiClientFactory, getUserState, SITE_VISIBILITY, test, Utils } from '@alfresco/playwright-shared'; +import { getUserState, test, Utils } from '@alfresco/playwright-shared'; +import { Site } from '@alfresco/js-api'; test.use({ storageState: getUserState('hruser') }); test.describe('viewer action file', () => { - const apiClientFactory = new ApiClientFactory(); - const parent = `parent-${Utils.random()}`; let parentId: string; const subFolder1 = `subFolder1-${Utils.random()}`; @@ -53,8 +52,6 @@ test.describe('viewer action file', () => { const folder1Renamed = `renamed-${Utils.random()}`; test.beforeAll(async ({ nodesApiAction, sitesApiAction }) => { - await apiClientFactory.setUpAcaBackend('hruser'); - const parentNode = await nodesApiAction.createFolder(parent); parentId = parentNode.entry.id; subFolder1Id = (await nodesApiAction.createFolder(subFolder1, parentId)).entry.id; @@ -64,7 +61,7 @@ test.describe('viewer action file', () => { parent2Id = (await nodesApiAction.createFolder(parent2)).entry.id; folder1Id = (await nodesApiAction.createFolder(folder1, parent2Id)).entry.id; - await sitesApiAction.createSite(siteName, SITE_VISIBILITY.PUBLIC); + await sitesApiAction.createSite(siteName, Site.VisibilityEnum.PUBLIC); const docLibId = await sitesApiAction.getDocLibId(siteName); parentFromSiteId = (await nodesApiAction.createFolder(parentFromSite, docLibId)).entry.id; subFolder1FromSiteId = (await nodesApiAction.createFolder(subFolder1FromSite, parentFromSiteId)).entry.id; @@ -72,8 +69,8 @@ test.describe('viewer action file', () => { await nodesApiAction.createFile(fileName1FromSite, subFolder2FromSiteId); }); - test.afterAll(async () => { - await apiClientFactory.nodes.deleteNode(parentId, { permanent: true }); + test.afterAll(async ({ nodesApiAction }) => { + await nodesApiAction.deleteNodes([parentId], true); }); test('[C260964] Personal Files breadcrumb main node', async ({ personalFiles }) => { diff --git a/e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts b/e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts index b179f20a43..052203c0fc 100644 --- a/e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts +++ b/e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts @@ -23,7 +23,7 @@ */ import { expect } from '@playwright/test'; -import { ApiClientFactory, LoginPage, test, TEST_FILES, Utils } from '@alfresco/playwright-shared'; +import { ApiClientFactory, FileActionsApi, LoginPage, NodesApi, SitesApi, test, TEST_FILES, Utils } from '@alfresco/playwright-shared'; import { SiteBodyCreate } from '@alfresco/js-api'; import { Logger } from '@alfresco/adf-testing'; @@ -34,21 +34,22 @@ test.describe('from File Libraries', () => { const destination = `destFL-${Utils.random()}`; let destinationId: string; const xlsxLibraries = `xlsxFL-${Utils.random()}`; + let nodesApi: NodesApi; + let sitesApi: SitesApi; + let fileApi: FileActionsApi; - test.beforeAll(async ({ userActions }) => { + test.beforeAll(async () => { await apiClientFactory.setUpAcaBackend('admin'); await apiClientFactory.createUser({ username }); - await userActions.setUpUserAcaBackend(username, username); + nodesApi = await NodesApi.initialize(username, username); + sitesApi = await SitesApi.initialize(username, username); + fileApi = await FileActionsApi.initialize(username, username); try { - await userActions.sitesApi.createSite({ - id: siteName, - title: siteName, - visibility: SiteBodyCreate.VisibilityEnum.PUBLIC - }); - const docLibId = (await userActions.sitesApi.listSiteContainers(siteName)).list.entries[0].entry.id; - const node = await userActions.nodesApi.createNode('-my-', { name: destination, nodeType: 'cm:folder', relativePath: '/' }); + await sitesApi.createSite(siteName, SiteBodyCreate.VisibilityEnum.PUBLIC); + const docLibId = await sitesApi.getDocLibId(siteName); + const node = await nodesApi.createFolder(destination); destinationId = node.entry.id; - await userActions.uploadFile(TEST_FILES.XLSX.path, xlsxLibraries, docLibId); + await fileApi.uploadFile(TEST_FILES.XLSX.path, xlsxLibraries, docLibId); } catch (error) { Logger.error(`beforeAll failed : ${error}`); } @@ -65,11 +66,10 @@ test.describe('from File Libraries', () => { ); }); - test.afterAll(async ({ userActions }) => { + test.afterAll(async () => { try { - await userActions.setUpUserAcaBackend(username, username); - await userActions.deleteSites([siteName]); - await userActions.deleteNodes([destinationId]); + await sitesApi.deleteSites([siteName]); + await nodesApi.deleteNodes([destinationId]); } catch (error) { Logger.error(`afterAll failed : ${error}`); } diff --git a/projects/aca-playwright-shared/src/api/api-client-factory.ts b/projects/aca-playwright-shared/src/api/api-client-factory.ts index b8c25094c3..23c646a69d 100644 --- a/projects/aca-playwright-shared/src/api/api-client-factory.ts +++ b/projects/aca-playwright-shared/src/api/api-client-factory.ts @@ -89,8 +89,8 @@ export class ApiClientFactory { this.alfrescoApi = new AlfrescoApi(config); } - public async setUpAcaBackend(userProfile: keyof typeof users): Promise { - await this.login(userProfile); + public async setUpAcaBackend(userName: string, password?: string): Promise { + await this.login(userName, password); this.sites = new SitesApi(this.alfrescoApi); this.upload = new UploadApi(this.alfrescoApi); @@ -135,19 +135,17 @@ export class ApiClientFactory { return response; } - async login(userProfile: keyof typeof users) { - const userToLog = - users[ - Object.keys(users) - .filter((user) => user.match(new RegExp(`^${userProfile.toString()}$`))) - .toString() - ] || userProfile; + async login(userName: string, password?: string) { + const predefinedUserKey = Object.keys(users).find((user) => user === userName || users[user].username === userName); + const userToLog = predefinedUserKey ? users[predefinedUserKey] : undefined; let e: any; + const user = userToLog?.username ?? userName; + const userPassword = userToLog?.password ?? password; try { - e = await this.alfrescoApi.login(userToLog.username, userToLog.password); + e = await this.alfrescoApi.login(user, userPassword); } catch (error) { - logger.error(`[API Client Factory] Log in user ${userToLog.username} failed ${e}`); + logger.error(`[API Client Factory] Log in user ${user} failed ${e}`); throw error; } } diff --git a/projects/aca-playwright-shared/src/api/favorites-api.ts b/projects/aca-playwright-shared/src/api/favorites-api.ts index 83904cff83..21cae7b456 100755 --- a/projects/aca-playwright-shared/src/api/favorites-api.ts +++ b/projects/aca-playwright-shared/src/api/favorites-api.ts @@ -24,22 +24,20 @@ import { ApiClientFactory } from './api-client-factory'; import { FavoriteEntry } from '@alfresco/js-api'; -import { users } from '../base-config/global-variables'; -export class FavoritesPageApi extends ApiClientFactory { +export class FavoritesPageApi { private apiService: ApiClientFactory; constructor() { - super(); this.apiService = new ApiClientFactory(); } - static async initialize(userProfile: keyof typeof users): Promise { + static async initialize(userName: string, password?: string): Promise { const classObj = new FavoritesPageApi(); - await classObj.apiService.setUpAcaBackend(userProfile); + await classObj.apiService.setUpAcaBackend(userName, password); return classObj; } async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise { - let guid = nodeType === 'site' ? (await this.sites.getSite(id)).entry.guid : id; + let guid = nodeType === 'site' ? (await this.apiService.sites.getSite(id)).entry.guid : id; const data = { target: { [nodeType]: { diff --git a/projects/aca-playwright-shared/src/api/file-actions.ts b/projects/aca-playwright-shared/src/api/file-actions.ts index 9c7b4a528d..b4614522ac 100644 --- a/projects/aca-playwright-shared/src/api/file-actions.ts +++ b/projects/aca-playwright-shared/src/api/file-actions.ts @@ -24,21 +24,17 @@ import * as fs from 'fs'; import { ApiClientFactory } from './api-client-factory'; -import { users } from '../base-config/global-variables'; -export class FileActionsApi extends ApiClientFactory { +export class FileActionsApi { private apiService: ApiClientFactory; constructor() { - super(); this.apiService = new ApiClientFactory(); } - static async initialize( - userProfile: keyof typeof users - ): Promise { + static async initialize(userName: string, password?: string): Promise { const classObj = new FileActionsApi(); - await classObj.apiService.setUpAcaBackend(userProfile); + await classObj.apiService.setUpAcaBackend(userName, password); return classObj; } diff --git a/projects/aca-playwright-shared/src/api/index.ts b/projects/aca-playwright-shared/src/api/index.ts index 9514aaf4b5..61942ccbca 100644 --- a/projects/aca-playwright-shared/src/api/index.ts +++ b/projects/aca-playwright-shared/src/api/index.ts @@ -27,7 +27,7 @@ export * from './api-client-factory'; export * from './file-actions'; export * from './shared-links-api'; export * from './favorites-api'; -export * from './user-actions'; export * from './people-api-models'; export * from './nodes-api'; export * from './sites-api'; +export * from './node-content-tree'; diff --git a/projects/aca-playwright-shared/src/api/node-content-tree.ts b/projects/aca-playwright-shared/src/api/node-content-tree.ts new file mode 100644 index 0000000000..06292f1e85 --- /dev/null +++ b/projects/aca-playwright-shared/src/api/node-content-tree.ts @@ -0,0 +1,90 @@ +/*! + * 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 + * along with Alfresco. If not, see . + */ + +import { NodeBodyCreate } from '@alfresco/js-api'; + +const NODE_TYPE_FILE = 'cm:content'; +const NODE_TYPE_FOLDER = 'cm:folder'; +const NODE_TITLE = 'cm:title'; +const NODE_DESCRIPTION = 'cm:description'; + +export interface NodeContentTree { + name?: string; + files?: string[]; + folders?: (string | NodeContentTree)[]; + title?: string; + description?: string; +} + +export function flattenNodeContentTree(content: NodeContentTree, relativePath: string = '/'): NodeBodyCreate[] { + const { name, files, folders, title, description } = content; + const aspectNames: string[] = ['cm:versionable']; + let data: NodeBodyCreate[] = []; + let properties: any; + + properties = { + [NODE_TITLE]: title, + [NODE_DESCRIPTION]: description + }; + + if (name) { + data = data.concat([ + { + nodeType: NODE_TYPE_FOLDER, + name, + relativePath, + properties + } + ]); + + relativePath = relativePath === '/' ? `/${name}` : `${relativePath}/${name}`; + } + + if (folders) { + const foldersData: NodeBodyCreate[] = folders + .map((folder: string | NodeContentTree): NodeBodyCreate[] => { + const folderData: NodeContentTree = typeof folder === 'string' ? { name: folder } : folder; + + return flattenNodeContentTree(folderData, relativePath); + }) + .reduce((nodesData: NodeBodyCreate[], folderData: NodeBodyCreate[]) => nodesData.concat(folderData), []); + + data = data.concat(foldersData); + } + + if (files) { + const filesData: NodeBodyCreate[] = files.map( + (filename: string): NodeBodyCreate => ({ + nodeType: NODE_TYPE_FILE, + name: filename, + relativePath, + aspectNames + }) + ); + + data = data.concat(filesData); + } + + return data; +} diff --git a/projects/aca-playwright-shared/src/api/nodes-api.ts b/projects/aca-playwright-shared/src/api/nodes-api.ts index ec0c0841b7..090e27d724 100755 --- a/projects/aca-playwright-shared/src/api/nodes-api.ts +++ b/projects/aca-playwright-shared/src/api/nodes-api.ts @@ -23,20 +23,20 @@ */ import { ApiClientFactory } from './api-client-factory'; -import { NodeEntry } from '@alfresco/js-api'; -import { users } from '../base-config/global-variables'; +import { NodeChildAssociationPaging, NodeEntry } from '@alfresco/js-api'; import { logger } from '@alfresco/adf-cli/scripts/logger'; +import { NodeContentTree, flattenNodeContentTree } from './node-content-tree'; -export class NodesApi extends ApiClientFactory { +export class NodesApi { private apiService: ApiClientFactory; constructor() { - super(); this.apiService = new ApiClientFactory(); } - static async initialize(userProfile: keyof typeof users): Promise { + + static async initialize(userName: string, password?: string): Promise { const classObj = new NodesApi(); - await classObj.apiService.setUpAcaBackend(userProfile); + await classObj.apiService.setUpAcaBackend(userName, password); return classObj; } @@ -120,4 +120,98 @@ export class NodesApi extends ApiClientFactory { return null; } } + + /** + * Delete multiple nodes. + * @param nodeIds The list of node IDs to delete. + * @param permanent Delete permanently, without moving to the trashcan? (default: true) + */ + async deleteNodes(nodeIds: string[], permanent: boolean = true): Promise { + try { + for (const nodeId of nodeIds) { + await this.apiService.nodes.deleteNode(nodeId, { permanent }); + } + } catch (error) { + logger.error(`${this.constructor.name} ${this.deleteNodes.name}`, error); + } + } + + async lockNodes(nodeIds: string[], lockType: string = 'ALLOW_OWNER_CHANGES') { + try { + for (const nodeId of nodeIds) { + await this.apiService.nodes.lockNode(nodeId, { type: lockType }); + } + } catch (error) { + logger.error(`${this.constructor.name} ${this.lockNodes.name}`, error); + } + } + + async createContent(content: NodeContentTree, relativePath: string = '/'): Promise { + try { + return await this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath) as any); + } catch (error) { + logger.error(`${this.constructor.name} ${this.createContent.name}`, error); + } + } + + async getNodeIdFromParent(name: string, parentId: string): Promise { + try { + const children = (await this.getNodeChildren(parentId)).list.entries; + return children.find((elem) => elem.entry.name === name).entry.id || ''; + } catch (error) { + logger.error(`${this.constructor.name} ${this.getNodeIdFromParent.name}`, error); + return ''; + } + } + + private async getNodeChildren(nodeId: string): Promise { + try { + const opts = { + include: ['properties'] + }; + return await this.apiService.nodes.listNodeChildren(nodeId, opts); + } catch (error) { + logger.error(`${this.constructor.name} ${this.getNodeChildren.name}`, error); + return null; + } + } + + async deleteNodeById(id: string, permanent: boolean = true): Promise { + try { + await this.apiService.nodes.deleteNode(id, { permanent }); + } catch (error) { + logger.error(`${this.constructor.name} ${this.deleteNodeById.name}`, error); + } + } + + async cleanupSpaceTemplatesItems(nodeNames: string[]): Promise { + try { + const spaceTemplatesNodeId = await this.getSpaceTemplatesFolderId(); + for (const nodeName of nodeNames) { + const nodeId = await this.getNodeIdFromParent(nodeName, spaceTemplatesNodeId); + await this.deleteNodeById(nodeId); + } + } catch (error) { + logger.error('Admin Actions - cleanupSpaceTemplatesFolder failed : ', error); + } + } + + async getSpaceTemplatesFolderId(): Promise { + try { + return this.getNodeIdFromParent('Space Templates', await this.getDataDictionaryId()); + } catch (error) { + logger.error('Admin Actions - getSpaceTemplatesFolderId failed : ', error); + return ''; + } + } + + private async getDataDictionaryId(): Promise { + try { + return this.getNodeIdFromParent('Data Dictionary', '-root-'); + } catch (error) { + logger.error('Admin Actions - getDataDictionaryId failed : ', error); + return ''; + } + } + } diff --git a/projects/aca-playwright-shared/src/api/shared-links-api.ts b/projects/aca-playwright-shared/src/api/shared-links-api.ts index 69d97a996f..188abd3d69 100755 --- a/projects/aca-playwright-shared/src/api/shared-links-api.ts +++ b/projects/aca-playwright-shared/src/api/shared-links-api.ts @@ -24,19 +24,17 @@ import { ApiClientFactory } from './api-client-factory'; import { FavoritePaging, SharedLinkEntry } from '@alfresco/js-api'; -import { users } from '../base-config/global-variables'; import { logger } from '@alfresco/adf-cli/scripts/logger'; -export class SharedLinksApi extends ApiClientFactory { +export class SharedLinksApi { private apiService: ApiClientFactory; constructor() { - super(); this.apiService = new ApiClientFactory(); } - static async initialize(userProfile: keyof typeof users): Promise { + static async initialize(userName: string, password?: string): Promise { const classObj = new SharedLinksApi(); - await classObj.apiService.setUpAcaBackend(userProfile); + await classObj.apiService.setUpAcaBackend(userName, password); return classObj; } diff --git a/projects/aca-playwright-shared/src/api/sites-api.ts b/projects/aca-playwright-shared/src/api/sites-api.ts index 494a422c95..226a70ba7f 100755 --- a/projects/aca-playwright-shared/src/api/sites-api.ts +++ b/projects/aca-playwright-shared/src/api/sites-api.ts @@ -23,28 +23,25 @@ */ import { ApiClientFactory } from './api-client-factory'; -import { SiteBodyCreate, SiteEntry } from '@alfresco/js-api'; -import { users } from '../base-config/global-variables'; +import { Site, SiteBodyCreate, SiteEntry } from '@alfresco/js-api'; import { logger } from '@alfresco/adf-cli/scripts/logger'; -import { SITE_VISIBILITY } from '../utils/configs'; -export class SitesApi extends ApiClientFactory { +export class SitesApi { private apiService: ApiClientFactory; constructor() { - super(); this.apiService = new ApiClientFactory(); } - static async initialize(userProfile: keyof typeof users): Promise { + static async initialize(userName: string, password?: string): Promise { const classObj = new SitesApi(); - await classObj.apiService.setUpAcaBackend(userProfile); + await classObj.apiService.setUpAcaBackend(userName, password); return classObj; } async createSite(title: string, visibility?: string, description?: string, siteId?: string): Promise { const site = { title, - visibility: visibility || SITE_VISIBILITY.PUBLIC, + visibility: visibility || Site.VisibilityEnum.PUBLIC, description: description, id: siteId || title } as SiteBodyCreate; @@ -65,4 +62,21 @@ export class SitesApi extends ApiClientFactory { return null; } } + + /** + * Delete multiple sites/libraries. + * @param siteIds The list of the site/library IDs to delete. + * @param permanent Delete permanently, without moving to the trashcan? (default: true) + */ + async deleteSites(siteIds: string[], permanent: boolean = true) { + try { + if (siteIds && siteIds.length > 0) { + for (const siteId of siteIds) { + await this.apiService.sites.deleteSite(siteId, { permanent }); + } + } + } catch (error) { + logger.error(`${this.constructor.name} ${this.deleteSites.name}`, error); + } + } } diff --git a/projects/aca-playwright-shared/src/api/user-actions.ts b/projects/aca-playwright-shared/src/api/user-actions.ts deleted file mode 100644 index 7752e59c79..0000000000 --- a/projects/aca-playwright-shared/src/api/user-actions.ts +++ /dev/null @@ -1,134 +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 - * along with Alfresco. If not, see . - */ - -import * as fs from 'fs'; -import { Logger } from '@alfresco/adf-testing'; -import { AlfrescoApi, CommentsApi, NodesApi, TrashcanApi, SitesApi, SharedlinksApi, UploadApi } from '@alfresco/js-api'; - -const { BASE_URL } = process.env; - -const config = { - authType: 'BASIC', - hostBpm: BASE_URL, - hostEcm: BASE_URL, - provider: 'ECM', - contextRoot: 'alfresco' -}; - -export class UserActions { - public alfrescoApi: AlfrescoApi; - - public commentsApi: CommentsApi; - public nodesApi: NodesApi; - public trashCanApi: TrashcanApi; - public sitesApi: SitesApi; - public sharedLinksApi: SharedlinksApi; - public uploadApi: UploadApi; - - protected username: string; - protected password: string; - - constructor() { - this.alfrescoApi = new AlfrescoApi(config); - } - - public async setUpUserAcaBackend(username: string, password: string): Promise { - await this.loginUser(username, password ); - - this.commentsApi = new CommentsApi(this.alfrescoApi); - this.nodesApi = new NodesApi(this.alfrescoApi); - this.trashCanApi = new TrashcanApi(this.alfrescoApi); - this.sitesApi = new SitesApi(this.alfrescoApi); - this.sharedLinksApi = new SharedlinksApi(this.alfrescoApi); - this.uploadApi = new UploadApi(this.alfrescoApi); - } - - public async loginUser(username: string, password: string): Promise { - this.username = username || this.username; - this.password = password || this.password; - - try { - return this.alfrescoApi.login(this.username, this.password); - } catch (error) { - Logger.error(`\n [User Actions] - login failed ${error} error :`); - } - } - - async lockNodes(nodeIds: string[], lockType: string = 'ALLOW_OWNER_CHANGES') { - try { - for (const nodeId of nodeIds) { - await this.nodesApi.lockNode(nodeId, { type: lockType }); - } - } catch (error) { - Logger.error(`\n [User Actions] - lockNodes failed ${error} error :`); - } - } - - async uploadFile(fileLocation: string, fileName: string, parentFolderId: string): Promise { - const file = fs.createReadStream(fileLocation); - return this.uploadApi.uploadFile( - file, - '', - parentFolderId, - null, - { - name: fileName, - nodeType: 'cm:content', - renditions: 'doclib' - } - ); - } - - /** - * Delete multiple sites/libraries. - * @param siteIds The list of the site/library IDs to delete. - * @param permanent Delete permanently, without moving to the trashcan? (default: true) - */ - async deleteSites(siteIds: string[], permanent: boolean = true) { - try { - if (siteIds && siteIds.length > 0) { - for (const siteId of siteIds) { - await this.sitesApi.deleteSite(siteId, { permanent }); - } - } - } catch (error) { - Logger.error(`\n [User Actions] - deleteSites failed error : ${error}`); - } - } - - /** - * Delete multiple nodes. - * @param nodeIds The list of node IDs to delete. - * @param permanent Delete permanently, without moving to the trashcan? (default: true) - */ - async deleteNodes(nodeIds: string[], permanent: boolean = true): Promise { - try { - for (const nodeId of nodeIds) { - await this.nodesApi.deleteNode(nodeId, { permanent }); - } - } catch (error) { - Logger.error(`\n [User Actions] - deleteNodes failed error : ${error}`); - } - } -} diff --git a/projects/aca-playwright-shared/src/fixtures/page-initialization.ts b/projects/aca-playwright-shared/src/fixtures/page-initialization.ts index 197e063473..39ba021cad 100644 --- a/projects/aca-playwright-shared/src/fixtures/page-initialization.ts +++ b/projects/aca-playwright-shared/src/fixtures/page-initialization.ts @@ -35,10 +35,10 @@ import { FavoritesPage, FavoritesPageApi, TrashPage, - UserActions, LoginPage, NodesApi, - SitesApi + SitesApi, + users } from '../'; interface Pages { @@ -57,7 +57,6 @@ interface Api { fileAction: FileActionsApi; shareAction: SharedLinksApi; favoritesPageAction: FavoritesPageApi; - userActions: UserActions; nodesApiAction: NodesApi; sitesApiAction: SitesApi; } @@ -89,29 +88,25 @@ export const test = base.extend({ }, // eslint-disable-next-line no-empty-pattern fileAction: async ({}, use) => { - await use(await FileActionsApi.initialize('hruser')); + await use(await FileActionsApi.initialize(users.hruser.username)); }, // eslint-disable-next-line no-empty-pattern shareAction: async ({}, use) => { - await use(await SharedLinksApi.initialize('hruser')); + await use(await SharedLinksApi.initialize(users.hruser.username)); }, // eslint-disable-next-line no-empty-pattern favoritesPageAction: async ({}, use) => { - await use(await FavoritesPageApi.initialize('hruser')); - }, - // eslint-disable-next-line no-empty-pattern - userActions: async ({}, use) => { - await use(new UserActions()); + await use(await FavoritesPageApi.initialize(users.hruser.username)); }, // eslint-disable-next-line no-empty-pattern nodesApiAction: async ({}, use) => { - await use(await NodesApi.initialize('hruser')); + await use(await NodesApi.initialize(users.admin.username, users.admin.password)); }, // eslint-disable-next-line no-empty-pattern sitesApiAction: async ({}, use) => { - await use(await SitesApi.initialize('hruser')); + await use(await SitesApi.initialize(users.hruser.username)); }, myLibrariesPage: async ({ page }, use) => { await use(new MyLibrariesPage(page)); - } + }, }); diff --git a/projects/aca-playwright-shared/src/utils/configs.ts b/projects/aca-playwright-shared/src/utils/configs.ts deleted file mode 100755 index 051541f4f0..0000000000 --- a/projects/aca-playwright-shared/src/utils/configs.ts +++ /dev/null @@ -1,29 +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 - * along with Alfresco. If not, see . - */ - -export const SITE_VISIBILITY = { - PUBLIC: 'PUBLIC', - MODERATED: 'MODERATED', - PRIVATE: 'PRIVATE' -}; diff --git a/projects/aca-playwright-shared/src/utils/index.ts b/projects/aca-playwright-shared/src/utils/index.ts index ae27321d23..d6ac3086e5 100644 --- a/projects/aca-playwright-shared/src/utils/index.ts +++ b/projects/aca-playwright-shared/src/utils/index.ts @@ -29,4 +29,3 @@ export * from './state-helper'; export * from './folder-errors'; export * from './utils'; export * from './library-errors'; -export * from './configs';