@sap_oss/wdio-qmate-service
Version:
[](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[](http
51 lines (50 loc) • 2.42 kB
TypeScript
/**
* @class function
* @memberof util
*/
export declare class FunctionModule {
private vlf;
private ErrorHandler;
private maxCurrentRetries;
/**
* @function retry
* @memberOf util.function
* @description Retries the passed function n times with a specific interval until it executed successfully.
* @param {Function} fct - The function to retry.
* @param {Array} args - An array of the arguments passed to the function.
* @param {Integer} [retries=3] - The number of retries. Can be set in config for all functions under "params" - "stepsRetries".
* @param {Integer} [interval=5000] - The interval of the retries (ms). Can be set in config for all functions under "params" - "stepRetriesIntervals".
* @param {Object} [scope=null] - The function scope. Defaults is the global object.
* @example await util.function.retry(ui5.userInteraction.fill, [selector, value], 4, 10000);
* @example await util.function.retry(async () => {
* await ui5.userInteraction.fill(selector, "ABC");
* }, [], 2, 30000);
*/
retry(fct: Function, args: Array<any>, retries: number, interval: number, scope?: any): Promise<void>;
/**
* @function executeOptional
* @memberOf util.function
* @description Executes the given function optionally. If it fails, a promise will be returned anyway.
* @param {Function} fct - The function to execute.
* @param {Array} args - An array of the arguments passed to the function.
* @example await util.function.executeOptional(ui5.userInteraction.fill, [selector, value]);
* @example await util.function.executeOptional(async () => {
* await ui5.userInteraction.fill(selector, "ABC");
* }, []);
*/
executeOptional(fct: any, args?: Array<any>): Promise<void>;
/**
* @function mapWdioErrorToQmateErrorMessage
* @memberOf util.function
* @private
* @description Maps Wdio Error to Qmate Error Message
* @param {Error} wdioError - The wdio error
* @param {string} action - An action performed upon the element ("click", "fill")
* @example await util.function.mapWdioErrorToQmateErrorMessage(error, "click");
*/
mapWdioErrorToQmateErrorMessage(wdioError: Error, action: string): Promise<string>;
private _getRetryProperties;
private _retry;
}
declare const _default: FunctionModule;
export default _default;