mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4241]Added tests for process header cloud component (#4463)
* Added tests for process header cloud component * Move the process-header-cloud-component page to testing folder * Changed the test rail ids * Fix lint issues.
This commit is contained in:
committed by
Eugenio Romano
parent
f9e39aaebd
commit
e415bd8cd5
@@ -28,13 +28,14 @@ export class ProcessInstances {
|
|||||||
await this.api.login(username, password);
|
await this.api.login(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
async createProcessInstance(processDefKey, appName) {
|
async createProcessInstance(processDefKey, appName, options?) {
|
||||||
const path = '/' + appName + '-rb/v1/process-instances';
|
const path = '/' + appName + '-rb/v1/process-instances';
|
||||||
const method = 'POST';
|
const method = 'POST';
|
||||||
|
|
||||||
const queryParams = {}, postBody = {
|
const queryParams = {}, postBody = {
|
||||||
'processDefinitionKey': processDefKey,
|
'processDefinitionKey': processDefKey,
|
||||||
'payloadType': 'StartProcessPayload'
|
'payloadType': 'StartProcessPayload',
|
||||||
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
|
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
|
||||||
|
@@ -38,4 +38,14 @@ export class Query {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getProcessInstanceSubProcesses(processInstanceId, appName) {
|
||||||
|
const path = '/' + appName + '-query/v1/process-instances/' + processInstanceId + '/subprocesses';
|
||||||
|
const method = 'GET';
|
||||||
|
|
||||||
|
const queryParams = {};
|
||||||
|
|
||||||
|
const data = await this.api.performBpmOperation(path, method, queryParams, {});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,14 @@ export class ProcessListCloudComponent {
|
|||||||
return this.dataTable;
|
return this.dataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectRow(processName) {
|
||||||
|
return this.dataTable.selectRow('Name', processName);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectRowById(processId) {
|
||||||
|
return this.dataTable.selectRow('Id', processId);
|
||||||
|
}
|
||||||
|
|
||||||
checkContentIsDisplayedByName(processName) {
|
checkContentIsDisplayedByName(processName) {
|
||||||
return this.dataTable.checkContentIsDisplayed('Name', processName);
|
return this.dataTable.checkContentIsDisplayed('Name', processName);
|
||||||
}
|
}
|
||||||
|
139
e2e/process-services-cloud/process-header-cloud.e2e.ts
Normal file
139
e2e/process-services-cloud/process-header-cloud.e2e.ts
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import TestConfig = require('../test.config');
|
||||||
|
import CONSTANTS = require('../util/constants');
|
||||||
|
import { Util } from '../util/util';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
import { ProcessDefinitions } from '../actions/APS-cloud/process-definitions';
|
||||||
|
import { ProcessInstances } from '../actions/APS-cloud/process-instances';
|
||||||
|
import { Query } from '../actions/APS-cloud/query';
|
||||||
|
|
||||||
|
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
|
||||||
|
import { LoginSSOPage } from '@alfresco/adf-testing';
|
||||||
|
import { SettingsPage } from '../pages/adf/settingsPage';
|
||||||
|
import { AppListCloudPage } from '@alfresco/adf-testing';
|
||||||
|
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
|
||||||
|
import { ProcessHeaderCloudPage } from '@alfresco/adf-testing';
|
||||||
|
import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage';
|
||||||
|
import { browser } from 'protractor';
|
||||||
|
|
||||||
|
describe('Process Header cloud component', () => {
|
||||||
|
|
||||||
|
describe('Process Header cloud component', () => {
|
||||||
|
|
||||||
|
const user = TestConfig.adf.adminEmail, password = TestConfig.adf.adminPassword;
|
||||||
|
const simpleApp = 'simple-app', subProcessApp = 'projectsubprocess';
|
||||||
|
let formatDate = 'DD-MM-YYYY';
|
||||||
|
|
||||||
|
let processHeaderCloudPage = new ProcessHeaderCloudPage();
|
||||||
|
|
||||||
|
const settingsPage = new SettingsPage();
|
||||||
|
const loginSSOPage = new LoginSSOPage();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
const appListCloudComponent = new AppListCloudPage();
|
||||||
|
const tasksCloudDemoPage = new TasksCloudDemoPage();
|
||||||
|
let processCloudDemoPage = new ProcessCloudDemoPage();
|
||||||
|
|
||||||
|
const processDefinitionService: ProcessDefinitions = new ProcessDefinitions();
|
||||||
|
const processInstancesService: ProcessInstances = new ProcessInstances();
|
||||||
|
const queryService: Query = new Query();
|
||||||
|
|
||||||
|
let silentLogin;
|
||||||
|
let runningProcess, runningCreatedDate, parentCompleteProcess, childCompleteProcess, completedCreatedDate;
|
||||||
|
|
||||||
|
beforeAll(async (done) => {
|
||||||
|
silentLogin = false;
|
||||||
|
settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin);
|
||||||
|
loginSSOPage.clickOnSSOButton();
|
||||||
|
browser.ignoreSynchronization = true;
|
||||||
|
loginSSOPage.loginSSOIdentityService(user, password);
|
||||||
|
|
||||||
|
await processDefinitionService.init(user, password);
|
||||||
|
let processDefinition = await processDefinitionService.getProcessDefinitions(simpleApp);
|
||||||
|
let childProcessDefinition = await processDefinitionService.getProcessDefinitions(subProcessApp);
|
||||||
|
|
||||||
|
await processInstancesService.init(user, password);
|
||||||
|
runningProcess = await processInstancesService.createProcessInstance(processDefinition.list.entries[0].entry.key,
|
||||||
|
simpleApp, {name: Util.generateRandomString(), businessKey: 'test'});
|
||||||
|
runningCreatedDate = moment(runningProcess.entry.startDate).format(formatDate);
|
||||||
|
parentCompleteProcess = await processInstancesService.createProcessInstance(childProcessDefinition.list.entries[0].entry.key,
|
||||||
|
subProcessApp, {name: 'cris'});
|
||||||
|
|
||||||
|
let parentProcessInstance = await queryService.getProcessInstanceSubProcesses(parentCompleteProcess.entry.id,
|
||||||
|
subProcessApp);
|
||||||
|
childCompleteProcess = parentProcessInstance.list.entries[0];
|
||||||
|
completedCreatedDate = moment(childCompleteProcess.entry.startDate).format(formatDate);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async (done) => {
|
||||||
|
await navigationBarPage.navigateToProcessServicesCloudPage();
|
||||||
|
appListCloudComponent.checkApsContainer();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C305010] Should display process details for running process', async () => {
|
||||||
|
await appListCloudComponent.goToApp(simpleApp);
|
||||||
|
tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
|
||||||
|
processCloudDemoPage.clickOnProcessFilters();
|
||||||
|
|
||||||
|
processCloudDemoPage.runningProcessesFilter().checkProcessFilterIsDisplayed();
|
||||||
|
processCloudDemoPage.runningProcessesFilter().clickProcessFilter();
|
||||||
|
expect(processCloudDemoPage.getActiveFilterName()).toBe('Running Processes');
|
||||||
|
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(runningProcess.entry.name);
|
||||||
|
|
||||||
|
processCloudDemoPage.processListCloudComponent().checkProcessListIsLoaded();
|
||||||
|
processCloudDemoPage.processListCloudComponent().selectRow(runningProcess.entry.name);
|
||||||
|
expect(processHeaderCloudPage.getId()).toEqual(runningProcess.entry.id);
|
||||||
|
expect(processHeaderCloudPage.getName()).toEqual(runningProcess.entry.name);
|
||||||
|
expect(processHeaderCloudPage.getStatus()).toEqual(runningProcess.entry.status);
|
||||||
|
expect(processHeaderCloudPage.getInitiator()).toEqual(runningProcess.entry.initiator);
|
||||||
|
expect(processHeaderCloudPage.getStartDate()).toEqual(runningCreatedDate);
|
||||||
|
expect(processHeaderCloudPage.getParentId()).toEqual(CONSTANTS.PROCESS_DETAILS.NO_PARENT);
|
||||||
|
expect(processHeaderCloudPage.getBusinessKey()).toEqual(runningProcess.entry.businessKey);
|
||||||
|
expect(processHeaderCloudPage.getLastModified()).toEqual(runningCreatedDate);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C305008] Should display process details for completed process', async () => {
|
||||||
|
await appListCloudComponent.goToApp(subProcessApp);
|
||||||
|
tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
|
||||||
|
processCloudDemoPage.clickOnProcessFilters();
|
||||||
|
|
||||||
|
processCloudDemoPage.completedProcessesFilter().checkProcessFilterIsDisplayed();
|
||||||
|
processCloudDemoPage.completedProcessesFilter().clickProcessFilter();
|
||||||
|
expect(processCloudDemoPage.getActiveFilterName()).toBe('Completed Processes');
|
||||||
|
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(childCompleteProcess.entry.name);
|
||||||
|
|
||||||
|
processCloudDemoPage.processListCloudComponent().checkProcessListIsLoaded();
|
||||||
|
processCloudDemoPage.processListCloudComponent().selectRowById(childCompleteProcess.entry.id);
|
||||||
|
|
||||||
|
expect(processHeaderCloudPage.getId()).toEqual(childCompleteProcess.entry.id);
|
||||||
|
expect(processHeaderCloudPage.getName()).toEqual(childCompleteProcess.entry.name);
|
||||||
|
expect(processHeaderCloudPage.getStatus()).toEqual(childCompleteProcess.entry.status);
|
||||||
|
expect(processHeaderCloudPage.getInitiator()).toEqual(childCompleteProcess.entry.initiator);
|
||||||
|
expect(processHeaderCloudPage.getStartDate()).toEqual(completedCreatedDate);
|
||||||
|
expect(processHeaderCloudPage.getParentId()).toEqual(childCompleteProcess.entry.parentId);
|
||||||
|
expect(processHeaderCloudPage.getBusinessKey()).toEqual(CONSTANTS.PROCESS_DETAILS.NO_BUSINESS_KEY);
|
||||||
|
expect(processHeaderCloudPage.getLastModified()).toEqual(completedCreatedDate);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@@ -127,6 +127,13 @@ exports.PROCESS_DESCRIPTION = "No description";
|
|||||||
|
|
||||||
exports.PROCESS_DATE_FORMAT = "mmm dd yyyy";
|
exports.PROCESS_DATE_FORMAT = "mmm dd yyyy";
|
||||||
|
|
||||||
|
exports.PROCESS_DETAILS = {
|
||||||
|
NO_PARENT: "None",
|
||||||
|
NO_DATE: "No date",
|
||||||
|
NO_BUSINESS_KEY: 'None',
|
||||||
|
NO_DESCRIPTION: 'No description'
|
||||||
|
};
|
||||||
|
|
||||||
exports.PROCESS_STATUS = {
|
exports.PROCESS_STATUS = {
|
||||||
RUNNING: 'Running',
|
RUNNING: 'Running',
|
||||||
COMPLETED: 'Completed'
|
COMPLETED: 'Completed'
|
||||||
|
@@ -0,0 +1,72 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { element, by } from 'protractor';
|
||||||
|
import { BrowserVisibility } from '../../core/browser-visibility';
|
||||||
|
|
||||||
|
export class ProcessHeaderCloudPage {
|
||||||
|
|
||||||
|
idField = element.all(by.css('span[data-automation-id*="id"] span')).first();
|
||||||
|
nameField = element.all(by.css('span[data-automation-id*="name"] span')).first();
|
||||||
|
statusField = element(by.css('span[data-automation-id*="status"] span'));
|
||||||
|
initiatorField = element(by.css('span[data-automation-id*="initiator"] span'));
|
||||||
|
startDateField = element(by.css('span[data-automation-id*="startDate"] span'));
|
||||||
|
lastModifiedField = element(by.css('span[data-automation-id*="lastModified"] span'));
|
||||||
|
parentIdField = element(by.css('span[data-automation-id*="parentId"] span'));
|
||||||
|
businessKeyField = element.all(by.css('span[data-automation-id*="businessKey"] span')).first();
|
||||||
|
|
||||||
|
getId() {
|
||||||
|
BrowserVisibility.waitUntilElementIsVisible(this.idField);
|
||||||
|
return this.idField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getName() {
|
||||||
|
BrowserVisibility.waitUntilElementIsVisible(this.nameField);
|
||||||
|
return this.nameField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getStatus() {
|
||||||
|
BrowserVisibility.waitUntilElementIsVisible(this.statusField);
|
||||||
|
return this.statusField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getInitiator() {
|
||||||
|
BrowserVisibility.waitUntilElementIsVisible(this.initiatorField);
|
||||||
|
return this.initiatorField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getStartDate() {
|
||||||
|
BrowserVisibility.waitUntilElementIsVisible(this.startDateField);
|
||||||
|
return this.startDateField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getLastModified() {
|
||||||
|
BrowserVisibility.waitUntilElementIsVisible(this.lastModifiedField);
|
||||||
|
return this.lastModifiedField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getParentId() {
|
||||||
|
BrowserVisibility.waitUntilElementIsVisible(this.parentIdField);
|
||||||
|
return this.parentIdField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getBusinessKey() {
|
||||||
|
BrowserVisibility.waitUntilElementIsVisible(this.businessKeyField);
|
||||||
|
return this.businessKeyField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -5,3 +5,4 @@
|
|||||||
export * from './login-sso.page';
|
export * from './login-sso.page';
|
||||||
export * from './start-tasks-cloud-component.page';
|
export * from './start-tasks-cloud-component.page';
|
||||||
export * from './task-header-cloud-component.page';
|
export * from './task-header-cloud-component.page';
|
||||||
|
export * from './process-header-cloud-component.page';
|
||||||
|
Reference in New Issue
Block a user