[ACA-4288] Fix API errors from logs (#2006)

* Add API login in afterAll - part 1

* viewer,infoDrawer,extensions - afterAll API login

* deleteActions - afterAll API login

* Improve before and after methods

* add Promise type to methods - part1

* remove unneeded done() method and add try-catch

* delete wrong import

* Login through API

* small change over log errors

* small improvement over the logs
This commit is contained in:
Iulia Burcă
2021-04-16 17:57:50 +03:00
committed by GitHub
parent 9427c0fc7d
commit d17744bfd9
49 changed files with 844 additions and 719 deletions

View File

@@ -26,7 +26,7 @@
import { RepoApi } from '../repo-api';
import { Logger } from '@alfresco/adf-testing';
import { Utils } from '../../../../utilities/utils';
import { SharedlinksApi as AdfSharedlinksApi, SharedLinkEntry } from '@alfresco/js-api';
import { SharedlinksApi as AdfSharedlinksApi, SharedLinkEntry, SharedLinkPaging } from '@alfresco/js-api';
export class SharedLinksApi extends RepoApi {
sharedlinksApi = new AdfSharedlinksApi(this.alfrescoJsApi);
@@ -75,7 +75,7 @@ export class SharedLinksApi extends RepoApi {
}
}
async unshareFileById(fileId: string) {
async unshareFileById(fileId: string): Promise<any> {
try {
const sharedId = await this.getSharedIdOfNode(fileId);
return await this.sharedlinksApi.deleteSharedLink(sharedId);
@@ -84,7 +84,7 @@ export class SharedLinksApi extends RepoApi {
}
}
async getSharedLinks(maxItems: number = 250) {
async getSharedLinks(maxItems: number = 250): Promise<SharedLinkPaging | null> {
try {
await this.apiAuth();
const opts = {
@@ -111,7 +111,7 @@ export class SharedLinksApi extends RepoApi {
}
}
async waitForApi(data: { expect: number }) {
async waitForApi(data: { expect: number }): Promise<any> {
try {
const sharedFiles = async () => {
const totalItems = await this.getSharedLinksTotalItems();
@@ -129,7 +129,7 @@ export class SharedLinksApi extends RepoApi {
}
}
async waitForFilesToBeShared(filesIds: string[]) {
async waitForFilesToBeShared(filesIds: string[]): Promise<any> {
try {
const sharedFile = async () => {
const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId);
@@ -143,12 +143,12 @@ export class SharedLinksApi extends RepoApi {
return await Utils.retryCall(sharedFile);
} catch (error) {
Logger.error(`SharedLinksApi waitForFilesToBeShared : catch : `);
Logger.error(`SharedLinksApi waitForFilesToBeShared : catch : ${error}`);
Logger.error(`\tWait timeout reached waiting for files to be shared`);
}
}
async waitForFilesToNotBeShared(filesIds: string[]) {
async waitForFilesToNotBeShared(filesIds: string[]): Promise<any> {
try {
const sharedFile = async () => {
const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId);
@@ -166,7 +166,7 @@ export class SharedLinksApi extends RepoApi {
return await Utils.retryCall(sharedFile);
} catch (error) {
Logger.error(`SharedLinksApi waitForFilesToNotBeShared : catch : `);
Logger.error(`SharedLinksApi waitForFilesToNotBeShared : catch : ${error}`);
Logger.error(`\tWait timeout reached waiting for files to no longer be shared`);
}
}