mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
e2e cleanup (#2951)
* reduce the code * reduce code * reduce code * reduce code * cleanup tests * more readable code * cleanup code * fix code * even more cleanup * remove some deprecated apis * code fixes * cleanup files * more files switching to user actions
This commit is contained in:
@@ -64,7 +64,7 @@ export class SharedLinksApi extends RepoApi {
|
||||
return sharedLinks;
|
||||
}
|
||||
|
||||
async getSharedIdOfNode(fileId: string): Promise<string> {
|
||||
private async getSharedIdOfNode(fileId: string): Promise<string> {
|
||||
try {
|
||||
const sharedLinksEntries = (await this.getSharedLinks())?.list.entries;
|
||||
const found = sharedLinksEntries.find((sharedLink) => sharedLink.entry.nodeId === fileId);
|
||||
@@ -84,7 +84,7 @@ export class SharedLinksApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async getSharedLinks(maxItems: number = 250): Promise<SharedLinkPaging | null> {
|
||||
private async getSharedLinks(maxItems: number = 250): Promise<SharedLinkPaging | null> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
const opts = {
|
||||
@@ -97,38 +97,6 @@ export class SharedLinksApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async getSharedLinksTotalItems(): Promise<number> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
const opts = {
|
||||
maxItems: 250
|
||||
};
|
||||
const sharedList = await this.sharedlinksApi.listSharedLinks(opts);
|
||||
return sharedList.list.entries.length;
|
||||
} catch (error) {
|
||||
this.handleError(`SharedLinksApi getSharedLinksTotalItems : catch : `, error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
async waitForApi(data: { expect: number }): Promise<any> {
|
||||
try {
|
||||
const sharedFiles = async () => {
|
||||
const totalItems = await this.getSharedLinksTotalItems();
|
||||
if (totalItems !== data.expect) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(sharedFiles);
|
||||
} catch (error) {
|
||||
Logger.error(`SharedLinksApi waitForApi : catch : `);
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
async waitForFilesToBeShared(filesIds: string[]): Promise<any> {
|
||||
try {
|
||||
const sharedFile = async () => {
|
||||
|
Reference in New Issue
Block a user