[ACA-3040]Modify some methods of start-process PO (#5650)

* Modify some methods of start-process PO

* Fix tests

* Fix test
This commit is contained in:
Cristina Jalba
2020-04-29 11:18:21 +03:00
committed by GitHub
parent c0664341a0
commit 7c0096eaa6
8 changed files with 56 additions and 43 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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] });

View File

@@ -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);
});

View File

@@ -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();

View File

@@ -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;
}
}

View File

@@ -45,7 +45,7 @@ export class ProcessUtil {
async startProcessOfApp(appName: string, processName?: string): Promise<any> {
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) {

View File

@@ -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() {