From fff574c216e82d9664c5e2912efb43d79dbd0c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iulia=20Burc=C4=83?= Date: Wed, 4 Nov 2020 20:15:11 +0200 Subject: [PATCH] [ACA-4057] Edit getProcessInstanceByName method to search the process instance directly by its name (#6303) * Add size value to getProcessInstanceByName * edit getProcessInstanceByName method to search the process instance directly by its name * add more options for filtering the list --- .../src/lib/process-services/actions/process.util.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/testing/src/lib/process-services/actions/process.util.ts b/lib/testing/src/lib/process-services/actions/process.util.ts index 9d08867310..ab5b6f265c 100644 --- a/lib/testing/src/lib/process-services/actions/process.util.ts +++ b/lib/testing/src/lib/process-services/actions/process.util.ts @@ -92,15 +92,11 @@ export class ProcessUtil { } } - async getProcessInstanceByName(processInstanceName: string): Promise { + async getProcessInstanceByName(processInstanceName: string, processInstanceStatus?: string, maxNumberOfResults?: number): Promise { try { - const processInstanceList = await this.api.apiService.activiti.processApi.getProcessInstances({state: 'all'}); - const chosenProcessInstance = processInstanceList.data.find( (processInstanace) => { - return processInstanace.name === processInstanceName; - }); - return chosenProcessInstance; + return await this.api.apiService.activiti.processApi.filterProcessInstances({filter: {name: processInstanceName, state: processInstanceStatus}, size: maxNumberOfResults}); } catch (error) { - Logger.error('Get Process Instance by Name - Service error, Response: ', JSON.parse(JSON.stringify(error))); + Logger.error('List process instances using a filter - Service error, Response: ', JSON.parse(JSON.stringify(error))); } }