[ACA-4507] Fix folder tests (#2227)

* [ACA-4507] Fix folder tests

* * wait for recent files

* * increase timeouts

* * fix comments

* * search untill found

* Revert: * wait for recent files (7be52b12)

* * update timeout

* * upload fixed and improve recent files
This commit is contained in:
Dharan
2021-07-08 21:55:47 +05:30
committed by GitHub
parent f00cd0345d
commit 35289a95f2
6 changed files with 18 additions and 18 deletions

View File

@@ -24,7 +24,7 @@
*/
import { RepoApi } from '../repo-api';
import { Logger } from '@alfresco/adf-testing';
import { ApiUtil, Logger } from '@alfresco/adf-testing';
import { Utils } from '../../../../utilities/utils';
import { SearchApi as AdfSearchApi } from '@alfresco/js-api';
@@ -130,17 +130,18 @@ export class SearchApi extends RepoApi {
}
async waitForNodes(searchTerm: string, data: { expect: number }) {
try {
const nodes = async () => {
const totalItems = await this.getSearchByTermTotalItems(searchTerm);
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
return Promise.resolve(totalItems);
}
};
const predicate = (totalItems: number) => totalItems === data.expect;
return await Utils.retryCall(nodes);
const apiCall = async () => {
try {
return await this.getSearchByTermTotalItems(searchTerm);
} catch (error) {
return 0;
}
};
try {
await ApiUtil.waitForApi(apiCall, predicate, 30, 2500);
} catch (error) {
Logger.error(`SearchApi waitForNodes : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);