mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-1762] async await pagination (#687)
* use async / await in pagination tests * add catch in waitForApi
This commit is contained in:
committed by
Denys Vuika
parent
ac99f5397d
commit
4f4a69338f
@@ -90,15 +90,20 @@ export class FavoritesApi extends RepoApi {
|
||||
}
|
||||
|
||||
async waitForApi(data) {
|
||||
try {
|
||||
const favoriteFiles = async () => {
|
||||
const totalItems = (await this.getFavorites()).list.pagination.totalItems;
|
||||
if ( totalItems < data.expect) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
const totalItems = (await this.getFavorites()).list.pagination.totalItems;
|
||||
if ( totalItems !== data.expect) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(favoriteFiles);
|
||||
} catch (error) {
|
||||
console.log('-----> catch favorites: ', error);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -51,15 +51,19 @@ export class SearchApi extends RepoApi {
|
||||
}
|
||||
|
||||
async waitForApi(username, data) {
|
||||
try {
|
||||
const recentFiles = async () => {
|
||||
const totalItems = (await this.queryRecentFiles(username)).list.pagination.totalItems;
|
||||
if ( totalItems < data.expect) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
const totalItems = (await this.queryRecentFiles(username)).list.pagination.totalItems;
|
||||
if ( totalItems !== data.expect) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(recentFiles);
|
||||
return await Utils.retryCall(recentFiles);
|
||||
} catch (error) {
|
||||
console.log('-----> catch search: ', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -62,15 +62,19 @@ export class SharedLinksApi extends RepoApi {
|
||||
}
|
||||
|
||||
async waitForApi(data) {
|
||||
try {
|
||||
const sharedFiles = async () => {
|
||||
const totalItems = (await this.getSharedLinks()).list.pagination.totalItems;
|
||||
if ( totalItems < data.expect ) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
const totalItems = (await this.getSharedLinks()).list.pagination.totalItems;
|
||||
if ( totalItems !== data.expect ) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(sharedFiles);
|
||||
return await Utils.retryCall(sharedFiles);
|
||||
} catch (error) {
|
||||
console.log('-----> catch shared: ', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -105,9 +105,10 @@ export class SitesApi extends RepoApi {
|
||||
}
|
||||
|
||||
async waitForApi(data) {
|
||||
const sites = async () => {
|
||||
try {
|
||||
const sites = async () => {
|
||||
const totalItems = (await this.getSites()).list.pagination.totalItems;
|
||||
if ( totalItems < data.expect ) {
|
||||
if ( totalItems !== data.expect ) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
@@ -115,5 +116,8 @@ export class SitesApi extends RepoApi {
|
||||
};
|
||||
|
||||
return await Utils.retryCall(sites);
|
||||
} catch (error) {
|
||||
console.log('-----> catch sites: ', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -60,9 +60,10 @@ export class TrashcanApi extends RepoApi {
|
||||
}
|
||||
|
||||
async waitForApi(data) {
|
||||
const deletedFiles = async () => {
|
||||
try {
|
||||
const deletedFiles = async () => {
|
||||
const totalItems = (await this.getDeletedNodes()).list.pagination.totalItems;
|
||||
if ( totalItems < data.expect) {
|
||||
if ( totalItems !== data.expect) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
@@ -70,5 +71,8 @@ export class TrashcanApi extends RepoApi {
|
||||
};
|
||||
|
||||
return await Utils.retryCall(deletedFiles);
|
||||
} catch (error) {
|
||||
console.log('-----> catch trash: ', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user