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:
Denys Vuika
2023-02-01 23:22:37 +00:00
committed by GitHub
parent a325deaf1a
commit 567882e864
42 changed files with 628 additions and 926 deletions

View File

@@ -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 () => {