[ACS-6668] [ACS-6669] e2e migration - Info Drawer general and library properties tests (#3628)

*[ACS-6668] [ACS-6669] e2e migration - Info Drawer general and library properties tests 
---------
Co-authored-by: datguycheb <adam.swiderski@hyland.com>
This commit is contained in:
Katarzyna Kita
2024-02-13 09:58:45 +01:00
committed by GitHub
parent 630f698300
commit 1400545c2d
9 changed files with 501 additions and 29 deletions

View File

@@ -85,6 +85,7 @@ export class ApiClientFactory {
public favorites: FavoritesApi;
public trashCan: TrashcanApi;
public commentsApi: CommentsApi;
public queriesApi: QueriesApi;
constructor() {
this.alfrescoApi = new AlfrescoApi(config);
@@ -108,6 +109,7 @@ export class ApiClientFactory {
this.favorites = new FavoritesApi(this.alfrescoApi);
this.trashCan = new TrashcanApi(this.alfrescoApi);
this.commentsApi = new CommentsApi(this.alfrescoApi);
this.queriesApi = new QueriesApi(this.alfrescoApi);
return this;
}

View File

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

View File

@@ -0,0 +1,75 @@
/*!
* 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 <http://www.gnu.org/licenses/>.
*/
import { FindQuery } from '@alfresco/js-api';
import { Utils } from '../utils';
import { ApiClientFactory } from './api-client-factory';
export class QueriesApi {
private apiService: ApiClientFactory;
constructor() {
this.apiService = new ApiClientFactory();
}
static async initialize(userName: string, password?: string): Promise<QueriesApi> {
const classObj = new QueriesApi();
await classObj.apiService.setUpAcaBackend(userName, password);
return classObj;
}
async waitForSites(searchTerm: string, data: { expect: number }): Promise<number> {
try {
const sites = async () => {
const totalItems = await this.findSitesTotalItems(searchTerm);
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
return Promise.resolve(totalItems);
}
};
return await Utils.retryCall(sites);
} catch (error) {
console.error(`QueriesApi waitForSites : catch : `);
console.error(`\tExpected: ${data.expect} items, but found ${error}`);
return null;
}
}
private async findSitesTotalItems(searchTerm: string): Promise<number> {
try {
const opts: FindQuery = {
term: searchTerm,
fields: ['title']
};
const sites = await this.apiService.queries.findSites(searchTerm, opts);
return sites.list.pagination.totalItems;
} catch (error) {
console.error(`QueriesApi findSitesTotalItems : catch :`, error);
return null;
}
}
}

View File

@@ -158,4 +158,13 @@ export class SitesApi {
console.error(`SitesApi deleteSiteMember : catch : `, error);
}
}
async getSite(siteId: string): Promise<SiteEntry> {
try {
return await this.apiService.sites.getSite(siteId);
} catch (error) {
console.error(`SitesApi getSite : catch : `, error);
return null;
}
}
}