From 7c0096eaa64594c550395022a61450b129ef649e Mon Sep 17 00:00:00 2001 From: Cristina Jalba Date: Wed, 29 Apr 2020 11:18:21 +0300 Subject: [PATCH] [ACA-3040]Modify some methods of start-process PO (#5650) * Modify some methods of start-process PO * Fix tests * Fix test --- .../comment-component-processes.e2e.ts | 2 +- .../custom-process-filters-sorting.e2e.ts | 63 ++++++++++--------- .../custom-tasks-filters.e2e.ts | 8 +-- ...process-attachment-list-action-menu.e2e.ts | 6 +- .../start-process-component.e2e.ts | 2 +- .../lib/core/actions/APS/models.service.ts | 11 ++++ .../src/lib/core/actions/APS/process.util.ts | 2 +- .../pages/start-process.page.ts | 5 +- 8 files changed, 56 insertions(+), 43 deletions(-) diff --git a/e2e/process-services/comment-component-processes.e2e.ts b/e2e/process-services/comment-component-processes.e2e.ts index 62f7b2e9a8..45b2c209e3 100644 --- a/e2e/process-services/comment-component-processes.e2e.ts +++ b/e2e/process-services/comment-component-processes.e2e.ts @@ -54,7 +54,7 @@ describe('Comment component for Processes', () => { const importedApp = await applicationsService.importPublishDeployApp(app.file_path); appId = importedApp.id; - const processWithComment = await new ProcessUtil(this.alfrescoJsApi).startProcessOfApp('Task App', processName); + const processWithComment = await new ProcessUtil(this.alfrescoJsApi).startProcessOfApp(importedApp.name, processName); processInstanceId = processWithComment.id; await loginPage.loginToProcessServicesUsingUserModel(user); diff --git a/e2e/process-services/custom-process-filters-sorting.e2e.ts b/e2e/process-services/custom-process-filters-sorting.e2e.ts index fc178a7129..29dba94170 100644 --- a/e2e/process-services/custom-process-filters-sorting.e2e.ts +++ b/e2e/process-services/custom-process-filters-sorting.e2e.ts @@ -33,6 +33,7 @@ describe('Sorting for process filters', () => { const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM; let tenantId, appId, user, processesQuery; + let importedApp; const processFilter = { running_old_first: 'Running - Oldest first', @@ -64,7 +65,7 @@ describe('Sorting for process filters', () => { await this.alfrescoJsApi.login(user.email, user.password); - const importedApp = await applicationsService.importPublishDeployApp(app.file_path); + importedApp = await applicationsService.importPublishDeployApp(app.file_path); appId = importedApp.id; await loginPage.loginToProcessServicesUsingUserModel(user); @@ -84,9 +85,9 @@ describe('Sorting for process filters', () => { 'filter': { 'sort': 'created-asc', 'name': '', 'state': 'running' } }); const processUtil = new ProcessUtil(this.alfrescoJsApi); - const firstProc = await processUtil.startProcessOfApp('Task App'); - const secondProc = await processUtil.startProcessOfApp('Task App'); - const thirdProc = await processUtil.startProcessOfApp('Task App'); + const firstProc = await processUtil.startProcessOfApp(importedApp.name); + const secondProc = await processUtil.startProcessOfApp(importedApp.name); + const thirdProc = await processUtil.startProcessOfApp(importedApp.name); await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickProcessButton(); @@ -107,9 +108,9 @@ describe('Sorting for process filters', () => { }); const processUtil = new ProcessUtil(this.alfrescoJsApi); - const firstProc = await processUtil.startProcessOfApp('Task App'); - const secondProc = await processUtil.startProcessOfApp('Task App'); - const thirdProc = await processUtil.startProcessOfApp('Task App'); + const firstProc = await processUtil.startProcessOfApp(importedApp.name); + const secondProc = await processUtil.startProcessOfApp(importedApp.name); + const thirdProc = await processUtil.startProcessOfApp(importedApp.name); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(firstProc.id); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(secondProc.id); @@ -136,13 +137,13 @@ describe('Sorting for process filters', () => { }); const processUtil = new ProcessUtil(this.alfrescoJsApi); - const firstProc = await processUtil.startProcessOfApp('Task App'); - const secondProc = await processUtil.startProcessOfApp('Task App'); - const thirdProc = await processUtil.startProcessOfApp('Task App'); + const firstProc = await processUtil.startProcessOfApp(importedApp.name); + const secondProc = await processUtil.startProcessOfApp(importedApp.name); + const thirdProc = await processUtil.startProcessOfApp(importedApp.name); - const deleteFirstProc = await processUtil.startProcessOfApp('Task App'); - const deleteSecondProc = await processUtil.startProcessOfApp('Task App'); - const deleteThirdProc = await processUtil.startProcessOfApp('Task App'); + const deleteFirstProc = await processUtil.startProcessOfApp(importedApp.name); + const deleteSecondProc = await processUtil.startProcessOfApp(importedApp.name); + const deleteThirdProc = await processUtil.startProcessOfApp(importedApp.name); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(deleteFirstProc.id); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(deleteSecondProc.id); @@ -172,9 +173,9 @@ describe('Sorting for process filters', () => { }); const processUtil = new ProcessUtil(this.alfrescoJsApi); - const firstProc = await processUtil.startProcessOfApp('Task App'); - const secondProc = await processUtil.startProcessOfApp('Task App'); - const thirdProc = await processUtil.startProcessOfApp('Task App'); + const firstProc = await processUtil.startProcessOfApp(importedApp.name); + const secondProc = await processUtil.startProcessOfApp(importedApp.name); + const thirdProc = await processUtil.startProcessOfApp(importedApp.name); await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickProcessButton(); @@ -197,9 +198,9 @@ describe('Sorting for process filters', () => { }); const processUtil = new ProcessUtil(this.alfrescoJsApi); - const firstProc = await processUtil.startProcessOfApp('Task App'); - const secondProc = await processUtil.startProcessOfApp('Task App'); - const thirdProc = await processUtil.startProcessOfApp('Task App'); + const firstProc = await processUtil.startProcessOfApp(importedApp.name); + const secondProc = await processUtil.startProcessOfApp(importedApp.name); + const thirdProc = await processUtil.startProcessOfApp(importedApp.name); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(firstProc.id); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(secondProc.id); @@ -225,13 +226,13 @@ describe('Sorting for process filters', () => { }); const processUtil = new ProcessUtil(this.alfrescoJsApi); - const firstProc = await processUtil.startProcessOfApp('Task App'); - const secondProc = await processUtil.startProcessOfApp('Task App'); - const thirdProc = await processUtil.startProcessOfApp('Task App'); + const firstProc = await processUtil.startProcessOfApp(importedApp.name); + const secondProc = await processUtil.startProcessOfApp(importedApp.name); + const thirdProc = await processUtil.startProcessOfApp(importedApp.name); - const deleteFirstProc = await processUtil.startProcessOfApp('Task App'); - const deleteSecondProc = await processUtil.startProcessOfApp('Task App'); - const deleteThirdProc = await processUtil.startProcessOfApp('Task App'); + const deleteFirstProc = await processUtil.startProcessOfApp(importedApp.name); + const deleteSecondProc = await processUtil.startProcessOfApp(importedApp.name); + const deleteThirdProc = await processUtil.startProcessOfApp(importedApp.name); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(deleteFirstProc.id); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(deleteSecondProc.id); @@ -261,9 +262,9 @@ describe('Sorting for process filters', () => { }); const processUtil = new ProcessUtil(this.alfrescoJsApi); - const firstProc = await processUtil.startProcessOfApp('Task App'); - const secondProc = await processUtil.startProcessOfApp('Task App'); - const thirdProc = await processUtil.startProcessOfApp('Task App'); + const firstProc = await processUtil.startProcessOfApp(importedApp.name); + const secondProc = await processUtil.startProcessOfApp(importedApp.name); + const thirdProc = await processUtil.startProcessOfApp(importedApp.name); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(secondProc.id); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(firstProc.id); @@ -290,9 +291,9 @@ describe('Sorting for process filters', () => { }); const processUtil = new ProcessUtil(this.alfrescoJsApi); - const firstProc = await processUtil.startProcessOfApp('Task App'); - const secondProc = await processUtil.startProcessOfApp('Task App'); - const thirdProc = await processUtil.startProcessOfApp('Task App'); + const firstProc = await processUtil.startProcessOfApp(importedApp.name); + const secondProc = await processUtil.startProcessOfApp(importedApp.name); + const thirdProc = await processUtil.startProcessOfApp(importedApp.name); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(secondProc.id); await this.alfrescoJsApi.activiti.processInstancesApi.deleteProcessInstance(firstProc.id); diff --git a/e2e/process-services/custom-tasks-filters.e2e.ts b/e2e/process-services/custom-tasks-filters.e2e.ts index 0638d4012f..ff16373a6d 100644 --- a/e2e/process-services/custom-tasks-filters.e2e.ts +++ b/e2e/process-services/custom-tasks-filters.e2e.ts @@ -36,7 +36,7 @@ describe('Start Task - Custom App', () => { const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM; let appRuntime, secondAppRuntime; const secondApp = browser.params.resources.Files.WIDGETS_SMOKE_TEST; - let appModel, secondAppModel; + let appModel; const completedTasks = []; const paginationTasksName = ['t01', 't02', 't03', 't04', 't05', 't06', 't07', 't08', 't09', 't10', 't11', 't12', 't13', 'taskOne', 'taskTwo', 'taskOne']; const completedTasksName = ['completed01', 'completed02', 'completed03']; @@ -89,15 +89,15 @@ describe('Start Task - Custom App', () => { appRuntime = await appsRuntime.getRuntimeAppByName(this.alfrescoJsApi, app.title); - secondAppModel = await applicationsService.importPublishDeployApp(secondApp.file_path); + await applicationsService.importPublishDeployApp(secondApp.file_path); secondAppRuntime = await appsRuntime.getRuntimeAppByName(this.alfrescoJsApi, secondApp.title); const processUtil = new ProcessUtil(this.alfrescoJsApi); processDefinitionId = await processUtil.startProcessOfApp(appModel.name); await processUtil.startProcessOfApp(appModel.name); - await processUtil.startProcessOfApp(secondAppModel.name); - await processUtil.startProcessOfApp(secondAppModel.name); + await processUtil.startProcessOfApp(appModel.name); + await processUtil.startProcessOfApp(appModel.name); for (let i = 1; i < paginationTasksName.length; i++) { await this.alfrescoJsApi.activiti.taskApi.createNewTask({ 'name': paginationTasksName[i] }); diff --git a/e2e/process-services/process-attachment-list-action-menu.e2e.ts b/e2e/process-services/process-attachment-list-action-menu.e2e.ts index cf2b6b7882..c520d8623f 100644 --- a/e2e/process-services/process-attachment-list-action-menu.e2e.ts +++ b/e2e/process-services/process-attachment-list-action-menu.e2e.ts @@ -73,9 +73,9 @@ describe('Attachment list action menu for processes', () => { const processUtil = new ProcessUtil(this.alfrescoJsApi); await processUtil.startProcessOfApp(importedApp.name, processName.completed); await processUtil.startProcessOfApp(importedApp.name, processName.active); - await processUtil.startProcessOfApp('Task App', processName.taskApp); - await processUtil.startProcessOfApp('Task App', processName.emptyList); - await processUtil.startProcessOfApp('Task App', processName.dragDrop); + await processUtil.startProcessOfApp(importedApp.name, processName.taskApp); + await processUtil.startProcessOfApp(importedApp.name, processName.emptyList); + await processUtil.startProcessOfApp(importedApp.name, processName.dragDrop); await loginPage.loginToProcessServicesUsingUserModel(user); }); diff --git a/e2e/process-services/start-process-component.e2e.ts b/e2e/process-services/start-process-component.e2e.ts index 7d896f8e21..414ce98e86 100644 --- a/e2e/process-services/start-process-component.e2e.ts +++ b/e2e/process-services/start-process-component.e2e.ts @@ -464,7 +464,7 @@ describe('Start Process Component', () => { await startProcessPage.enterProcessName('DateFormProcess'); await startProcessPage.formFields().checkWidgetIsVisible('testdate'); await widget.dateWidget().setDateInput('testdate', '15-7-2019'); - await startProcessPage.checkStartFormProcessButtonIsEnabled(); + await expect(await startProcessPage.isStartFormProcessButtonEnabled()).toEqual(true); await startProcessPage.clickFormStartProcessButton(); await processFiltersPage.clickRunningFilterButton(); diff --git a/lib/testing/src/lib/core/actions/APS/models.service.ts b/lib/testing/src/lib/core/actions/APS/models.service.ts index 1bc43f5e92..d6c139ac64 100644 --- a/lib/testing/src/lib/core/actions/APS/models.service.ts +++ b/lib/testing/src/lib/core/actions/APS/models.service.ts @@ -40,4 +40,15 @@ export class ModelsActions { Logger.error('Delete Model - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text); } } + + async getModels(opts: any) { + const options = opts || {}; + let models; + try { + models = await this.api.activiti.modelsApi.getModels(options); + } catch (error) { + Logger.error('Get Models - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text); + } + return models; + } } diff --git a/lib/testing/src/lib/core/actions/APS/process.util.ts b/lib/testing/src/lib/core/actions/APS/process.util.ts index ac1a9876da..25baf1fff5 100644 --- a/lib/testing/src/lib/core/actions/APS/process.util.ts +++ b/lib/testing/src/lib/core/actions/APS/process.util.ts @@ -45,7 +45,7 @@ export class ProcessUtil { async startProcessOfApp(appName: string, processName?: string): Promise { try { const appDefinition = await new ApplicationsUtil(this.api).getAppDefinitionByName(appName); - const processDefinitionList = await this.api.activiti.processApi.getProcessDefinitions({ deploymentId: appDefinition.deploymentId }); + const processDefinitionList = await this.api.activiti.processApi.getProcessDefinitions({ deploymentId: appDefinition[0].deploymentId }); const startProcessOptions: any = { processDefinitionId: processDefinitionList.data[0].id, name: processName ? processName : StringUtil.generateRandomString(5).toLowerCase() }; return this.api.activiti.processApi.startNewProcessInstance(startProcessOptions); } catch (error) { diff --git a/lib/testing/src/lib/process-services/pages/start-process.page.ts b/lib/testing/src/lib/process-services/pages/start-process.page.ts index 5424d927dd..c31d5502a5 100644 --- a/lib/testing/src/lib/process-services/pages/start-process.page.ts +++ b/lib/testing/src/lib/process-services/pages/start-process.page.ts @@ -104,8 +104,9 @@ export class StartProcessPage { await BrowserActions.click(this.formStartProcessButton); } - async checkStartFormProcessButtonIsEnabled() { - await expect(await this.formStartProcessButton.isEnabled()).toBe(true); + async isStartFormProcessButtonEnabled() { + await BrowserVisibility.waitUntilElementIsVisible(this.formStartProcessButton); + return this.formStartProcessButton.isEnabled(); } async checkStartProcessButtonIsEnabled() {