Skip to content

Commit

Permalink
updates from commands
Browse files Browse the repository at this point in the history
  • Loading branch information
azakrzewski-hy committed Nov 13, 2023
1 parent 85abce3 commit 561e094
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions e2e/playwright/actions/src/tests/create-library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}`);
Expand Down
11 changes: 3 additions & 8 deletions projects/aca-playwright-shared/src/api/trashcan-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TrashcanApi> {
const classObj = new TrashcanApi();
await classObj.apiService.setUpAcaBackend(userName, password);
Expand All @@ -40,20 +37,18 @@ export class TrashcanApi {
/**
* Empties the trashcan. Uses multiple batches 1000 nodes each.
*/
async emptyTrashcan(): Promise<any> {
async emptyTrashcan(): Promise<void> {
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);
Expand Down

0 comments on commit 561e094

Please sign in to comment.