-
Notifications
You must be signed in to change notification settings - Fork 261
/
task-list-properties.e2e.ts
291 lines (238 loc) · 15.1 KB
/
task-list-properties.e2e.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/*!
* @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 { browser } from 'protractor';
import {
StringUtil, TasksService,
ProcessDefinitionsService, ProcessInstancesService,
LoginPage, createApiService,
AppListCloudPage, LocalStorageUtil, IdentityService, GroupIdentityService, DateUtil
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { TaskListCloudConfiguration } from './../config/task-list-cloud.config';
import moment = require('moment');
import { taskFilterConfiguration } from './../config/task-filter.config';
describe('Edit task filters and task list properties', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const noTasksFoundMessage = 'No Tasks Found';
let createdTask, notAssigned, notDisplayedTask, processDefinition, processInstance, priorityTask, subTask,
otherOwnerTask, testUser, groupInfo, simpleTask;
const priority = 1;
const beforeDate = moment().add(-1, 'days').format('DD/MM/YYYY');
const currentDate = DateUtil.formatDate('DD/MM/YYYY');
const afterDate = moment().add(1, 'days').format('DD/MM/YYYY');
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
otherOwnerTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(otherOwnerTask.entry.id, simpleApp);
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(createdTask.entry.id, simpleApp);
simpleTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
notAssigned = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
priorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: priority });
await tasksService.claimTask(priorityTask.entry.id, simpleApp);
notDisplayedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(notDisplayedTask.entry.id, candidateBaseApp);
processDefinition = await processDefinitionService
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.candidateUsersGroup, simpleApp);
processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
subTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { 'parentTaskId': createdTask.entry.id });
await tasksService.claimTask(subTask.entry.id, simpleApp);
const jsonFile = new TaskListCloudConfiguration().getConfiguration();
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-cloud-task-list', JSON.stringify(jsonFile));
await LocalStorageUtil.setConfigField('adf-edit-task-filter', JSON.stringify(taskFilterConfiguration));
}, 5 * 60 * 1000);
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
describe('Edit task filters and task list properties - filter properties', () => {
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await editTaskFilter.openFilter();
await taskFilter.checkTaskFilterIsDisplayed('my-tasks');
});
it('[C292004] Filter by appName', async () => {
await expect(await editTaskFilter.getAppNameDropDownValue()).toEqual(simpleApp);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(notDisplayedTask.entry.name);
await editTaskFilter.openFilter();
await editTaskFilter.setAppNameDropDown(candidateBaseApp);
await expect(await editTaskFilter.getAppNameDropDownValue()).toEqual(candidateBaseApp);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(notDisplayedTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C291906] Should be able to see only the task with specific taskId when typing it in the task Id field', async () => {
await editTaskFilter.setId(createdTask.entry.id);
await expect(await editTaskFilter.getId()).toEqual(createdTask.entry.id);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedById(createdTask.entry.id);
await taskList.getRowsWithSameId(createdTask.entry.id).then(async (list) => {
await expect(list.length).toEqual(1);
});
});
it('[C291907] Should be able to see No tasks found when typing an invalid task id', async () => {
await editTaskFilter.setId('invalidId');
await expect(await editTaskFilter.getId()).toEqual('invalidId');
await editTaskFilter.closeFilter();
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297476] Filter by taskName', async () => {
await editTaskFilter.setTaskName(createdTask.entry.name);
await expect(await editTaskFilter.getTaskName()).toEqual(createdTask.entry.name);
await editTaskFilter.closeFilter();
await taskList.getRowsWithSameName(createdTask.entry.name).then(async (list) => {
await expect(list.length).toEqual(1);
});
});
it('[C297613] Should be able to see No tasks found when typing a task name that does not exist', async () => {
await editTaskFilter.setTaskName('invalidName');
await expect(await editTaskFilter.getTaskName()).toEqual('invalidName');
await editTaskFilter.closeFilter();
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297480] Should be able to see only tasks that are part of a specific process when processInstanceId is set', async () => {
await editTaskFilter.setProcessInstanceId(processInstance.entry.id);
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.clearAssignee();
await editTaskFilter.closeFilter();
await expect(await taskList.getDataTable().getNumberOfRows()).toBe(1);
await taskList.checkContentIsDisplayedByProcessInstanceId(processInstance.entry.id);
});
it('[C297684] Should be able to see No tasks found when typing an invalid processInstanceId', async () => {
await editTaskFilter.setProcessInstanceId('invalidTaskId');
await editTaskFilter.closeFilter();
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297478] Should be able to see only tasks that are assigned to a specific user when assignee is set', async () => {
await editTaskFilter.setAssignee(testUser.username);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(notAssigned.entry.name);
});
it('[C297686] Should be able to see No tasks found when typing an invalid user to assignee field', async () => {
await editTaskFilter.setAssignee('invalid');
await editTaskFilter.closeFilter();
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297482] Should be able to see only tasks with specific priority when priority is set', async () => {
await editTaskFilter.setPriority('Low');
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(priorityTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297687] Should be able to see No tasks found when typing unused value for priority field', async () => {
await editTaskFilter.setPriority('Normal');
await editTaskFilter.closeFilter();
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297481] Should be able to see only tasks with specific parentTaskId when parentTaskId is set', async () => {
await editTaskFilter.setParentTaskId(subTask.entry.parentTaskId);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(subTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297486] Filter by Owner', async () => {
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.clearAssignee();
await editTaskFilter.setOwner(testUser.username);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(notAssigned.entry.name);
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await editTaskFilter.openFilter();
await editTaskFilter.setOwner('invalid');
await editTaskFilter.closeFilter();
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297484] Task is displayed when typing into lastModifiedFrom field a date before the task CreatedDate', async () => {
await editTaskFilter.setLastModifiedFrom(beforeDate);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await editTaskFilter.openFilter();
await editTaskFilter.setLastModifiedFrom(afterDate);
await editTaskFilter.closeFilter();
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297689] Task is not displayed when typing into lastModifiedFrom field the same date as tasks CreatedDate', async () => {
await editTaskFilter.setLastModifiedFrom(currentDate);
await editTaskFilter.setTaskName(simpleTask.entry.name);
await editTaskFilter.closeFilter();
await taskList.checkContentIsNotDisplayedByName(simpleTask.entry.name);
});
it('[C297485] Task is displayed when typing into lastModifiedTo field a date after the task CreatedDate', async () => {
await editTaskFilter.setLastModifiedTo(afterDate);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await editTaskFilter.openFilter();
await editTaskFilter.setLastModifiedTo(beforeDate);
await editTaskFilter.closeFilter();
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297690] Task is not displayed when typing into lastModifiedTo field the same date as tasks CreatedDate', async () => {
await editTaskFilter.setLastModifiedTo(currentDate);
await editTaskFilter.setTaskName(simpleTask.entry.name);
await editTaskFilter.closeFilter();
await taskList.checkContentIsNotDisplayedByName(simpleTask.entry.name);
});
it('[C297691] Task is not displayed when typing into lastModifiedFrom field a date before the task due date ' +
'and into lastModifiedTo a date before task due date', async () => {
await editTaskFilter.setLastModifiedFrom(beforeDate);
await editTaskFilter.setLastModifiedTo(beforeDate);
await editTaskFilter.setTaskName(createdTask.entry.name);
await editTaskFilter.closeFilter();
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297692] Task is displayed when typing into lastModifiedFrom field a date before the tasks due date ' +
'and into lastModifiedTo a date after', async () => {
await editTaskFilter.setLastModifiedFrom(beforeDate);
await editTaskFilter.setLastModifiedTo(afterDate);
await editTaskFilter.setTaskName(createdTask.entry.name);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
});
it('[C297693] Task is not displayed when typing into lastModifiedFrom field a date after the tasks due date ' +
'and into lastModifiedTo a date after', async () => {
await editTaskFilter.setLastModifiedFrom(afterDate);
await editTaskFilter.setLastModifiedTo(afterDate);
await editTaskFilter.closeFilter();
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
});
});