mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-641]Add tests for assignee not able to release process task (#5233)
* Add tests for assignee not able to release process task * Changed the assignee of assigneeprocess process definition from admin.adf to hruser * Changed the process used and changed random user to hruser
This commit is contained in:
committed by
Maurizio Vitale
parent
2cc7fe7efe
commit
46d976e318
@@ -26,7 +26,7 @@ import {
|
|||||||
ProcessInstancesService,
|
ProcessInstancesService,
|
||||||
TaskHeaderCloudPage,
|
TaskHeaderCloudPage,
|
||||||
TaskFormCloudComponent,
|
TaskFormCloudComponent,
|
||||||
Widget, IdentityService, GroupIdentityService, QueryService
|
Widget, QueryService
|
||||||
} from '@alfresco/adf-testing';
|
} from '@alfresco/adf-testing';
|
||||||
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
|
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
|
||||||
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
|
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
|
||||||
@@ -44,27 +44,15 @@ describe('Task form cloud component', () => {
|
|||||||
|
|
||||||
let processDefinitionService: ProcessDefinitionsService;
|
let processDefinitionService: ProcessDefinitionsService;
|
||||||
let processInstancesService: ProcessInstancesService;
|
let processInstancesService: ProcessInstancesService;
|
||||||
let identityService: IdentityService;
|
|
||||||
|
|
||||||
let completedTask, createdTask, assigneeTask, toBeCompletedTask, formValidationsTask, testUser, formTaskId;
|
let completedTask, createdTask, assigneeTask, toBeCompletedTask, formValidationsTask, formTaskId, assigneeTaskId, assigneeReleaseTask;
|
||||||
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
|
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
|
||||||
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
|
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
|
||||||
const completedTaskName = StringUtil.generateRandomString(), assignedTaskName = StringUtil.generateRandomString();
|
const completedTaskName = StringUtil.generateRandomString(), assignedTaskName = StringUtil.generateRandomString();
|
||||||
const apiService = new ApiService(browser.params.config.oauth2.clientId, browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers);
|
|
||||||
const apiServiceHrUser = new ApiService(browser.params.config.oauth2.clientId, browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers);
|
const apiServiceHrUser = new ApiService(browser.params.config.oauth2.clientId, browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers);
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
|
await apiServiceHrUser.login(browser.params.testConfig.hrUser.email, browser.params.testConfig.hrUser.password);
|
||||||
|
|
||||||
identityService = new IdentityService(apiService);
|
|
||||||
const groupIdentityService = new GroupIdentityService(apiService);
|
|
||||||
|
|
||||||
testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.ACTIVITI_USER]);
|
|
||||||
|
|
||||||
const groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
|
|
||||||
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
|
|
||||||
|
|
||||||
await apiServiceHrUser.login(testUser.email, testUser.password);
|
|
||||||
const tasksService = new TasksService(apiServiceHrUser);
|
const tasksService = new TasksService(apiServiceHrUser);
|
||||||
const queryService = new QueryService(apiServiceHrUser);
|
const queryService = new QueryService(apiServiceHrUser);
|
||||||
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
|
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
|
||||||
@@ -104,7 +92,13 @@ describe('Task form cloud component', () => {
|
|||||||
|
|
||||||
formTaskId = formTasks.list.entries[0].entry.id;
|
formTaskId = formTasks.list.entries[0].entry.id;
|
||||||
|
|
||||||
await loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password);
|
/* cspell: disable-next-line */
|
||||||
|
const assigneeProcessDefinition = await processDefinitionService.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.calledprocess, simpleApp);
|
||||||
|
const assigneeProcess = await processInstancesService.createProcessInstance(assigneeProcessDefinition.entry.key, simpleApp);
|
||||||
|
assigneeReleaseTask = await queryService.getProcessInstanceTasks(assigneeProcess.entry.id, simpleApp);
|
||||||
|
assigneeTaskId = assigneeReleaseTask.list.entries[0].entry.id;
|
||||||
|
|
||||||
|
await loginSSOPage.loginSSOIdentityService(browser.params.testConfig.hrUser.email, browser.params.testConfig.hrUser.password);
|
||||||
|
|
||||||
}, 5 * 60 * 1000);
|
}, 5 * 60 * 1000);
|
||||||
|
|
||||||
@@ -114,11 +108,6 @@ describe('Task form cloud component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
try {
|
|
||||||
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
|
|
||||||
await identityService.deleteIdentityUser(testUser.idIdentityService);
|
|
||||||
} catch (error) {
|
|
||||||
}
|
|
||||||
await browser.executeScript('window.sessionStorage.clear();');
|
await browser.executeScript('window.sessionStorage.clear();');
|
||||||
await browser.executeScript('window.localStorage.clear();');
|
await browser.executeScript('window.localStorage.clear();');
|
||||||
});
|
});
|
||||||
@@ -159,6 +148,17 @@ describe('Task form cloud component', () => {
|
|||||||
await taskFormCloudComponent.checkCancelButtonIsDisplayed();
|
await taskFormCloudComponent.checkCancelButtonIsDisplayed();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[C306872] Should not be able to Release a process task which has only assignee', async () => {
|
||||||
|
await appListCloudComponent.goToApp(simpleApp);
|
||||||
|
await tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(assigneeTaskId);
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(assigneeTaskId);
|
||||||
|
|
||||||
|
await expect(await taskHeaderCloudPage.getAssignee()).toEqual(assigneeReleaseTask.list.entries[0].entry.assignee);
|
||||||
|
await expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
|
||||||
|
await taskFormCloudComponent.checkReleaseButtonIsNotDisplayed();
|
||||||
|
});
|
||||||
|
|
||||||
describe('Candidate Base App', () => {
|
describe('Candidate Base App', () => {
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
Binary file not shown.
@@ -26,7 +26,8 @@ export const ACTIVITI_CLOUD_APPS: any = {
|
|||||||
anotherCandidateGroupProcess: 'anothercandidategroup',
|
anotherCandidateGroupProcess: 'anothercandidategroup',
|
||||||
uploadFileProcess: 'uploadfileprocess',
|
uploadFileProcess: 'uploadfileprocess',
|
||||||
processwithstarteventform: 'processwithstarteventform',
|
processwithstarteventform: 'processwithstarteventform',
|
||||||
processwithjsonfilemapping: 'processwithjsonfilemapping'
|
processwithjsonfilemapping: 'processwithjsonfilemapping',
|
||||||
|
assigneeProcess: 'assigneeprocess'
|
||||||
},
|
},
|
||||||
forms: {
|
forms: {
|
||||||
starteventform: 'starteventform',
|
starteventform: 'starteventform',
|
||||||
|
Reference in New Issue
Block a user