mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[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:
@@ -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;
|
||||
}
|
||||
|
75
projects/aca-playwright-shared/src/api/categories-api.ts
Normal file
75
projects/aca-playwright-shared/src/api/categories-api.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -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';
|
||||
|
@@ -44,4 +44,5 @@ export class SearchFilters extends BaseComponent {
|
||||
public menuCardClose = this.page.locator('.adf-search-filter-title-action');
|
||||
public menuCardClear = this.page.locator('#cancel-filter-button');
|
||||
public menuCardApply = this.page.locator('#apply-filter-button');
|
||||
public dropdownOptions = this.page.locator(`mat-option`);
|
||||
}
|
@@ -36,5 +36,4 @@ export class SearchFiltersLogic extends BaseComponent {
|
||||
public matchAnyInput = this.getChild(`[placeholder$='Results will match any words entered here']`);
|
||||
public excludeInput = this.getChild(`[placeholder$='Results will exclude matches with these words']`);
|
||||
public matchExactInput = this.getChild(`[placeholder$='Results will match this entire phrase']`);
|
||||
public applyButton = this.page.locator('#apply-filter-button');
|
||||
}
|
||||
|
Reference in New Issue
Block a user