From 561e094fb0f0820e4276b78c50bb4f586cbcacbe Mon Sep 17 00:00:00 2001 From: "adam.zakrzewski" Date: Mon, 13 Nov 2023 13:21:44 +0100 Subject: [PATCH] updates from commands --- .github/workflows/pull-request.yml | 10 ++++------ .../actions/src/tests/create-library.spec.ts | 7 ++----- .../aca-playwright-shared/src/api/trashcan-api.ts | 11 +++-------- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index c0f6a5fc9b..9b3dc87f3d 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -127,16 +127,14 @@ jobs: id: 8 - name: "copyMoveActions" id: 9 - - name: "createActions" - id: 10 - name: "deleteActions" - id: 11 + id: 10 - name: "editActions,favoriteActions" - id: 12 + id: 11 - name: "libraryActions" - id: 13 + id: 12 - name: "uploadDownloadActions" - id: 14 + id: 13 steps: - name: Checkout uses: actions/checkout@v3 diff --git a/e2e/playwright/actions/src/tests/create-library.spec.ts b/e2e/playwright/actions/src/tests/create-library.spec.ts index d68a8722e1..bde61ce502 100644 --- a/e2e/playwright/actions/src/tests/create-library.spec.ts +++ b/e2e/playwright/actions/src/tests/create-library.spec.ts @@ -40,7 +40,6 @@ import { logger } from '@alfresco/adf-cli/scripts/logger'; test.describe('Create Libraries ', () => { const apiClientFactory = new ApiClientFactory(); let sitesApi: SitesApi; - let trashcanApi: TrashcanApi; let libraryDialog: AdfLibraryDialogComponent; let libraryTable: DataTableComponent; let libraryBreadcrumb: Breadcrumb; @@ -98,10 +97,8 @@ test.describe('Create Libraries ', () => { test.afterAll(async () => { try { - for (const createdLibraryId of createdLibrariesIds) { - await apiClientFactory.sites.deleteSite(createdLibraryId, { permanent: true }); - } - trashcanApi = await TrashcanApi.initialize(username, username); + await sitesApi.deleteSites(createdLibrariesIds); + const trashcanApi = await TrashcanApi.initialize(username, username); await trashcanApi.emptyTrashcan(); } catch (error) { logger.error(`afterAll failed : ${error}`); diff --git a/projects/aca-playwright-shared/src/api/trashcan-api.ts b/projects/aca-playwright-shared/src/api/trashcan-api.ts index c6c914452c..b5a4be5949 100644 --- a/projects/aca-playwright-shared/src/api/trashcan-api.ts +++ b/projects/aca-playwright-shared/src/api/trashcan-api.ts @@ -26,11 +26,8 @@ import { ApiClientFactory } from './api-client-factory'; import { logger } from '@alfresco/adf-cli/scripts/logger'; export class TrashcanApi { - private apiService: ApiClientFactory; + private apiService = new ApiClientFactory(); - constructor() { - this.apiService = new ApiClientFactory(); - } static async initialize(userName: string, password?: string): Promise { const classObj = new TrashcanApi(); await classObj.apiService.setUpAcaBackend(userName, password); @@ -40,20 +37,18 @@ export class TrashcanApi { /** * Empties the trashcan. Uses multiple batches 1000 nodes each. */ - async emptyTrashcan(): Promise { + async emptyTrashcan(): Promise { try { const nodes = await this.apiService.trashCan.listDeletedNodes({ maxItems: 1000 }); - if (nodes?.list?.entries && nodes?.list?.entries?.length > 0) { + if (nodes?.list?.entries?.length > 0) { const ids = nodes.list.entries.map((entries) => entries.entry.id); for (const nodeId of ids) { await this.apiService.trashCan.deleteDeletedNode(nodeId); } - - await this.emptyTrashcan(); } } catch (error) { logger.error('User Actions - emptyTrashcan failed : ', error);