[ACS-7337] [E2E] protractor to playwright e2e test suites search filters categories filter (#3798)

* [ACS-7337] [E2E] Search filters - categories - tests migrated in Playwright

* [ACS-7737] only deleted

* [ACS-7337] review fix 1

* [ACS-7337] review fix 2

* [ACS-7337] excluded test again

* [ACS-7337] review fix 3

* [ACS-7337] review fix 5

* [ACS-7337] review fix 6
This commit is contained in:
Adam Świderski
2024-04-17 15:22:26 +02:00
committed by GitHub
parent 7ce9e302de
commit 8fbc22b9d6
8 changed files with 176 additions and 12 deletions

View File

@@ -40,7 +40,8 @@ import {
FavoritesApi,
TrashcanApi,
PersonEntry,
CommentsApi
CommentsApi,
CategoriesApi
} from '@alfresco/js-api';
import { ActionTypes, Rule } from './rules-api';
import { users } from '../base-config';
@@ -86,6 +87,7 @@ export class ApiClientFactory {
public trashCan: TrashcanApi;
public commentsApi: CommentsApi;
public queriesApi: QueriesApi;
public categoriesApi: CategoriesApi;
constructor() {
this.alfrescoApi = new AlfrescoApi(config);
@@ -110,6 +112,7 @@ export class ApiClientFactory {
this.trashCan = new TrashcanApi(this.alfrescoApi);
this.commentsApi = new CommentsApi(this.alfrescoApi);
this.queriesApi = new QueriesApi(this.alfrescoApi);
this.categoriesApi = new CategoriesApi(this.alfrescoApi);
return this;
}

View File

@@ -0,0 +1,75 @@
/*!
* Copyright © 2005-2024 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 <http://www.gnu.org/licenses/>.
*/
import { ApiClientFactory } from './api-client-factory';
import { CategoryEntry, CategoryBody, CategoryQuery, CategoryPaging, CategoryLinkBody } from '@alfresco/js-api';
export class CategoriesApi {
private apiService: ApiClientFactory;
constructor() {
this.apiService = new ApiClientFactory();
}
static async initialize(userName: string, password?: string): Promise<CategoriesApi> {
const classObj = new CategoriesApi();
await classObj.apiService.setUpAcaBackend(userName, password);
return classObj;
}
async createCategory(categoryId: string, categoryBodyCreate: CategoryBody[], opts?: CategoryQuery): Promise<CategoryPaging | CategoryEntry> {
try {
return await this.apiService.categoriesApi.createSubcategories(categoryId, categoryBodyCreate, opts);
} catch (error) {
console.error(error);
return null;
}
}
async deleteCategory(categoryId: string): Promise<void> {
if (categoryId === null) {
console.log('categoryId is null, skipping deletion');
return;
}
try {
await this.apiService.categoriesApi.deleteCategory(categoryId);
} catch (error) {
console.error(`${this.constructor.name} ${this.deleteCategory.name}: ${error}`);
}
}
async linkNodeToCategory(
nodeId: string,
categoryLinkBodyCreate: CategoryLinkBody[],
opts?: CategoryQuery
): Promise<CategoryPaging | CategoryEntry> {
try {
return await this.apiService.categoriesApi.linkNodeToCategory(nodeId, categoryLinkBodyCreate, opts);
} catch (error) {
console.error(`${this.constructor.name} ${this.linkNodeToCategory.name}: ${error}`);
return null;
}
}
}

View File

@@ -34,3 +34,4 @@ export * from './node-content-tree';
export * from './search-api';
export * from './trashcan-api';
export * from './queries-api';
export * from './categories-api';