Remove demo shell test and make cloud a bit more stable (#6781)

* remove demo shell test and make cloud a bit more stable

* fix lint

* Update restore-content-directive.e2e.ts

* Update restore-content-directive.e2e.ts

* Update restore-content-directive.e2e.ts

* try fix attach

* Update .travis.yml

* sleep...

* remove about e2e demo shell....

* fix

* lint fix

* configure

* refactor buuild

* names and remove demo shell build from libs

* fix new build approach

* fix

* fix

* .

* uncomment

* .

* .

* fix

* fix

* .

* fix

* lock update

* fix demo shell errors

* use replay subject

* fix some console log error

* suffix problem

* split process e2e

* not need to check everywhere the pagination e2e

* split content

* fix

* fix

* fix

* fix

* reorg

# Conflicts:
#	.travis.yml
This commit is contained in:
Eugenio Romano
2021-03-17 15:17:46 +00:00
committed by GitHub
parent 90aabe3541
commit cd915b307b
115 changed files with 659 additions and 1117 deletions

View File

@@ -0,0 +1,148 @@
/*!
* @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 { ApiService, ApplicationsUtil, LoginPage, UserModel, UsersActions } from '@alfresco/adf-testing';
import { TasksPage } from './../pages/tasks.page';
import { CommentsPage } from '../../core/pages/comments.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TaskRepresentation } from '@alfresco/js-api';
import CONSTANTS = require('../../util/constants');
describe('Comment component for Processes', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const taskPage = new TasksPage();
const commentsPage = new CommentsPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
let user, appId, secondUser;
const taskName = {
completed_task: 'Test Completed',
multiple_users: 'Test Comment multiple users'
};
beforeAll(async () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
secondUser = await usersActions.createUser(new UserModel({ tenantId: user.tenantId }));
await apiService.login(user.username, user.password);
const importedApp = await new ApplicationsUtil(apiService).importPublishDeployApp(app.file_path);
appId = importedApp.id;
await loginPage.login(user.username, user.password);
});
afterAll(async () => {
await apiService.getInstance().activiti.modelsApi.deleteModel(appId);
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(user.tenantId);
});
it('[C260237] Should not be able to add a comment on a completed task', async () => {
const newTask = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: taskName.completed_task }));
const taskId = newTask.id;
await apiService.getInstance().activiti.taskActionsApi.completeTask(taskId);
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().selectRow(taskName.completed_task);
await commentsPage.checkCommentInputIsNotDisplayed();
});
it('[C212864] Should be able to add multiple comments on a single task using different users', async () => {
const newTask = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: taskName.multiple_users }));
await apiService.getInstance().activiti.taskApi.involveUser(newTask.id, { email: secondUser.email });
const taskComment = { message: 'Task Comment' };
const secondTaskComment = { message: 'Second Task Comment' };
await apiService.getInstance().activiti.taskApi.addTaskComment(taskComment, newTask.id);
await apiService.getInstance().activiti.taskApi.addTaskComment(secondTaskComment, newTask.id);
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().selectRow(taskName.multiple_users);
await taskPage.taskDetails().selectActivityTab();
const totalCommentsLatest = await apiService.getInstance().activiti.taskApi.getTaskComments(newTask.id, { 'latestFirst': true });
const thirdTaskComment = { message: 'Third Task Comment' };
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (' + totalCommentsLatest.total + ')');
await expect(await commentsPage.getMessage(0)).toEqual(totalCommentsLatest.data[0].message);
await expect(await commentsPage.getMessage(1)).toEqual(totalCommentsLatest.data[1].message);
await expect(await commentsPage.getUserName(0)).toEqual(totalCommentsLatest.data[0].createdBy.firstName + ' ' + totalCommentsLatest.data[0].createdBy.lastName);
await expect(await commentsPage.getUserName(1)).toEqual(totalCommentsLatest.data[1].createdBy.firstName + ' ' + totalCommentsLatest.data[1].createdBy.lastName);
await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
await expect(await commentsPage.getTime(1)).toMatch(/(ago|few)/);
await navigationBarPage.clickLogoutButton();
await loginPage.login(secondUser.username, secondUser.password);
await apiService.getInstance().activiti.taskApi.addTaskComment(thirdTaskComment, newTask.id);
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().selectRow(taskName.multiple_users);
await taskPage.taskDetails().selectActivityTab();
const totalComments = await apiService.getInstance().activiti.taskApi.getTaskComments(newTask.id, { 'latestFirst': true });
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (' + totalComments.total + ')');
await expect(await commentsPage.getMessage(0)).toEqual(totalComments.data[0].message);
await expect(await commentsPage.getMessage(1)).toEqual(totalComments.data[1].message);
await expect(await commentsPage.getMessage(2)).toEqual(totalComments.data[2].message);
await expect(await commentsPage.getUserName(0)).toEqual(totalComments.data[0].createdBy.firstName + ' ' + totalComments.data[0].createdBy.lastName);
await expect(await commentsPage.getUserName(1)).toEqual(totalComments.data[1].createdBy.firstName + ' ' + totalComments.data[1].createdBy.lastName);
await expect(await commentsPage.getUserName(2)).toEqual(totalComments.data[2].createdBy.firstName + ' ' + totalComments.data[2].createdBy.lastName);
await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
await expect(await commentsPage.getTime(1)).toMatch(/(ago|few)/);
await expect(await commentsPage.getTime(2)).toMatch(/(ago|few)/);
});
});

View File

@@ -0,0 +1,520 @@
/*!
* @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 {
ApiService,
ApplicationsUtil,
ArrayUtil,
DateUtil,
LoginPage,
PaginationPage,
ProcessUtil,
UsersActions
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { AppsRuntimeActions } from '../../actions/APS/apps-runtime.actions';
import { TaskListDemoPage } from './../pages/task-list-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TaskRepresentation } from '@alfresco/js-api';
import moment = require('moment');
describe('Start Task - Custom App', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const secondApp = browser.params.resources.Files.WIDGETS_SMOKE_TEST;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const taskListSinglePage = new TaskListDemoPage();
const paginationPage = new PaginationPage();
const apiService = new ApiService();
const appsRuntime = new AppsRuntimeActions(apiService);
const usersActions = new UsersActions(apiService);
const applicationsService = new ApplicationsUtil(apiService);
const processUtil = new ProcessUtil(apiService);
let processUserModel;
let appRuntime, secondAppRuntime;
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'];
const allTasksName = ['t01', 'taskOne', 'taskTwo', 'taskOne', 't13', 't12', 't11', 't10', 't09', 't08', 't07', 't06', 't05', 't04', 't03', 't02',
'User Task', 'User Task', 'User Task', 'User Task'];
const invalidAppId = '1234567890', invalidName = 'invalidName', invalidTaskId = '0000';
const noTasksFoundMessage = 'No Tasks Found';
const nrOfTasks = 20;
let currentPage = 1;
const totalNrOfPages = 'of 4';
const currentDateStandardFormat = DateUtil.formatDate('YYYY-MM-DDTHH:mm:ss.SSSZ');
const currentDate = DateUtil.formatDate('MM/DD/YYYY');
const beforeDate = moment().add(-1, 'days').format('MM/DD/YYYY');
const afterDate = moment().add(1, 'days').format('MM/DD/YYYY');
let taskWithDueDate;
let processDefinitionId;
const itemsPerPage = {
five: '5',
fiveValue: 5,
ten: '10',
tenValue: 10,
fifteen: '15',
fifteenValue: 15,
twenty: '20',
twentyValue: 20,
default: '25'
};
beforeAll(async () => {
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
appModel = await applicationsService.importPublishDeployApp(app.file_path);
appRuntime = await appsRuntime.getRuntimeAppByName(app.title);
await applicationsService.importPublishDeployApp(secondApp.file_path);
secondAppRuntime = await appsRuntime.getRuntimeAppByName(secondApp.title);
processDefinitionId = await processUtil.startProcessOfApp(appModel.name);
await processUtil.startProcessOfApp(appModel.name);
await processUtil.startProcessOfApp(appModel.name);
await processUtil.startProcessOfApp(appModel.name);
for (let i = 1; i < paginationTasksName.length; i++) {
await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ 'name': paginationTasksName[i] }));
}
for (let i = 0; i < 3; i++) {
completedTasks[i] = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({
'name': completedTasksName[i],
'dueDate': DateUtil.formatDate('YYYY-MM-DDTHH:mm:ss.SSSZ', new Date(), i + 2)
}));
await apiService.getInstance().activiti.taskActionsApi.completeTask(completedTasks[i].id);
}
taskWithDueDate = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({
'name': paginationTasksName[0],
'dueDate': currentDateStandardFormat
}));
await loginPage.login(processUserModel.username, processUserModel.password);
});
describe('', () => {
beforeEach(async () => {
await navigationBarPage.clickTaskListButton();
await taskListSinglePage.clickResetButton();
});
it('[C286362] Default pagination settings on task list', async () => {
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(nrOfTasks);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName)).toEqual(true);
});
await expect(await paginationPage.getCurrentPage()).toEqual('Page 1');
await expect(await paginationPage.getTotalPages()).toEqual('of 1');
await paginationPage.checkPageSelectorIsNotDisplayed();
await paginationPage.checkNextPageButtonIsDisabled();
await paginationPage.checkPreviousPageButtonIsDisabled();
});
it('[C286367] 20 Items per page', async () => {
await taskListSinglePage.typeItemsPerPage(itemsPerPage.twentyValue);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(nrOfTasks);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName)).toEqual(true);
});
await paginationPage.checkNextPageButtonIsDisabled();
await paginationPage.checkPreviousPageButtonIsDisabled();
});
it('[C286365] 5 Items per page', async () => {
await taskListSinglePage.typeItemsPerPage(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 5))).toEqual(true);
});
await paginationPage.clickOnNextPage();
currentPage++;
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 6-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(5, 10))).toEqual(true);
});
await paginationPage.clickOnNextPage();
currentPage++;
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(10, 15))).toEqual(true);
});
await paginationPage.clickOnNextPage();
currentPage++;
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 16-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
});
});
it('[C286364] 10 Items per page', async () => {
currentPage = 1;
await taskListSinglePage.typeItemsPerPage(itemsPerPage.tenValue);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 10))).toEqual(true);
});
await paginationPage.clickOnNextPage();
currentPage++;
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(10, 20))).toEqual(true);
});
});
it('[C286363] 15 Items per page', async () => {
currentPage = 1;
await taskListSinglePage.typeItemsPerPage(itemsPerPage.fifteenValue);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fifteenValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 15))).toEqual(true);
});
currentPage++;
await paginationPage.clickOnNextPage();
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 16-' + nrOfTasks + ' of ' + nrOfTasks);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(nrOfTasks - itemsPerPage.fifteenValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
});
});
it('[C286366] Pagination is not displayed when no task is displayed', async () => {
await taskListSinglePage.typeAppId(secondAppRuntime.id);
await expect(await taskListSinglePage.getAppId()).toEqual(secondAppRuntime.id.toString());
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286406] Invalid values for items per page', async () => {
await taskListSinglePage.typeItemsPerPage(0);
await taskListSinglePage.clickAppId();
await expect(await taskListSinglePage.getItemsPerPageFieldErrorMessage()).toEqual('Value must be greater than or equal to 1');
});
it('[C286404] Navigate using page field', async () => {
currentPage = 1;
await taskListSinglePage.typeItemsPerPage(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await taskListSinglePage.typePage(currentPage);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
await expect(await paginationPage.getTotalPages()).toEqual(totalNrOfPages);
await paginationPage.checkPageSelectorIsDisplayed();
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 5))).toEqual(true);
});
currentPage++;
await taskListSinglePage.typePage(currentPage);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
await expect(await paginationPage.getTotalPages()).toEqual(totalNrOfPages);
await paginationPage.checkPageSelectorIsDisplayed();
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(5, 10))).toEqual(true);
});
currentPage++;
await taskListSinglePage.typePage(currentPage);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
await expect(await paginationPage.getTotalPages()).toEqual(totalNrOfPages);
await paginationPage.checkPageSelectorIsDisplayed();
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(10, 15))).toEqual(true);
});
currentPage++;
await taskListSinglePage.typePage(currentPage);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
await expect(await paginationPage.getTotalPages()).toEqual(totalNrOfPages);
await paginationPage.checkPageSelectorIsDisplayed();
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await taskListSinglePage.taskList().getAllRowsNameColumn().then(async (list) => {
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
});
});
it('[C286405] Type invalid values to page field', async () => {
await taskListSinglePage.typePage(0);
await taskListSinglePage.clickAppId();
await expect(await taskListSinglePage.getPageFieldErrorMessage()).toEqual('Value must be greater than or equal to 1');
await taskListSinglePage.clickResetButton();
await taskListSinglePage.typePage(2);
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286413] Task is displayed when typing into dueAfter field a date before the tasks due date', async () => {
await taskListSinglePage.typeDueAfter(beforeDate);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(1);
});
it('[C286414] Task is not displayed when typing into dueAfter field a date after the task due date', async () => {
await taskListSinglePage.typeDueAfter(afterDate);
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286415] Task is not displayed when typing into dueAfter field the same date as tasks due date', async () => {
await taskListSinglePage.typeDueAfter(currentDate);
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286424] Task is not displayed when typing into dueBefore field a date before the tasks due date', async () => {
await taskListSinglePage.typeDueBefore(beforeDate);
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286425] Task is displayed when typing into dueBefore field a date after the task due date', async () => {
await taskListSinglePage.typeDueBefore(afterDate);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(1);
});
it('[C286426] Task is not displayed when typing into dueBefore field the same date as tasks due date', async () => {
await taskListSinglePage.typeDueBefore(currentDate);
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286428] Task is not displayed when typing into dueAfter field a date before the task due date and into dueBefore a date before task due date', async () => {
await taskListSinglePage.typeDueBefore(beforeDate);
await taskListSinglePage.typeDueAfter(beforeDate);
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
});
it('[C286427] Task is displayed when typing into dueAfter field a date before the tasks due date and into dueBefore a date after', async () => {
await taskListSinglePage.typeDueBefore(afterDate);
await taskListSinglePage.typeDueAfter(beforeDate);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(1);
});
it('[C286429] Task is not displayed when typing into dueAfter field a date after the tasks due date and into dueBefore a date after', async () => {
await taskListSinglePage.typeDueBefore(afterDate);
await taskListSinglePage.typeDueAfter(afterDate);
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
await expect(await taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C280515] Should be able to see only the tasks of a specific app when typing the apps id in the appId field', async () => {
await taskListSinglePage.typeAppId(appRuntime.id);
await expect(await taskListSinglePage.getAppId()).toEqual(appRuntime.id.toString());
await taskListSinglePage.taskList().checkContentIsDisplayed(app.taskName);
await taskListSinglePage.taskList().checkContentIsDisplayed(app.taskName);
await taskListSinglePage.taskList().checkContentIsNotDisplayed(paginationTasksName[13]);
});
it('[C280569] Should be able to see No tasks found when typing an invalid appId', async () => {
await taskListSinglePage.typeAppId(invalidAppId);
await expect(await taskListSinglePage.getAppId()).toEqual(invalidAppId.toString());
await expect(await taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C280570] Should be able to see only the tasks with specific name when typing the name in the task name field', async () => {
await taskListSinglePage.typeTaskName(paginationTasksName[13]);
await expect(await taskListSinglePage.getTaskName()).toEqual(paginationTasksName[13]);
await taskListSinglePage.taskList().checkContentIsDisplayed(paginationTasksName[13]);
await expect((await taskListSinglePage.taskList().getRowsDisplayedWithSameName(paginationTasksName[13])).length).toBe(2);
});
it('[C280571] Should be able to see No tasks found when typing a task name that does not exist', async () => {
await taskListSinglePage.typeTaskName(invalidName);
await expect(await taskListSinglePage.getTaskName()).toEqual(invalidName);
await expect(await taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C280629] Should be able to see only the task with specific taskId when typing it in the task Id field', async () => {
await taskListSinglePage.typeTaskId(taskWithDueDate.id);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await taskListSinglePage.getTaskId()).toEqual(taskWithDueDate.id);
await taskListSinglePage.taskList().checkContentIsDisplayed(taskWithDueDate.name);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(1);
});
it('[C280630] Should be able to see No tasks found when typing an invalid taskId', async () => {
await taskListSinglePage.typeTaskId(invalidTaskId);
await expect(await taskListSinglePage.getTaskId()).toEqual(invalidTaskId);
await expect(await taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C286589] Should be able to see only completed tasks when choosing Completed from state drop down', async () => {
await taskListSinglePage.selectState('Completed');
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await taskListSinglePage.taskList().checkContentIsDisplayed(completedTasks[0].name);
await taskListSinglePage.taskList().checkContentIsDisplayed(completedTasks[1].name);
await taskListSinglePage.taskList().checkContentIsDisplayed(completedTasks[2].name);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(3);
});
it('[C286597] Should be able to see only running tasks when choosing Active from state drop down', async () => {
await taskListSinglePage.selectState('Active');
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await taskListSinglePage.taskList().checkContentIsNotDisplayed(completedTasks[0].name);
await taskListSinglePage.taskList().checkContentIsNotDisplayed(completedTasks[1].name);
await taskListSinglePage.taskList().checkContentIsNotDisplayed(completedTasks[2].name);
const list = await taskListSinglePage.taskList().getAllRowsNameColumn();
await expect(ArrayUtil.arrayContainsArray(list, allTasksName)).toEqual(true);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(20);
});
it('[C286598] Should be able to see all tasks when choosing All from state drop down', async () => {
await taskListSinglePage.selectState('All');
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await taskListSinglePage.taskList().checkContentIsDisplayed(completedTasks[0].name);
await taskListSinglePage.taskList().checkContentIsDisplayed(completedTasks[1].name);
await taskListSinglePage.taskList().checkContentIsDisplayed(completedTasks[2].name);
const list = await taskListSinglePage.taskList().getAllRowsNameColumn();
await expect(ArrayUtil.arrayContainsArray(list, allTasksName)).toEqual(true);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(23);
});
});
it('[C286622] Should be able to see only tasks that are part of a specific process when processDefinitionId is set', async () => {
const processDefinitionIds = [processDefinitionId.processDefinitionId, processDefinitionId.processDefinitionId,
processDefinitionId.processDefinitionId, processDefinitionId.processDefinitionId];
await navigationBarPage.clickTaskListButton();
await taskListSinglePage.clickResetButton();
await taskListSinglePage.typeProcessDefinitionId(processDefinitionId.processDefinitionId);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(4);
const list = await taskListSinglePage.getAllProcessDefinitionIds();
await expect(ArrayUtil.arrayContainsArray(list, processDefinitionIds)).toEqual(true);
});
it('[C286623] Should be able to see No tasks found when typing an invalid processDefinitionId', async () => {
await navigationBarPage.clickTaskListButton();
await taskListSinglePage.clickResetButton();
await taskListSinglePage.typeProcessDefinitionId(invalidTaskId);
await expect(await taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C286622] Should be able to see only tasks that are part of a specific process when processInstanceId is set', async () => {
const processInstanceIds = [processDefinitionId.id];
await navigationBarPage.clickTaskListButton();
await taskListSinglePage.clickResetButton();
await taskListSinglePage.typeProcessInstanceId(processDefinitionId.id);
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
await expect(await taskListSinglePage.getProcessInstanceId()).toEqual(processDefinitionId.id);
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(1);
const list = await taskListSinglePage.getAllProcessInstanceIds();
await expect(ArrayUtil.arrayContainsArray(list, processInstanceIds)).toEqual(true);
});
it('[C286623] Should be able to see No tasks found when typing an invalid processInstanceId', async () => {
await navigationBarPage.clickTaskListButton();
await taskListSinglePage.clickResetButton();
await taskListSinglePage.typeProcessInstanceId(invalidTaskId);
await expect(await taskListSinglePage.getProcessInstanceId()).toEqual(invalidTaskId);
await expect(await taskListSinglePage.taskList().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
});

View File

@@ -0,0 +1,352 @@
/*!
* @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 {
ApiService,
ApplicationsUtil,
BrowserActions,
BrowserVisibility,
LocalStorageUtil,
LoginPage,
StringUtil,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { AppDefinitionRepresentation } from '@alfresco/js-api';
import { browser, by, element } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksPage } from './../pages/tasks.page';
import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.page';
import { ProcessFiltersPage } from './../pages/process-filters.page';
import { infoDrawerConfiguration } from './../config/task.config';
import CONSTANTS = require('../../util/constants');
import moment = require('moment');
describe('Info Drawer', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const taskPage = new TasksPage();
const processServiceTabBarPage = new ProcessServiceTabBarPage();
const processFiltersPage = new ProcessFiltersPage();
const apiService = new ApiService();
const applicationsService = new ApplicationsUtil(apiService);
const firstComment = 'comm1';
const date = {
form: '12/08/2017',
header: 'Aug 12, 2017',
dateFormat: 'll'
};
const taskDetails = {
description: 'I am your Description',
dueDate: date.form,
status: 'Running',
priority: '50',
category: 'No category',
parentName: 'No parent',
dateFormat: 'll'
};
let processUserModelFullName: string;
let assigneeUserModelFullName: string;
let appCreated: AppDefinitionRepresentation;
let processUserModel;
beforeAll(async () => {
const usersActions = new UsersActions(apiService);
await apiService.loginWithProfile('admin');
const assigneeUserModel = await usersActions.createUser();
assigneeUserModelFullName = assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName;
processUserModel = await usersActions.createUser(new UserModel({ tenantId: assigneeUserModel.tenantId }));
processUserModelFullName = processUserModel.firstName + ' ' + processUserModel.lastName;
await apiService.login(processUserModel.username, processUserModel.password);
appCreated = await applicationsService.importPublishDeployApp(app.file_path);
await loginPage.login(processUserModel.username, processUserModel.password);
});
afterAll(async () => {
await apiService.getInstance().activiti.modelsApi.deleteModel(appCreated.id);
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
});
beforeEach(async () => {
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
});
it('[C260319] New Task - displayed details', async () => {
const name = StringUtil.generateRandomString(5);
await taskPage.createTask({ ...taskDetails, formName: app.formName, name });
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(name);
await taskPage.tasksListPage().selectRow(name);
await taskPage.checkTaskTitle(name);
await expect(await taskPage.taskDetails().isAssigneeClickable()).toBeTruthy();
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: date.header,
fullName: processUserModelFullName,
formName: app.formName
});
await taskPage.taskDetails().selectActivityTab();
await taskPage.taskDetails().checkIsEmptyCommentListDisplayed();
await taskPage.taskDetails().addComment(firstComment);
await taskPage.taskDetails().checkCommentIsDisplayed(firstComment);
await taskPage.taskDetails().clickCompleteFormTask();
});
it('[C260323] Priority - Editing field', async () => {
const name = StringUtil.generateRandomString(5);
await taskPage.createTask({ ...taskDetails, formName: app.formName, name });
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(name);
await taskPage.tasksListPage().selectRow(name);
await taskPage.checkTaskTitle(name);
await expect(await taskPage.taskDetails().getPriority()).toEqual(taskDetails.priority);
await taskPage.taskDetails().updatePriority('40');
await taskPage.taskDetails().checkTaskDetailsDisplayed();
await expect(await taskPage.taskDetails().getPriority()).toEqual('40');
await taskPage.taskDetails().updatePriority();
await taskPage.taskDetails().checkTaskDetailsDisplayed();
await expect(await taskPage.taskDetails().getPriority()).toEqual('');
await taskPage.taskDetails().clickCompleteFormTask();
});
it('[C260325] Due Date - Changing', async () => {
const name = StringUtil.generateRandomString(5);
await taskPage.createTask({ ...taskDetails, formName: app.formName, name });
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(name);
await taskPage.tasksListPage().selectRow(name);
await taskPage.checkTaskTitle(name);
await expect(await taskPage.taskDetails().isAssigneeClickable()).toBeTruthy();
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: date.header,
fullName: processUserModelFullName,
formName: app.formName
});
await taskPage.taskDetails().updateDueDate();
await expect(await taskPage.taskDetails().getDueDate()).toEqual(moment('Aug 1, 2017').format(taskDetails.dateFormat));
await taskPage.taskDetails().clickCompleteFormTask();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsNotDisplayed(name);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsNotDisplayed(name);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(name);
await taskPage.tasksListPage().selectRow(name);
await taskPage.checkTaskTitle(name);
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: 'Aug 1, 2017',
status: 'Completed',
fullName: processUserModelFullName,
formName: app.formName
});
});
it('[C260329] Task with no form', async () => {
const name = StringUtil.generateRandomString(5);
await taskPage.createTask(<any> { ...taskDetails, formName: '', name });
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(name);
await taskPage.tasksListPage().selectRow(name);
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: date.header,
fullName: processUserModelFullName,
formName: 'No form'
});
await taskPage.completeTaskNoForm();
});
it('[C260320] Assign user to the task', async () => {
const name = StringUtil.generateRandomString(5);
await taskPage.createTask(<any> { ...taskDetails, formName: app.formName, name });
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(name);
await taskPage.tasksListPage().selectRow(name);
await taskPage.checkTaskTitle(name);
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: date.header,
fullName: processUserModelFullName,
formName: app.formName
});
await expect(await taskPage.taskDetails().isAssigneeClickable()).toBeTruthy();
await BrowserActions.click(taskPage.taskDetails().assigneeButton);
const cancelSearch = element(by.css('button[id="close-people-search"]'));
await BrowserVisibility.waitUntilElementIsPresent(cancelSearch);
await BrowserActions.click(cancelSearch);
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: date.header,
fullName: processUserModelFullName,
formName: app.formName
});
await expect(await taskPage.taskDetails().isAssigneeClickable()).toBeTruthy();
await BrowserActions.click(taskPage.taskDetails().assigneeButton);
const addPeople = element(by.css('button[id="add-people"]'));
await BrowserVisibility.waitUntilElementIsPresent(addPeople);
await BrowserActions.click(addPeople);
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: date.header,
fullName: processUserModelFullName,
formName: app.formName
});
await taskPage.taskDetails().updateAssignee(assigneeUserModelFullName);
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.taskName);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.taskDetails().checkTaskDetailsDisplayed();
await browser.sleep(2000);
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: date.header,
fullName: assigneeUserModelFullName,
formName: app.formName
});
});
it('[C260326] Process with a task included', async () => {
await processServiceTabBarPage.clickProcessButton();
const startProcess = await processFiltersPage.startProcess();
await startProcess.enterProcessName('My process');
await startProcess.selectFromProcessDropdown(app.processName);
await startProcess.clickStartProcessButton();
await processServiceTabBarPage.clickTasksButton();
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(app.taskName);
await taskPage.tasksListPage().selectRow(app.taskName);
await taskPage.checkTaskTitle(app.taskName);
await taskPage.taskDetails().checkTaskDetailsDisplayed();
await browser.sleep(2000);
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: 'No date',
description: 'No description',
parentName: app.processName,
fullName: processUserModelFullName,
formName: app.formName
});
await taskPage.taskDetails().clickCompleteFormTask();
});
it('[C260328] Description - Editing field', async () => {
const name = StringUtil.generateRandomString(5);
await taskPage.createTask({ ...taskDetails, formName: app.formName, name });
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(name);
await taskPage.tasksListPage().selectRow(name);
await taskPage.checkTaskTitle(name);
await taskPage.taskDetails().checkTaskDetailsDisplayed();
await browser.sleep(2000);
await expect(await taskPage.taskDetails().isAssigneeClickable()).toBeTruthy();
await shouldHaveInfoDrawerDetails({
...taskDetails,
dueDate: 'Aug 12, 2017',
fullName: processUserModelFullName,
formName: app.formName
});
await taskPage.taskDetails().updateDescription('');
await expect(await taskPage.taskDetails().getDescriptionPlaceholder()).toEqual('No description');
await taskPage.taskDetails().updateDescription('Good Bye');
await expect(await taskPage.taskDetails().getDescription()).toEqual('Good Bye');
await taskPage.taskDetails().clickCompleteFormTask();
});
it('[C260505] Should be possible customised Task Header changing the adf-task-header field in the app.config.json', async () => {
await LocalStorageUtil.setConfigField('adf-task-header', JSON.stringify(infoDrawerConfiguration));
const name = StringUtil.generateRandomString(5);
await taskPage.createTask({ ...taskDetails, formName: app.formName, name });
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(name);
await taskPage.tasksListPage().selectRow(name);
await taskPage.checkTaskTitle(name);
await expect(await taskPage.taskDetails().getAssignee()).toEqual(processUserModelFullName);
await expect(await taskPage.taskDetails().getStatus()).toEqual(taskDetails.status);
await expect(await taskPage.taskDetails().getPriority()).toEqual(taskDetails.priority);
await expect(await taskPage.taskDetails().getParentName()).toEqual(taskDetails.parentName);
await taskPage.taskDetails().checkDueDatePickerButtonIsNotDisplayed();
await taskPage.taskDetails().clickCompleteFormTask();
});
async function shouldHaveInfoDrawerDetails({ description, status, priority, category, parentName, dateFormat, formName, fullName, dueDate }) {
await expect(await taskPage.taskDetails().getAssignee()).toEqual(fullName);
await expect(await taskPage.taskDetails().getDescription()).toEqual(description);
await expect(await taskPage.taskDetails().getStatus()).toEqual(status);
await expect(await taskPage.taskDetails().getPriority()).toEqual(priority);
await expect(await taskPage.taskDetails().getDueDate()).toEqual(dueDate !== 'No date' ? moment(dueDate).format(dateFormat) : 'No date');
await expect(await taskPage.taskDetails().getCategory()).toEqual(category);
await expect(await taskPage.taskDetails().getParentName()).toEqual(parentName);
await expect(await taskPage.taskDetails().getCreated()).toEqual(moment(Date.now()).format(dateFormat));
await taskPage.taskDetails().waitFormNameEqual(formName);
}
});

View File

@@ -0,0 +1,102 @@
/*!
* @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 {
ApiService,
ApplicationsUtil,
LoginPage,
PaginationPage,
ProcessUtil,
UsersActions
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksPage } from './../pages/tasks.page';
import CONSTANTS = require('../../util/constants');
describe('Items per page set to 15 and adding of tasks', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const taskPage = new TasksPage();
const paginationPage = new PaginationPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
const applicationsService = new ApplicationsUtil(apiService);
let processUserModel;
let currentPage = 1;
const nrOfTasks = 25;
const totalPages = 2;
let i;
let resultApp;
const itemsPerPage = {
fifteen: '15',
fifteenValue: 15
};
beforeAll(async () => {
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
resultApp = await applicationsService.importPublishDeployApp(app.file_path);
const processUtil = new ProcessUtil(apiService);
for (i = 0; i < (nrOfTasks - 5); i++) {
await processUtil.startProcessOfApp(resultApp.name);
}
await loginPage.login(processUserModel.username, processUserModel.password);
});
it('[C260306] Items per page set to 15 and adding of tasks', async () => {
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await paginationPage.selectItemsPerPage(itemsPerPage.fifteen);
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
await expect(await paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
await expect(await paginationPage.getTotalPages()).toEqual('of ' + totalPages);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue + ' of ' + (nrOfTasks - 5));
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.fifteenValue);
const processUtil = new ProcessUtil(apiService);
for (i; i < nrOfTasks; i++) {
await processUtil.startProcessOfApp(resultApp.name);
}
currentPage++;
await paginationPage.clickOnNextPage();
await taskPage.tasksListPage().getDataTable().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
await expect(await paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
await expect(await paginationPage.getTotalPages()).toEqual('of ' + totalPages);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 16-' + nrOfTasks + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(nrOfTasks - itemsPerPage.fifteenValue);
await paginationPage.checkNextPageButtonIsDisabled();
await paginationPage.checkPreviousPageButtonIsEnabled();
});
});

View File

@@ -0,0 +1,91 @@
/*!
* @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 {
ApiService,
ApplicationsUtil,
LoginPage,
PaginationPage,
StringUtil,
UsersActions
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksPage } from './../pages/tasks.page';
import { TaskRepresentation } from '@alfresco/js-api';
import CONSTANTS = require('../../util/constants');
describe('Task List Pagination - Sorting', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const taskPage = new TasksPage();
const paginationPage = new PaginationPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
const applicationsService = new ApplicationsUtil(apiService);
const nrOfTasks = 20;
let processUserModel;
const taskNameBase = 'Task';
const taskNames = StringUtil.generateFilesNames(10, nrOfTasks + 9, taskNameBase, '');
const itemsPerPage = {
five: '5',
fiveValue: 5,
ten: '10',
tenValue: 10,
twenty: '20',
twentyValue: 20
};
beforeAll(async () => {
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
await applicationsService.importPublishDeployApp(app.file_path);
for (let i = 0; i < nrOfTasks; i++) {
await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: taskNames[i] }));
}
await loginPage.login(processUserModel.username, processUserModel.password);
});
it('[C260308] Should be possible to sort tasks by name', async () => {
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await paginationPage.selectItemsPerPage(itemsPerPage.twenty);
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await taskPage.filtersPage().sortByName('ASC');
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await taskPage.filtersPage().getAllRowsNameColumn().then(async (list) => {
await expect(JSON.stringify(list) === JSON.stringify(taskNames)).toEqual(true);
});
await taskPage.filtersPage().sortByName('DESC');
await taskPage.filtersPage().getAllRowsNameColumn().then(async (list) => {
taskNames.reverse();
await expect(JSON.stringify(list) === JSON.stringify(taskNames)).toEqual(true);
});
});
});

View File

@@ -0,0 +1,137 @@
/*!
* @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 { ApiService, LoginPage, UsersActions } from '@alfresco/adf-testing';
import { TasksPage } from './../pages/tasks.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import * as fs from 'fs';
import * as path from 'path';
import CONSTANTS = require('../../util/constants');
import Task = require('../../models/APS/Task');
describe('Start Task - Task App', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const taskPage = new TasksPage();
let processUserModel;
const tasks = ['Standalone task', 'Completed standalone task', 'Add a form', 'Remove form'];
const noFormMessage = 'No forms attached';
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
const pathFile = path.join(browser.params.testConfig.main.rootPath + app.file_location);
const file = fs.createReadStream(pathFile);
await apiService.login(processUserModel.username, processUserModel.password);
await apiService.getInstance().activiti.appsApi.importAppDefinition(file);
await loginPage.login(processUserModel.username, processUserModel.password);
});
beforeEach(async () => {
await browser.refresh();
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
});
it('[C260421] Should a standalone task be displayed when creating a new task without form', async () => {
const task = await taskPage.createNewTask();
await task.addName(tasks[0]);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.taskDetails().noFormIsDisplayed();
const taskDetails = await taskPage.taskDetails();
await taskDetails.checkCompleteTaskButtonIsDisplayed();
await taskDetails.checkCompleteTaskButtonIsEnabled();
await taskPage.taskDetails().checkAttachFormButtonIsDisplayed();
await taskPage.taskDetails().checkAttachFormButtonIsEnabled();
await taskPage.taskDetails().waitFormNameEqual(CONSTANTS.TASK_DETAILS.NO_FORM);
await expect(await taskDetails.getNoFormMessage()).toEqual(noFormMessage);
});
it('[C268910] Should a standalone task be displayed in completed tasks when completing it', async () => {
const task = await taskPage.createNewTask();
await task.addName(tasks[1]);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[1]);
await taskPage.formFields().noFormIsDisplayed();
await taskPage.completeTaskNoForm();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().selectRow(tasks[1]);
await expect(await taskPage.formFields().getCompletedTaskNoFormMessage()).toEqual('Task ' + tasks[1] + ' completed');
await taskPage.formFields().noFormIsDisplayed();
await taskPage.taskDetails().waitFormNameEqual(CONSTANTS.TASK_DETAILS.NO_FORM);
});
it('[C268911] Should allow adding a form to a standalone task when clicking on Add form button', async () => {
const task = await taskPage.createNewTask();
await task.addName(tasks[2]);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[2]);
await taskPage.formFields().noFormIsDisplayed();
await taskPage.taskDetails().clickAttachFormButton();
const formFields = await taskPage.formFields();
await formFields.selectForm(app.formName);
await formFields.clickOnAttachFormButton();
await taskPage.formFields().checkFormIsDisplayed();
await taskPage.taskDetails().checkCompleteFormButtonIsDisplayed();
await taskPage.taskDetails().waitFormNameEqual(app.formName);
});
it('[C268912] Should a standalone task be displayed when removing the form from APS', async () => {
const task = await taskPage.createNewTask();
const taskDetails = await taskPage.taskDetails();
await task.addName(tasks[3]);
await task.selectForm(app.formName);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[3]);
await taskPage.taskDetails().waitFormNameEqual(app.formName);
const listOfTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
await apiService.getInstance().activiti.taskApi.removeForm(listOfTasks.data[0].id);
await browser.refresh();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[3]);
await taskPage.checkTaskTitle(tasks[3]);
await taskPage.formFields().noFormIsDisplayed();
await taskPage.taskDetails().waitFormNameEqual(CONSTANTS.TASK_DETAILS.NO_FORM);
await expect(await taskDetails.getNoFormMessage()).toEqual(noFormMessage);
});
});

View File

@@ -0,0 +1,222 @@
/*!
* @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 { ApiService, ApplicationsUtil, LoginPage, UserModel, UsersActions } from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { AttachmentListPage } from './../pages/attachment-list.page';
import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.page';
import { TasksPage } from './../pages/tasks.page';
import CONSTANTS = require('../../util/constants');
describe('Start Task - Custom App', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const attachmentListPage = new AttachmentListPage();
const processServiceTabBarPage = new ProcessServiceTabBarPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
const applicationsService = new ApplicationsUtil(apiService);
let processUserModel, assigneeUserModel;
const formTextField = app.form_fields.form_fieldId;
const formFieldValue = 'First value ';
const taskPage = new TasksPage();
const firstComment = 'comm1', firstChecklist = 'checklist1';
const tasks = ['Modifying task', 'Information box', 'No form', 'Not Created', 'Refreshing form', 'Assignee task', 'Attach File', 'Spinner'];
const showHeaderTask = 'Show Header';
let appModel;
const pngFile = new FileModel({
'location': browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location,
'name': browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
assigneeUserModel = await usersActions.createUser();
processUserModel = await usersActions.createUser(new UserModel({ tenantId: assigneeUserModel.tenantId }));
await apiService.login(processUserModel.username, processUserModel.password);
appModel = await applicationsService.importPublishDeployApp(app.file_path);
await loginPage.login(processUserModel.username, processUserModel.password);
});
it('[C263942] Should be possible to modify a task', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(appModel.name)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(tasks[0]);
await task.selectForm(app.formName);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
const taskDetails = await taskPage.taskDetails();
await taskDetails.clickInvolvePeopleButton();
await taskDetails.typeUser(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.selectUserToInvolve(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.checkUserIsSelected(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.clickAddInvolvedUserButton();
await expect(await taskPage.taskDetails().getInvolvedUserEmail(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName)
).toEqual(assigneeUserModel.email);
await taskDetails.selectActivityTab();
await taskDetails.addComment(firstComment);
await taskDetails.checkCommentIsDisplayed(firstComment);
const checklistDialog = await taskPage.clickOnAddChecklistButton();
await checklistDialog.addName(firstChecklist);
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(firstChecklist);
await taskPage.taskDetails().selectDetailsTab();
});
it('[C263947] Should be able to start a task without form', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(appModel.name)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(tasks[2]);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[2]);
await taskPage.formFields().noFormIsDisplayed();
await taskPage.taskDetails().waitFormNameEqual(CONSTANTS.TASK_DETAILS.NO_FORM);
});
it('[C263948] Should be possible to cancel a task', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(appModel.name)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(tasks[3]);
await task.checkStartButtonIsEnabled();
await task.clickCancelButton();
await taskPage.tasksListPage().checkContentIsNotDisplayed(tasks[3]);
await expect(await taskPage.filtersPage().getActiveFilter()).toEqual(CONSTANTS.TASK_FILTERS.MY_TASKS);
});
it('[C263949] Should be possible to save filled form', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(appModel.name)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.selectForm(app.formName);
await task.addName(tasks[4]);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
await taskPage.formFields().setFieldValue(by.id, formTextField, formFieldValue);
await taskPage.formFields().refreshForm();
await taskPage.formFields().checkFieldValue(by.id, formTextField, '');
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
await taskPage.formFields().setFieldValue(by.id, formTextField, formFieldValue);
await taskPage.formFields().checkFieldValue(by.id, formTextField, formFieldValue);
await taskPage.formFields().saveForm();
await taskPage.formFields().checkFieldValue(by.id, formTextField, formFieldValue);
});
it('[C263951] Should be possible to assign a user', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(appModel.name)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(tasks[5]);
await task.addAssignee(assigneeUserModel.firstName);
await task.clickStartButton();
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[5]);
await taskPage.tasksListPage().selectRow(tasks[5]);
await taskPage.checkTaskTitle(tasks[5]);
await expect(await taskPage.taskDetails().getAssignee()).toEqual(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
});
it('Attach a file', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(appModel.name)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(tasks[6]);
await task.clickStartButton();
await attachmentListPage.clickAttachFileButton(pngFile.location);
await attachmentListPage.checkFileIsAttached(pngFile.name);
});
it('[C263945] Should Information box be hidden when showHeaderContent property is set on false on custom app', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(appModel.name)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(showHeaderTask);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(showHeaderTask);
await processServiceTabBarPage.clickSettingsButton();
await taskPage.taskDetails().appSettingsToggles().disableShowHeader();
await processServiceTabBarPage.clickTasksButton();
await taskPage.taskDetails().taskInfoDrawerIsNotDisplayed();
await processServiceTabBarPage.clickSettingsButton();
await taskPage.taskDetails().appSettingsToggles().enableShowHeader();
await processServiceTabBarPage.clickTasksButton();
await taskPage.taskDetails().taskInfoDrawerIsDisplayed();
});
});

View File

@@ -0,0 +1,195 @@
/*!
* @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 { ApiService, LoginPage, StringUtil, UserModel, UsersActions } from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { AttachmentListPage } from './../pages/attachment-list.page';
import { ChecklistDialog } from './../pages/dialog/create-checklist-dialog.page';
import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.page';
import { TasksPage } from './../pages/tasks.page';
import * as fs from 'fs';
import * as path from 'path';
import { TaskRepresentation } from '@alfresco/js-api';
import CONSTANTS = require('../../util/constants');
describe('Start Task - Task App', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const attachmentListPage = new AttachmentListPage();
const processServiceTabBarPage = new ProcessServiceTabBarPage();
const navigationBarPage = new NavigationBarPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
let processUserModel, assigneeUserModel;
const formTextField = app.form_fields.form_fieldId;
const formFieldValue = 'First value ';
const taskPage = new TasksPage();
const firstComment = 'comm1', firstChecklist = 'checklist1';
const taskName255Characters = StringUtil.generateRandomString(255);
const taskNameBiggerThen255Characters = StringUtil.generateRandomString(256);
const lengthValidationError = 'Length exceeded, 255 characters max.';
const tasks = ['Modifying task', 'Information box', 'No form', 'Not Created', 'Refreshing form', 'Assignee task', 'Attach File'];
const showHeaderTask = 'Show Header';
const jpgFile = new FileModel({
'location': browser.params.resources.Files.ADF_DOCUMENTS.JPG.file_location,
'name': browser.params.resources.Files.ADF_DOCUMENTS.JPG.file_name
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
assigneeUserModel = await usersActions.createUser();
processUserModel = await usersActions.createUser(new UserModel({ tenantId: assigneeUserModel.tenantId }));
const pathFile = path.join(browser.params.testConfig.main.rootPath + app.file_location);
const file = fs.createReadStream(pathFile);
await apiService.login(processUserModel.username, processUserModel.password);
await apiService.getInstance().activiti.appsApi.importAppDefinition(file);
await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: showHeaderTask }));
await loginPage.login(processUserModel.username, processUserModel.password);
});
beforeEach(async () => {
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
});
it('[C260383] Should be possible to modify a task', async () => {
const task = await taskPage.createNewTask();
await task.addName(tasks[0]);
await task.selectForm(app.formName);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
const taskDetails = await taskPage.taskDetails();
await taskDetails.clickInvolvePeopleButton();
await taskDetails.typeUser(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.selectUserToInvolve(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.checkUserIsSelected(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskPage.taskDetails().clickAddInvolvedUserButton();
await expect(await taskPage.taskDetails().getInvolvedUserEmail(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName))
.toEqual(assigneeUserModel.email);
await taskDetails.selectActivityTab();
await taskDetails.addComment(firstComment);
await taskDetails.checkCommentIsDisplayed(firstComment);
await (await taskPage.clickOnAddChecklistButton()).addName(firstChecklist);
const checklistDialog = new ChecklistDialog();
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(firstChecklist);
await taskPage.taskDetails().selectDetailsTab();
});
it('[C260422] Should be possible to cancel a task', async () => {
const task = await taskPage.createNewTask();
await task.addName(tasks[3]);
await task.checkStartButtonIsEnabled();
await task.clickCancelButton();
await taskPage.tasksListPage().checkContentIsNotDisplayed(tasks[3]);
await expect(await taskPage.filtersPage().getActiveFilter()).toEqual(CONSTANTS.TASK_FILTERS.MY_TASKS);
});
it('[C260423] Should be possible to save filled form', async () => {
const task = await taskPage.createNewTask();
await task.selectForm(app.formName);
await task.addName(tasks[4]);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
const formFields = await taskPage.formFields();
await formFields.setFieldValue(by.id, formTextField, formFieldValue);
await formFields.refreshForm();
await formFields.checkFieldValue(by.id, formTextField, '');
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
await formFields.setFieldValue(by.id, formTextField, formFieldValue);
await formFields.checkFieldValue(by.id, formTextField, formFieldValue);
await taskPage.formFields().saveForm();
await formFields.checkFieldValue(by.id, formTextField, formFieldValue);
});
it('[C260425] Should be possible to assign a user', async () => {
const task = await taskPage.createNewTask();
await task.addName(tasks[5]);
await task.addAssignee(assigneeUserModel.firstName);
await task.clickStartButton();
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[5]);
await taskPage.tasksListPage().selectRow(tasks[5]);
await taskPage.checkTaskTitle(tasks[5]);
await expect(await taskPage.taskDetails().getAssignee()).toEqual(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
});
it('Attach a file', async () => {
const startTaskDialog = await taskPage.createNewTask();
await startTaskDialog.addName(tasks[6]);
await startTaskDialog.clickStartButton();
await attachmentListPage.clickAttachFileButton(jpgFile.location);
await attachmentListPage.checkFileIsAttached(jpgFile.name);
});
it('[C260420] Should Information box be hidden when showHeaderContent property is set on false', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(showHeaderTask);
await processServiceTabBarPage.clickSettingsButton();
await taskPage.taskDetails().appSettingsToggles().disableShowHeader();
await processServiceTabBarPage.clickTasksButton();
await taskPage.taskDetails().taskInfoDrawerIsNotDisplayed();
await processServiceTabBarPage.clickSettingsButton();
await taskPage.taskDetails().appSettingsToggles().enableShowHeader();
await processServiceTabBarPage.clickTasksButton();
await taskPage.taskDetails().taskInfoDrawerIsDisplayed();
});
it('[C291780] Should be displayed an error message if task name exceed 255 characters', async () => {
const startDialog = await taskPage.createNewTask();
await startDialog.addName(taskName255Characters);
await startDialog.checkStartButtonIsEnabled();
await startDialog.addName(taskNameBiggerThen255Characters);
await startDialog.blur(startDialog.name);
await startDialog.checkValidationErrorIsDisplayed(lengthValidationError);
await startDialog.checkStartButtonIsDisabled();
});
});

View File

@@ -0,0 +1,273 @@
/*!
* @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 {
ApiService,
ApplicationsUtil,
LoginPage,
ProcessUtil,
StartProcessPage,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ProcessServicesPage } from './../pages/process-services.page';
import { ProcessFiltersPage } from './../pages/process-filters.page';
import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.page';
import { ProcessDetailsPage } from './../pages/process-details.page';
import { ProcessListPage } from './../pages/process-list.page';
import { browser } from 'protractor';
import { TasksPage } from './../pages/tasks.page';
import CONSTANTS = require('../../util/constants');
describe('Task Assignee', () => {
const app = browser.params.resources.Files.TEST_ASSIGNEE;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const processServicesPage = new ProcessServicesPage();
const processListPage = new ProcessListPage();
const processFiltersPage = new ProcessFiltersPage();
const startProcessPage = new StartProcessPage();
const processServiceTabBarPage = new ProcessServiceTabBarPage();
const processDetailsPage = new ProcessDetailsPage();
const taskPage = new TasksPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
const applicationsService = new ApplicationsUtil(apiService);
describe('Candidate User Assignee', () => {
let user: UserModel;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser(new UserModel({
firstName: app.candidate.firstName,
lastName: app.candidate.lastName
}));
try {// creates group if not available
await apiService.getInstance().activiti.adminGroupsApi.createNewGroup({
'name': app.candidateGroup,
'tenantId': user.tenantId,
'type': 1
});
} catch (e) {
}
await apiService.login(user.username, user.password);
await applicationsService.importPublishDeployApp(app.file_path, { renewIdmEntries: true });
await loginPage.login(user.username, user.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(user.tenantId);
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
});
it('[C260387] Should the running process be displayed when clicking on Running filter', async () => {
const name = 'sample-process-one';
await processServicesPage.goToApp(app.title);
await processServiceTabBarPage.clickProcessButton();
await expect(await processListPage.isProcessListDisplayed()).toEqual(true);
await processFiltersPage.clickCreateProcessButton();
await processFiltersPage.clickNewProcessDropdown();
await startProcessPage.startProcess(name, app.processNames[0]);
await processFiltersPage.selectFromProcessList(name);
await processDetailsPage.activeTask.click();
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.simple.one);
await taskPage.tasksListPage().selectRow(app.userTasks.simple.one);
await taskPage.taskDetails().clickCompleteFormTask();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.simple.one);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.simple.one);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.simple.one);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.taskDetails().clickCompleteFormTask();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.simple.two);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.simple.two);
});
});
describe('Candidate Group Assignee', () => {
let user: UserModel;
let candidate1: UserModel;
let candidate2: UserModel;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
candidate1 = await usersActions.createUser(new UserModel({ tenantId: user.tenantId }));
candidate2 = await usersActions.createUser(new UserModel({ tenantId: user.tenantId }));
const adminGroup = await apiService.getInstance().activiti.adminGroupsApi.createNewGroup(
{ 'name': app.adminGroup, 'tenantId': user.tenantId }
);
await apiService.getInstance().activiti.adminGroupsApi.addGroupMember(adminGroup.id, user.id);
await apiService.getInstance().activiti.adminGroupsApi.addGroupCapabilities(adminGroup.id, { capabilities: app.adminCapabilities });
const candidateGroup = await apiService.getInstance().activiti.adminGroupsApi.createNewGroup(
{ 'name': app.candidateGroup, 'tenantId': user.tenantId, 'type': 1 }
);
await apiService.getInstance().activiti.adminGroupsApi.addGroupMember(candidateGroup.id, candidate1.id);
await apiService.getInstance().activiti.adminGroupsApi.addGroupMember(candidateGroup.id, candidate2.id);
await apiService.getInstance().activiti.adminGroupsApi.addGroupMember(candidateGroup.id, user.id);
try {// for creates user if not available
await usersActions.createUser(new UserModel({
tenantId: user.tenantId,
firstName: app.candidate.firstName,
lastName: app.candidate.lastName
}));
} catch (e) {
}
await apiService.login(user.username, user.password);
const appModel = await applicationsService.importPublishDeployApp(app.file_path, { renewIdmEntries: true });
await new ProcessUtil(apiService).startProcessByDefinitionName(appModel.name, app.processNames[1]);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(user.tenantId);
});
it('[C216430] Start Task - Claim and Requeue a task', async () => {
await loginPage.login(candidate1.username, candidate1.password);
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
await processServicesPage.goToApp('Task App');
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.candidateTask);
await taskPage.tasksListPage().selectRow(app.userTasks.candidateTask);
await taskPage.taskDetails().checkClaimEnabled();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.candidateTask);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.candidateTask);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.candidateTask);
await taskPage.tasksListPage().selectRow(app.userTasks.candidateTask);
await taskPage.taskDetails().claimTask();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.candidateTask);
await taskPage.taskDetails().checkReleaseEnabled();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.candidateTask);
await taskPage.taskDetails().checkReleaseEnabled();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.candidateTask);
await navigationBarPage.clickLogoutButton();
await loginPage.login(candidate2.username, candidate2.password);
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
await processServicesPage.goToApp('Task App');
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.candidateTask);
await navigationBarPage.clickLogoutButton();
await loginPage.login(candidate1.username, candidate1.password);
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
await processServicesPage.goToApp('Task App');
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.candidateTask);
await taskPage.tasksListPage().selectRow(app.userTasks.candidateTask);
await taskPage.taskDetails().releaseTask();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.candidateTask);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsNotDisplayed(app.userTasks.candidateTask);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.candidateTask);
await taskPage.taskDetails().checkClaimEnabled();
await navigationBarPage.clickLogoutButton();
await loginPage.login(candidate2.username, candidate2.password);
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
await processServicesPage.goToApp('Task App');
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.filtersPage().checkFilterIsHighlighted(CONSTANTS.TASK_FILTERS.QUE_TASKS);
await taskPage.tasksListPage().checkTaskListIsLoaded();
await taskPage.tasksListPage().checkContentIsDisplayed(app.userTasks.candidateTask);
await taskPage.taskDetails().checkClaimEnabled();
});
});
});

View File

@@ -0,0 +1,193 @@
/*!
* @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 {
ApiService,
ApplicationsUtil,
FileBrowserUtil,
LoginPage,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksPage } from './../pages/tasks.page';
import { AttachmentListPage } from './../pages/attachment-list.page';
import * as fs from 'fs';
import * as path from 'path';
import { FileModel } from '../../models/ACS/file.model';
import { TaskRepresentation } from '@alfresco/js-api';
import CONSTANTS = require('../../util/constants');
describe('Attachment list action menu for tasks', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const taskPage = new TasksPage();
const attachmentListPage = new AttachmentListPage();
const viewerPage = new ViewerPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
const pngFile = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location,
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name
});
const downloadedPngFile = pngFile.name;
let tenantId, appId, relatedContent, relatedContentId;
const taskName = {
active: 'Active Task',
completed: 'Completed Task',
taskApp: 'Task App Name',
emptyList: 'Empty List'
};
beforeAll(async () => {
await apiService.loginWithProfile('admin');
const user = await usersActions.createUser();
tenantId = user.tenantId;
await apiService.login(user.username, user.password);
const applicationsService = new ApplicationsUtil(apiService);
const { id } = await applicationsService.importPublishDeployApp(app.file_path);
appId = id;
await loginPage.login(user.username, user.password);
});
afterAll(async () => {
await apiService.getInstance().activiti.modelsApi.deleteModel(appId);
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(tenantId);
});
it('[C277311] Should be able to View /Download /Remove from Attachment List on an active task', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(app.title)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.createTask({ name: taskName.active });
await attachmentListPage.clickAttachFileButton(pngFile.location);
await attachmentListPage.viewFile(pngFile.name);
await viewerPage.checkFileNameIsDisplayed(pngFile.name);
await viewerPage.clickCloseButton();
await attachmentListPage.doubleClickFile(pngFile.name);
await viewerPage.checkFileNameIsDisplayed(pngFile.name);
await viewerPage.clickCloseButton();
await attachmentListPage.downloadFile(pngFile.name);
await browser.sleep(1000);
await FileBrowserUtil.isFileDownloaded(downloadedPngFile);
await attachmentListPage.removeFile(pngFile.name);
await attachmentListPage.checkFileIsRemoved(pngFile.name);
});
it('[C260236] Should be able to View /Download /Remove from Attachment List on a completed task', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(app.title)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(taskName.completed);
await task.clickStartButton();
await attachmentListPage.clickAttachFileButton(pngFile.location);
await attachmentListPage.checkFileIsAttached(pngFile.name);
await taskPage.completeTaskNoForm();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().selectRow(taskName.completed);
await attachmentListPage.checkAttachFileButtonIsNotDisplayed();
await attachmentListPage.viewFile(pngFile.name);
await viewerPage.checkFileNameIsDisplayed(pngFile.name);
await viewerPage.clickCloseButton();
await attachmentListPage.downloadFile(pngFile.name);
await browser.sleep(1000);
await FileBrowserUtil.isFileDownloaded(downloadedPngFile);
await attachmentListPage.removeFile(pngFile.name);
await attachmentListPage.checkFileIsRemoved(pngFile.name);
});
it('[C260225] Should be able to upload a file in the Attachment list on Task App', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(app.title)).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(taskName.taskApp);
await task.clickStartButton();
await attachmentListPage.clickAttachFileButton(pngFile.location);
await attachmentListPage.checkFileIsAttached(pngFile.name);
});
it('[C279884] Should be able to view the empty attachment list for tasks', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(taskName.emptyList);
await task.clickStartButton();
await attachmentListPage.checkEmptyAttachmentList();
await attachmentListPage.clickAttachFileButton(pngFile.location);
await attachmentListPage.checkFileIsAttached(pngFile.name);
await attachmentListPage.removeFile(pngFile.name);
await attachmentListPage.checkFileIsRemoved(pngFile.name);
await attachmentListPage.checkEmptyAttachmentList();
});
it('[C260234] Should be able to attache a file on a task on APS and check on ADF', async () => {
const newTask = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: 'SHARE KNOWLEDGE' }));
const newTaskId = newTask.id;
const filePath = path.join(browser.params.testConfig.main.rootPath + pngFile.location);
const file = fs.createReadStream(filePath);
relatedContent = await apiService.getInstance().activiti.contentApi.createRelatedContentOnTask(newTaskId, file, { 'isRelatedContent': true });
relatedContentId = relatedContent.id;
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().selectRow('SHARE KNOWLEDGE');
await attachmentListPage.checkFileIsAttached(pngFile.name);
await apiService.getInstance().activiti.contentApi.deleteContent(relatedContentId);
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().selectRow('SHARE KNOWLEDGE');
await attachmentListPage.checkEmptyAttachmentList();
});
});

View File

@@ -0,0 +1,117 @@
/*!
* @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 { LoginPage, BrowserActions, FileBrowserUtil, ApplicationsUtil, ApiService, UsersActions } from '@alfresco/adf-testing';
import { TasksPage } from './../pages/tasks.page';
import { ProcessServicesPage } from './../pages/process-services.page';
import CONSTANTS = require('../../util/constants');
import { browser } from 'protractor';
import { TaskRepresentation } from '@alfresco/js-api';
describe('Task Audit', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const taskPage = new TasksPage();
const processServices = new ProcessServicesPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
let processUserModel;
const taskTaskApp = 'Audit task task app';
const taskCustomApp = 'Audit task custom app';
const taskCompleteCustomApp = 'Audit completed task custom app';
const auditLogFile = 'Audit.pdf';
beforeAll(async () => {
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: taskTaskApp }));
const applicationsService = new ApplicationsUtil(apiService);
await applicationsService.importPublishDeployApp(app.file_path);
await loginPage.login(processUserModel.username, processUserModel.password);
});
afterAll( async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
});
beforeEach(async () => {
await BrowserActions.getUrl(browser.baseUrl + '/activiti');
});
it('[C260386] Should Audit file be downloaded when clicking on Task Audit log icon on a standalone running task', async () => {
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(taskTaskApp);
await taskPage.taskDetails().clickAuditLogButton();
await FileBrowserUtil.isFileDownloaded(auditLogFile);
});
it('[C260389] Should Audit file be downloaded when clicking on Task Audit log icon on a standalone completed task', async () => {
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(taskTaskApp);
await taskPage.completeTaskNoForm();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().selectRow(taskTaskApp);
await expect(await taskPage.formFields().getCompletedTaskNoFormMessage()).toEqual('Task ' + taskTaskApp + ' completed');
await taskPage.taskDetails().clickAuditLogButton();
await FileBrowserUtil.isFileDownloaded(auditLogFile);
});
it('[C263944] Should Audit file be downloaded when clicking on Task Audit log icon on a custom app standalone completed task', async () => {
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.createTask({name: taskCompleteCustomApp});
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(taskCompleteCustomApp);
await taskPage.completeTaskNoForm();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().selectRow(taskCompleteCustomApp);
await expect(await taskPage.formFields().getCompletedTaskNoFormMessage()).toEqual('Task ' + taskCompleteCustomApp + ' completed');
await taskPage.taskDetails().clickAuditLogButton();
await FileBrowserUtil.isFileDownloaded(auditLogFile);
});
it('[C263943] Should Audit file be downloaded when clicking on Task Audit log icon on a custom app standalone running task', async () => {
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.createTask({name: taskCustomApp});
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(taskCustomApp);
await taskPage.taskDetails().clickAuditLogButton();
await FileBrowserUtil.isFileDownloaded(auditLogFile);
});
});

View File

@@ -0,0 +1,416 @@
/*!
* @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 {
ApiService,
ApplicationsUtil,
LoginPage,
ProcessUtil,
StringUtil,
UsersActions,
Widget
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { FormModelActions } from '../../actions/APS/form-model.actions';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FiltersPage } from './../pages/filters.page';
import { TaskDetailsPage } from './../pages/task-details.page';
import { TasksListPage } from './../pages/tasks-list.page';
import { TasksPage } from './../pages/tasks.page';
import { AttachFormPage } from './../pages/attach-form.page';
import { TaskRepresentation } from '@alfresco/js-api';
import CONSTANTS = require('../../util/constants');
describe('Task Details - Form', () => {
const loginPage = new LoginPage();
const tasksListPage = new TasksListPage();
const taskDetailsPage = new TaskDetailsPage();
const attachFormPage = new AttachFormPage();
const taskPage = new TasksPage();
const filtersPage = new FiltersPage();
const widget = new Widget();
const apiService = new ApiService();
const formActions = new FormModelActions(apiService);
const usersActions = new UsersActions(apiService);
const applicationsService = new ApplicationsUtil(apiService);
let task, otherTask, user, newForm, attachedForm, otherAttachedForm;
beforeAll(async () => {
const attachedFormModel = {
'name': StringUtil.generateRandomString(),
'description': '',
'modelType': 2,
'stencilSet': 0
};
const otherAttachedFormModel = {
'name': StringUtil.generateRandomString(),
'description': '',
'modelType': 2,
'stencilSet': 0
};
const newFormModel = {
'name': StringUtil.generateRandomString(),
'description': '',
'modelType': 2,
'stencilSet': 0
};
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
await apiService.login(user.username, user.password);
attachedForm = await apiService.getInstance().activiti.modelsApi.createModel(attachedFormModel);
newForm = await apiService.getInstance().activiti.modelsApi.createModel(newFormModel);
const otherEmptyTask = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: StringUtil.generateRandomString() }));
otherAttachedForm = await apiService.getInstance().activiti.modelsApi.createModel(otherAttachedFormModel);
await apiService.getInstance().activiti.taskApi.attachForm(otherEmptyTask.id, { 'formId': otherAttachedForm.id });
otherTask = await apiService.getInstance().activiti.taskApi.getTask(otherEmptyTask.id);
await loginPage.login(user.username, user.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(user.tenantId);
});
beforeEach(async () => {
const emptyTask = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: StringUtil.generateRandomString() }));
await apiService.getInstance().activiti.taskApi.attachForm(emptyTask.id, { 'formId': attachedForm.id });
task = await apiService.getInstance().activiti.taskApi.getTask(emptyTask.id);
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp();
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await tasksListPage.checkTaskListIsLoaded();
});
it('[C280018] Should be able to change the form in a task', async () => {
await tasksListPage.selectRow(task.name);
await taskDetailsPage.clickForm();
await attachFormPage.checkFormDropdownIsDisplayed();
await attachFormPage.checkAttachFormButtonIsDisabled();
await attachFormPage.selectAttachFormOption(newForm.name);
await taskDetailsPage.checkSelectedForm(newForm.name);
await attachFormPage.checkAttachFormButtonIsDisplayed();
await attachFormPage.checkCancelButtonIsDisplayed();
await attachFormPage.clickCancelButton();
await taskDetailsPage.checkFormIsAttached(attachedForm.name);
await taskDetailsPage.clickForm();
await attachFormPage.checkFormDropdownIsDisplayed();
await attachFormPage.checkAttachFormButtonIsDisabled();
await attachFormPage.selectAttachFormOption(newForm.name);
await taskDetailsPage.checkSelectedForm(newForm.name);
await attachFormPage.checkAttachFormButtonIsDisplayed();
await attachFormPage.clickAttachFormButton();
await taskDetailsPage.checkFormIsAttached(newForm.name);
});
it('[C280019] Should be able to remove the form form a task', async () => {
await tasksListPage.selectRow(task.name);
await taskDetailsPage.clickForm();
await taskDetailsPage.checkRemoveAttachFormIsDisplayed();
await taskDetailsPage.clickRemoveAttachForm();
await taskDetailsPage.checkFormIsAttached('No form');
await taskDetailsPage.waitFormNameEqual(CONSTANTS.TASK_DETAILS.NO_FORM);
});
it('[C280557] Should display task details when selecting another task while the Attach Form dialog is displayed', async () => {
await tasksListPage.selectRow(task.name);
await taskDetailsPage.clickForm();
await taskDetailsPage.checkRemoveAttachFormIsDisplayed();
await tasksListPage.selectRow(otherTask.name);
await taskDetailsPage.checkFormIsAttached(otherAttachedForm.name);
});
describe('Task Details - Complete form with visibility conditions on tabs', () => {
const widgets = {
textOneId: 'textone',
textTwoId: 'texttwo',
textThreeId: 'textthree',
textFourId: 'textfour',
numberOneId: 'numberone'
};
const value = {
displayTab: 'showTab',
notDisplayTab: 'anythingElse'
};
const tab = {
tabWithFields: 'tabWithFields',
tabFieldValue: 'tabBasicFieldValue',
tabFieldField: 'tabBasicFieldField',
tabFieldVar: 'tabBasicFieldVar'
};
let app, newTask;
beforeAll(async () => {
app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
await applicationsService.importPublishDeployApp(app.file_path);
});
beforeEach(async () => {
newTask = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: StringUtil.generateRandomString() }));
const form = await formActions.getFormByName(app.visibilityProcess.formName);
await apiService.getInstance().activiti.taskApi.attachForm(newTask.id, { 'formId': form.id });
await browser.refresh();
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp();
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await tasksListPage.checkTaskListIsLoaded();
});
it('[C315190] Should be able to complete a standalone task with visible tab with empty value for field', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textThreeId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
});
it('[C315191] Should be able to complete a standalone task with invisible tab with empty value for field', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textThreeId);
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
});
it('[C315192] Should not be able to complete a standalone task with visible tab with invalid value for field', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textTwoId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.numberOneId, value.displayTab);
await expect(await taskDetailsPage.isCompleteButtonWithFormEnabled()).toEqual(false);
});
it('[C315193] Should be able to complete a standalone task with invisible tab with invalid value for field', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textTwoId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.numberOneId, value.displayTab);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
});
it('[C315194] Should be able to complete a standalone task with invisible tab with valid value', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textTwoId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.numberOneId, '123');
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
});
it('[C315195] Should be able to complete a standalone task with visible tab with valid value for field', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textTwoId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.numberOneId, '123');
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
});
it('[C315197] Should be able to complete a process task with visible tab with empty value for field', async () => {
await new ProcessUtil(apiService).startProcessByDefinitionName(app.name, app.visibilityProcess.name);
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.selectRow(app.visibilityProcess.taskName);
await expect(await taskDetailsPage.getParentName()).toEqual(app.visibilityProcess.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textTwoId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.numberOneId, '123');
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(app.visibilityProcess.taskName);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(app.visibilityProcess.taskName);
await tasksListPage.selectRow(app.visibilityProcess.taskName);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
});
it('[C212922] Should a User task form be refreshed, saved or completed.', async () => {
await new ProcessUtil(apiService).startProcessByDefinitionName(app.name, app.processName);
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.selectRow(app.taskName);
await expect(await taskDetailsPage.getParentName()).toEqual(app.processName);
await widget.textWidget().isWidgetVisible(app.form_fields.form_fieldId);
await widget.textWidget().setValue(app.form_fields.form_fieldId, 'value');
await taskPage.formFields().refreshForm();
await widget.textWidget().isWidgetVisible(app.form_fields.form_fieldId);
await expect(await widget.textWidget().getFieldValue(app.form_fields.form_fieldId)).toEqual('');
await widget.textWidget().setValue(app.form_fields.form_fieldId, 'value');
await taskPage.taskDetails().saveTaskForm();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await tasksListPage.checkTaskListIsLoaded();
await expect(await widget.textWidget().getFieldValue(app.form_fields.form_fieldId)).toEqual('value');
await taskDetailsPage.clickCompleteFormTask();
});
});
});

View File

@@ -0,0 +1,68 @@
/*!
* @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 { ApiService, ApplicationsUtil, LoginPage, ProcessUtil, UsersActions } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksPage } from './../pages/tasks.page';
import { browser } from 'protractor';
import CONSTANTS = require('../../util/constants');
describe('Task Details - No form', () => {
const app = browser.params.resources.Files.NO_FORM_APP;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const apiService = new ApiService();
let processUserModel;
const taskPage = new TasksPage();
const noFormMessage = 'No forms attached';
let importedApp;
beforeAll(async () => {
const usersActions = new UsersActions(apiService);
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
const applicationsService = new ApplicationsUtil(apiService);
importedApp = await applicationsService.importPublishDeployApp(app.file_path);
await new ProcessUtil(apiService).startProcessOfApp(importedApp.name);
await loginPage.login(processUserModel.username, processUserModel.password);
});
afterAll( async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
});
it('[C289311] Should attach form and complete buttons to be displayed when no form is attached', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(app.taskName);
await taskPage.tasksListPage().selectRow(app.taskName);
await taskPage.taskDetails().noFormIsDisplayed();
await taskPage.taskDetails().checkCompleteTaskButtonIsDisplayed();
await taskPage.taskDetails().checkCompleteTaskButtonIsEnabled();
await taskPage.taskDetails().checkAttachFormButtonIsNotDisplayed();
await taskPage.taskDetails().waitFormNameEqual(CONSTANTS.TASK_DETAILS.NO_FORM);
await expect(await taskPage.formFields().getNoFormMessage()).toEqual(noFormMessage);
});
});

View File

@@ -0,0 +1,329 @@
/*!
* @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 {
ApiService,
ApplicationsUtil,
BrowserActions,
LoginPage,
ProcessUtil,
StringUtil,
UsersActions
} from '@alfresco/adf-testing';
import { ProcessServicesPage } from './../pages/process-services.page';
import { TasksPage } from './../pages/tasks.page';
import { browser } from 'protractor';
import { TaskRepresentation } from '@alfresco/js-api';
import Task = require('../../models/APS/Task');
import TaskModel = require('../../models/APS/TaskModel');
import FormModel = require('../../models/APS/FormModel');
import CONSTANTS = require('../../util/constants');
import moment = require('moment');
describe('Task Details component', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const processServices = new ProcessServicesPage();
const loginPage = new LoginPage();
const taskPage = new TasksPage();
const apiService = new ApiService();
let processUserModel, appModel;
const tasks = ['Modifying task', 'Information box', 'No form', 'Not Created', 'Refreshing form', 'Assignee task', 'Attach File'];
const TASK_DATE_FORMAT = 'll';
let formModel;
const taskFormModel = {
'name': StringUtil.generateRandomString(),
'description': '',
'modelType': 2,
'stencilSet': 0
};
beforeAll(async () => {
const usersActions = new UsersActions(apiService);
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
const applicationsService = new ApplicationsUtil(apiService);
appModel = await applicationsService.importPublishDeployApp(app.file_path);
await loginPage.login(processUserModel.username, processUserModel.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
});
beforeEach(async () => {
await BrowserActions.getUrl(browser.baseUrl + '/activiti');
});
it('[C260506] Should display task details for standalone task - Task App', async () => {
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.createTask({ name: tasks[1], description: 'Description', formName: app.formName });
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
const taskModel = new TaskModel(allTasks.data[0]);
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
await expect(await taskPage.taskDetails().getCreated()).toEqual(moment(taskModel.getCreated()).format(TASK_DATE_FORMAT));
await expect(await taskPage.taskDetails().getId()).toEqual(taskModel.getId());
await expect(await taskPage.taskDetails().getDescription()).toEqual(taskModel.getDescription());
await expect(await taskPage.taskDetails().getAssignee()).toEqual(taskModel.getAssignee().getEntireName());
await expect(await taskPage.taskDetails().getCategory()).toEqual(CONSTANTS.TASK_DETAILS.NO_CATEGORY);
await expect(await taskPage.taskDetails().getDueDate()).toEqual(CONSTANTS.TASK_DETAILS.NO_DATE);
await expect(await taskPage.taskDetails().getParentName()).toEqual(CONSTANTS.TASK_DETAILS.NO_PARENT);
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');
await expect(await taskPage.taskDetails().getDuration()).toEqual('');
await expect(await taskPage.taskDetails().getEndDate()).toEqual('');
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
const taskForm = await apiService.getInstance().activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
formModel = new FormModel(taskForm);
await taskPage.taskDetails().waitFormNameEqual(formModel.getName());
});
it('[C263946] Should display task details for standalone task - Custom App', async () => {
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.createTask({ name: tasks[1], description: 'Description', formName: app.formName });
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
const taskModel = new TaskModel(allTasks.data[0]);
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
await expect(await taskPage.taskDetails().getCreated()).toEqual(moment(taskModel.getCreated()).format(TASK_DATE_FORMAT));
await expect(await taskPage.taskDetails().getId()).toEqual(taskModel.getId());
await expect(await taskPage.taskDetails().getDescription()).toEqual(taskModel.getDescription());
await expect(await taskPage.taskDetails().getAssignee()).toEqual(taskModel.getAssignee().getEntireName());
await expect(await taskPage.taskDetails().getCategory()).toEqual(CONSTANTS.TASK_DETAILS.NO_CATEGORY);
await expect(await taskPage.taskDetails().getDueDate()).toEqual(CONSTANTS.TASK_DETAILS.NO_DATE);
await expect(await taskPage.taskDetails().getParentName()).toEqual(CONSTANTS.TASK_DETAILS.NO_PARENT);
await expect(await taskPage.taskDetails().getDuration()).toEqual('');
await expect(await taskPage.taskDetails().getEndDate()).toEqual('');
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
const taskForm = await apiService.getInstance().activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
formModel = new FormModel(taskForm);
await taskPage.taskDetails().waitFormNameEqual(formModel.getName());
});
it('[C286706] Should display task details for task - Task App', async () => {
await new ProcessUtil(apiService).startProcessOfApp(appModel.name);
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
const taskModel = new TaskModel(allTasks.data[0]);
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
await expect(await taskPage.taskDetails().getCreated()).toEqual(moment(taskModel.getCreated()).format(TASK_DATE_FORMAT));
await expect(await taskPage.taskDetails().getId()).toEqual(taskModel.getId());
await expect(await taskPage.taskDetails().getDescription()).toEqual(CONSTANTS.TASK_DETAILS.NO_DESCRIPTION);
await expect(await taskPage.taskDetails().getAssignee()).toEqual(taskModel.getAssignee().getEntireName());
await expect(await taskPage.taskDetails().getCategory()).toEqual(CONSTANTS.TASK_DETAILS.NO_CATEGORY);
await expect(await taskPage.taskDetails().getDueDate()).toEqual(CONSTANTS.TASK_DETAILS.NO_DATE);
await expect(await taskPage.taskDetails().getParentName()).toEqual(appModel.definition.models[1].name);
await expect(await taskPage.taskDetails().getDuration()).toEqual('');
await expect(await taskPage.taskDetails().getEndDate()).toEqual('');
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
const taskForm = await apiService.getInstance().activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
formModel = new FormModel(taskForm);
await taskPage.taskDetails().waitFormNameEqual(formModel.getName());
});
it('[C286705] Should display task details for task - Custom App', async () => {
await new ProcessUtil(apiService).startProcessOfApp(appModel.name);
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
const taskModel = new TaskModel(allTasks.data[0]);
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
await expect(await taskPage.taskDetails().getCreated()).toEqual(moment(taskModel.getCreated()).format(TASK_DATE_FORMAT));
await expect(await taskPage.taskDetails().getId()).toEqual(taskModel.getId());
await expect(await taskPage.taskDetails().getDescription()).toEqual(CONSTANTS.TASK_DETAILS.NO_DESCRIPTION);
await expect(await taskPage.taskDetails().getAssignee()).toEqual(taskModel.getAssignee().getEntireName());
await expect(await taskPage.taskDetails().getCategory()).toEqual(CONSTANTS.TASK_DETAILS.NO_CATEGORY);
await expect(await taskPage.taskDetails().getDueDate()).toEqual(CONSTANTS.TASK_DETAILS.NO_DATE);
await expect(await taskPage.taskDetails().getParentName()).toEqual(appModel.definition.models[1].name);
await expect(await taskPage.taskDetails().getDuration()).toEqual('');
await expect(await taskPage.taskDetails().getEndDate()).toEqual('');
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
const taskForm = await apiService.getInstance().activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
formModel = new FormModel(taskForm);
await taskPage.taskDetails().waitFormNameEqual(formModel.getName());
});
it('[C286708] Should display task details for subtask - Task App', async () => {
const taskName = 'TaskAppSubtask';
const checklistName = 'TaskAppChecklist';
await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ 'name': taskName }));
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(taskName);
await taskPage.tasksListPage().selectRow(taskName);
const dialog = await taskPage.clickOnAddChecklistButton();
await dialog.addName(checklistName);
await dialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(checklistName);
await taskPage.tasksListPage().checkContentIsDisplayed(checklistName);
await taskPage.tasksListPage().selectRow(checklistName);
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
const taskModel = new TaskModel(allTasks.data[0]);
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
await expect(await taskPage.taskDetails().getCreated()).toEqual(moment(taskModel.getCreated()).format(TASK_DATE_FORMAT));
await expect(await taskPage.taskDetails().getId()).toEqual(taskModel.getId());
await expect(await taskPage.taskDetails().getDescription()).toEqual(CONSTANTS.TASK_DETAILS.NO_DESCRIPTION);
await expect(await taskPage.taskDetails().getAssignee()).toEqual(taskModel.getAssignee().getEntireName());
await expect(await taskPage.taskDetails().getCategory()).toEqual(CONSTANTS.TASK_DETAILS.NO_CATEGORY);
await expect(await taskPage.taskDetails().getDueDate()).toEqual(CONSTANTS.TASK_DETAILS.NO_DATE);
await expect(await taskPage.taskDetails().getParentName()).toEqual(CONSTANTS.TASK_DETAILS.NO_PARENT);
await expect(await taskPage.taskDetails().getDuration()).toEqual('');
await expect(await taskPage.taskDetails().getEndDate()).toEqual('');
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual(taskModel.getParentTaskId());
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
});
it('[C286707] Should display task details for subtask - Custom App', async () => {
const checklistName = 'CustomAppChecklist';
await new ProcessUtil(apiService).startProcessOfApp(appModel.name);
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
const dialog = await taskPage.clickOnAddChecklistButton();
await dialog.addName(checklistName);
await dialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(checklistName);
await taskPage.tasksListPage().checkContentIsDisplayed(checklistName);
await taskPage.tasksListPage().selectRow(checklistName);
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
const taskModel = new TaskModel(allTasks.data[0]);
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
await expect(await taskPage.taskDetails().getCreated()).toEqual(moment(taskModel.getCreated()).format(TASK_DATE_FORMAT));
await expect(await taskPage.taskDetails().getId()).toEqual(taskModel.getId());
await expect(await taskPage.taskDetails().getDescription()).toEqual(CONSTANTS.TASK_DETAILS.NO_DESCRIPTION);
await expect(await taskPage.taskDetails().getAssignee()).toEqual(taskModel.getAssignee().getEntireName());
await expect(await taskPage.taskDetails().getCategory()).toEqual(taskModel.getCategory());
await expect(await taskPage.taskDetails().getDueDate()).toEqual(CONSTANTS.TASK_DETAILS.NO_DATE);
await expect(await taskPage.taskDetails().getParentName()).toEqual(CONSTANTS.TASK_DETAILS.NO_PARENT);
await expect(await taskPage.taskDetails().getDuration()).toEqual('');
await expect(await taskPage.taskDetails().getEndDate()).toEqual('');
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual(taskModel.getParentTaskId());
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
});
it('[C286709] Should display task details for completed task - Task App', async () => {
const taskName = 'TaskAppCompleted';
const taskId = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ 'name': taskName }));
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(taskName);
await taskPage.tasksListPage().selectRow(taskName);
await taskPage.completeTaskNoForm();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().selectRow(taskName);
const getTaskResponse = await apiService.getInstance().activiti.taskApi.getTask(taskId.id);
const taskModel = new TaskModel(getTaskResponse);
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
await expect(await taskPage.taskDetails().getCreated()).toEqual(moment(taskModel.getCreated()).format(TASK_DATE_FORMAT));
await expect(await taskPage.taskDetails().getId()).toEqual(taskModel.getId());
await expect(await taskPage.taskDetails().getDescription()).toEqual(CONSTANTS.TASK_DETAILS.NO_DESCRIPTION);
await expect(await taskPage.taskDetails().getAssignee()).toEqual(taskModel.getAssignee().getEntireName());
await expect(await taskPage.taskDetails().getCategory()).toEqual(CONSTANTS.TASK_DETAILS.NO_CATEGORY);
await expect(await taskPage.taskDetails().getDueDate()).toEqual(CONSTANTS.TASK_DETAILS.NO_DATE);
await expect(await taskPage.taskDetails().getParentName()).toEqual(CONSTANTS.TASK_DETAILS.NO_PARENT);
await expect(await taskPage.taskDetails().getDuration()).toEqual(await taskPage.taskDetails().getDuration());
await expect(await taskPage.taskDetails().getEndDate()).toEqual(await taskPage.taskDetails().getEndDate());
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.COMPLETED);
});
it('[C260321] Should not be able to edit a completed task\'s details', async () => {
const taskName = 'TaskCompleted';
const form = await apiService.getInstance().activiti.modelsApi.createModel(taskFormModel);
const task = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ 'name': taskName }));
await apiService.getInstance().activiti.taskApi.attachForm(task.id, { 'formId': form.id });
await apiService.getInstance().activiti.taskApi.completeTaskForm(task.id, { values: { label: null } });
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(taskName);
await taskPage.tasksListPage().selectRow(taskName);
await taskPage.taskDetails().checkEditableAssigneeIsNotDisplayed();
await taskPage.taskDetails().checkEditableFormIsNotDisplayed();
await taskPage.taskDetails().checkDueDatePickerButtonIsNotDisplayed();
});
});

View File

@@ -0,0 +1,257 @@
/*!
* @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 { ApiService, ApplicationsUtil, LoginPage, UserModel, UsersActions } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ProcessServicesPage } from './../pages/process-services.page';
import { TasksPage } from './../pages/tasks.page';
import { TasksListPage } from './../pages/tasks-list.page';
import { TaskDetailsPage } from './../pages/task-details.page';
import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.page';
import { AppSettingsTogglesPage } from './../pages/dialog/app-settings-toggles.page';
import { TaskFiltersDemoPage } from './../pages/task-filters-demo.page';
import { UserProcessInstanceFilterRepresentation } from '@alfresco/js-api';
import { browser } from 'protractor';
describe('Task', () => {
describe('Filters', () => {
const app = browser.params.resources.Files.APP_WITH_DATE_FIELD_FORM;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const processServicesPage = new ProcessServicesPage();
const tasksPage = new TasksPage();
const tasksListPage = new TasksListPage();
const taskDetailsPage = new TaskDetailsPage();
const taskFiltersDemoPage = new TaskFiltersDemoPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
let appId: number, user: UserModel;
beforeEach(async () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
await apiService.login(user.username, user.password);
const applicationsService = new ApplicationsUtil(apiService);
const { id } = await applicationsService.importPublishDeployApp(app.file_path);
appId = id;
await loginPage.login(user.username, user.password);
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
await processServicesPage.goToApp(app.title);
});
afterEach(async () => {
await apiService.getInstance().activiti.modelsApi.deleteModel(appId);
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(user.tenantId);
await navigationBarPage.clickLogoutButton();
});
it('[C279967] Should display default filters when an app is deployed', async () => {
await taskFiltersDemoPage.involvedTasksFilter().checkTaskFilterIsDisplayed();
await taskFiltersDemoPage.myTasksFilter().checkTaskFilterIsDisplayed();
await taskFiltersDemoPage.queuedTasksFilter().checkTaskFilterIsDisplayed();
await taskFiltersDemoPage.completedTasksFilter().checkTaskFilterIsDisplayed();
});
it('[C260330] Should display Task Filter List when app is in Task Tab', async () => {
await tasksPage.createTask({ name: 'Test' });
await taskFiltersDemoPage.myTasksFilter().clickTaskFilter();
await tasksListPage.checkContentIsDisplayed('Test');
await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('My Tasks');
await expect(await taskDetailsPage.checkTaskDetailsDisplayed()).toBeDefined();
await taskFiltersDemoPage.queuedTasksFilter().clickTaskFilter();
await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('Queued Tasks');
await tasksListPage.checkContentIsNotDisplayed('Test');
await expect(await taskDetailsPage.checkTaskDetailsEmpty()).toBeDefined();
await taskFiltersDemoPage.involvedTasksFilter().clickTaskFilter();
await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('Involved Tasks');
await tasksListPage.checkContentIsDisplayed('Test');
await expect(await taskDetailsPage.checkTaskDetailsDisplayed()).toBeDefined();
await taskFiltersDemoPage.completedTasksFilter().clickTaskFilter();
await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('Completed Tasks');
await tasksListPage.checkContentIsNotDisplayed('Test');
await expect(await taskDetailsPage.checkTaskDetailsEmpty()).toBeDefined();
});
it('[C260348] Should display task in Complete Tasks List when task is completed', async () => {
await taskFiltersDemoPage.myTasksFilter().checkTaskFilterIsDisplayed();
await taskFiltersDemoPage.queuedTasksFilter().checkTaskFilterIsDisplayed();
await taskFiltersDemoPage.involvedTasksFilter().checkTaskFilterIsDisplayed();
await taskFiltersDemoPage.completedTasksFilter().checkTaskFilterIsDisplayed();
const task = await tasksPage.createNewTask();
await task.addName('Test');
await task.clickStartButton();
await taskFiltersDemoPage.myTasksFilter().clickTaskFilter();
await tasksListPage.checkContentIsDisplayed('Test');
await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('My Tasks');
await expect(await taskDetailsPage.checkTaskDetailsDisplayed()).toBeDefined();
await taskFiltersDemoPage.queuedTasksFilter().clickTaskFilter();
await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('Queued Tasks');
await expect(await tasksListPage.getNoTasksFoundMessage()).toBe('No Tasks Found');
await expect(await taskDetailsPage.getEmptyTaskDetailsMessage()).toBe('No task details found');
await taskFiltersDemoPage.involvedTasksFilter().clickTaskFilter();
await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('Involved Tasks');
await tasksListPage.checkContentIsDisplayed('Test');
await expect(await taskDetailsPage.checkTaskDetailsDisplayed()).toBeDefined();
await taskFiltersDemoPage.completedTasksFilter().clickTaskFilter();
await expect(await taskFiltersDemoPage.checkActiveFilterActive()).toBe('Completed Tasks');
await expect(await tasksListPage.getNoTasksFoundMessage()).toBe('No Tasks Found');
await expect(await taskDetailsPage.getEmptyTaskDetailsMessage()).toBe('No task details found');
});
it('[C260349] Should sort task by name when Name sorting is clicked', async () => {
await tasksPage.createTask({ name: 'Test1' });
await taskDetailsPage.clickCompleteTask();
await tasksPage.createTask({ name: 'Test2' });
await taskDetailsPage.clickCompleteTask();
await tasksPage.createTask({ name: 'Test3' });
await tasksPage.createTask({ name: 'Test4' });
await tasksListPage.checkContentIsDisplayed('Test4');
await tasksListPage.checkRowIsSelected('Test4');
await tasksListPage.checkContentIsDisplayed('Test3');
await taskDetailsPage.checkTaskDetailsDisplayed();
await tasksPage.clickSortByNameAsc();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe('Test3');
await tasksPage.clickSortByNameDesc();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe('Test4');
await taskFiltersDemoPage.completedTasksFilter().clickTaskFilter();
await tasksListPage.checkContentIsDisplayed('Test1');
await tasksListPage.checkContentIsDisplayed('Test2');
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe('Test2');
await tasksPage.clickSortByNameAsc();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe('Test1');
await taskFiltersDemoPage.involvedTasksFilter().clickTaskFilter();
await tasksListPage.checkContentIsDisplayed('Test3');
await tasksListPage.checkContentIsDisplayed('Test4');
});
it('[C277264] Should display task filter results when task filter is selected', async () => {
await tasksPage.createTask({ name: 'Test' });
await taskFiltersDemoPage.myTasksFilter().clickTaskFilter();
await tasksListPage.checkContentIsDisplayed('Test');
await expect(await taskDetailsPage.getTaskDetailsTitle()).toBe('Test');
});
});
describe('Custom Filters', () => {
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const processServicesPage = new ProcessServicesPage();
const processServiceTabBarPage = new ProcessServiceTabBarPage();
const appSettingsToggles = new AppSettingsTogglesPage();
const taskFiltersDemoPage = new TaskFiltersDemoPage();
const apiService = new ApiService();
let user;
let appId: number;
const app = browser.params.resources.Files.APP_WITH_PROCESSES;
beforeAll(async () => {
const usersActions = new UsersActions(apiService);
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
await apiService.login(user.username, user.password);
const applicationsService = new ApplicationsUtil(apiService);
const importedApp = await applicationsService.importPublishDeployApp(app.file_path);
const appDefinitions = await apiService.getInstance().activiti.appsApi.getAppDefinitions();
appId = appDefinitions.data.find((currentApp) => currentApp.modelId === importedApp.id).id;
await loginPage.login(user.username, user.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(user.tenantId);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
await processServicesPage.goToApp(app.title);
});
it('[C260350] Should display a new filter when a filter is added', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
name: 'New Task Filter',
appId,
icon: 'glyphicon-filter',
filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' }
});
const { id } = await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await taskFiltersDemoPage.customTaskFilter('New Task Filter').checkTaskFilterIsDisplayed();
await apiService.getInstance().activiti.userFiltersApi.deleteUserTaskFilter(id);
});
it('[C286447] Should display the task filter icon when a custom filter is added', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
name: 'New Task Filter with icon',
appId,
icon: 'glyphicon-cloud',
filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' }
});
const { id } = await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await processServiceTabBarPage.clickSettingsButton();
await browser.sleep(500);
await appSettingsToggles.enableTaskFiltersIcon();
await processServiceTabBarPage.clickTasksButton();
await taskFiltersDemoPage.customTaskFilter('New Task Filter with icon').checkTaskFilterIsDisplayed();
await expect(await taskFiltersDemoPage.customTaskFilter('New Task Filter with icon').getTaskFilterIcon()).toEqual('cloud');
await apiService.getInstance().activiti.userFiltersApi.deleteUserTaskFilter(id);
});
it('[C286449] Should display task filter icons only when showIcon property is set on true', async () => {
await taskFiltersDemoPage.myTasksFilter().checkTaskFilterHasNoIcon();
await processServiceTabBarPage.clickSettingsButton();
await appSettingsToggles.enableTaskFiltersIcon();
await processServiceTabBarPage.clickTasksButton();
await taskFiltersDemoPage.myTasksFilter().checkTaskFilterIsDisplayed();
await expect(await taskFiltersDemoPage.myTasksFilter().getTaskFilterIcon()).toEqual('inbox');
});
});
});

View File

@@ -0,0 +1,223 @@
/*!
* @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 { ApiService, ApplicationsUtil, LoginPage, UsersActions } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ProcessServicesPage } from './../pages/process-services.page';
import { TasksPage } from './../pages/tasks.page';
import { TasksListPage } from './../pages/tasks-list.page';
import { TaskDetailsPage } from './../pages/task-details.page';
import { TaskFiltersDemoPage } from './../pages/task-filters-demo.page';
import { UserProcessInstanceFilterRepresentation } from '@alfresco/js-api';
import { browser } from 'protractor';
describe('Task Filters Sorting', () => {
const app = browser.params.resources.Files.APP_WITH_PROCESSES;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const processServicesPage = new ProcessServicesPage();
const tasksPage = new TasksPage();
const tasksListPage = new TasksListPage();
const taskDetailsPage = new TaskDetailsPage();
const taskFiltersDemoPage = new TaskFiltersDemoPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
let user;
let appId;
const tasks = [
{ name: 'Task 1 Completed', dueDate: '01/01/2019' },
{ name: 'Task 2 Completed', dueDate: '02/01/2019' },
{ name: 'Task 3 Completed', dueDate: '03/01/2019' },
{ name: 'Task 4', dueDate: '01/01/2019' },
{ name: 'Task 5', dueDate: '02/01/2019' },
{ name: 'Task 6', dueDate: '03/01/2019' }];
beforeAll(async () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
await apiService.login(user.username, user.password);
const applicationsService = new ApplicationsUtil(apiService);
const importedApp = await applicationsService.importPublishDeployApp(app.file_path);
const appDefinitions = await apiService.getInstance().activiti.appsApi.getAppDefinitions();
appId = appDefinitions.data.find((currentApp) => currentApp.modelId === importedApp.id).id;
await loginPage.login(user.username, user.password);
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
await processServicesPage.goToApp(app.title);
await tasksPage.createTask({name: tasks[0].name, dueDate: tasks[0].dueDate});
await taskDetailsPage.clickCompleteTask();
await tasksPage.createTask({name: tasks[1].name, dueDate: tasks[1].dueDate});
await taskDetailsPage.clickCompleteTask();
await tasksPage.createTask({name: tasks[2].name, dueDate: tasks[2].dueDate});
await taskDetailsPage.clickCompleteTask();
await tasksPage.createTask({name: tasks[3].name, dueDate: tasks[3].dueDate});
await tasksPage.createTask({name: tasks[4].name, dueDate: tasks[4].dueDate});
await tasksPage.createTask({name: tasks[5].name, dueDate: tasks[5].dueDate});
});
afterAll( async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(user.tenantId);
});
it('[C277254] Should display tasks under new filter from newest to oldest when they are completed', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
appId,
name : 'Newest first',
icon: 'glyphicon-filter',
filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' }
});
await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[2].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name);
await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[0].name);
});
it('[C277255] Should display tasks under new filter from oldest to newest when they are completed', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
appId,
name : 'Newest last',
icon: 'glyphicon-filter',
filter: { sort: 'created-asc', state: 'completed', assignment: 'involved' }
});
await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[0].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name);
await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[2].name);
});
it('[C277256] Should display tasks under new filter from closest due date to farthest when they are completed', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
appId,
name : 'Due first',
icon: 'glyphicon-filter',
filter: { sort: 'due-desc', state: 'completed', assignment: 'involved' }
});
await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[2].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name);
await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[0].name);
});
it('[C277257] Should display tasks under new filter from farthest due date to closest when they are completed', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
appId,
name : 'Due last',
icon: 'glyphicon-filter',
filter: { sort: 'due-asc', state: 'completed', assignment: 'involved' }
});
await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[0].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[1].name);
await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[2].name);
});
it('[C277258] Should display tasks under new filter from newest to oldest when they are open ', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
appId,
name : 'Newest first Open',
icon: 'glyphicon-filter',
filter: { sort: 'created-desc', state: 'open', assignment: 'involved' }
});
await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[5].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name);
await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[3].name);
});
it('[C277259] Should display tasks under new filter from oldest to newest when they are open', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
appId,
name : 'Newest last Open',
icon: 'glyphicon-filter',
filter: { sort: 'created-asc', state: 'open', assignment: 'involved' }
});
await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[3].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name);
await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[5].name);
});
it('[C277260] Should display tasks under new filter from closest due date to farthest when they are open', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
appId,
name : 'Due first Open',
icon: 'glyphicon-filter',
filter: { sort: 'due-desc', state: 'open', assignment: 'involved' }
});
await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[5].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name);
await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[3].name);
});
it('[C277261] Should display tasks under new filter from farthest due date to closest when they are open', async () => {
const newFilter = new UserProcessInstanceFilterRepresentation({
appId,
name : 'Due last Open',
icon: 'glyphicon-filter',
filter: { sort: 'due-asc', state: 'open', assignment: 'involved' }
});
await apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(newFilter);
await browser.refresh();
await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter();
await expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[3].name);
await expect(await tasksListPage.getDataTable().contentInPosition(2)).toBe(tasks[4].name);
await expect(await tasksListPage.getDataTable().contentInPosition(3)).toBe(tasks[5].name);
});
});

View File

@@ -0,0 +1,199 @@
/*!
* @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 {
ApiService,
ApplicationsUtil,
LoginPage,
PaginationPage,
ProcessUtil,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksPage } from './../pages/tasks.page';
import CONSTANTS = require('../../util/constants');
describe('Task List Pagination', () => {
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const taskPage = new TasksPage();
const paginationPage = new PaginationPage();
const apiService = new ApiService();
let processUserModel: UserModel;
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
let currentPage = 1;
const nrOfTasks = 20;
let totalPages;
const itemsPerPage = {
five: '5',
fiveValue: 5,
ten: '10',
tenValue: 10,
fifteen: '15',
fifteenValue: 15,
twenty: '20',
twentyValue: 20,
default: '20'
};
beforeAll(async () => {
const usersActions = new UsersActions(apiService);
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
const applicationsService = new ApplicationsUtil(apiService);
const resultApp = await applicationsService.importPublishDeployApp(app.file_path);
for (let i = 0; i < nrOfTasks; i++) {
await new ProcessUtil(apiService).startProcessOfApp(resultApp.name);
}
await loginPage.login(processUserModel.username, processUserModel.password);
});
afterAll( async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
});
it('[C260301] Should display default pagination', async () => {
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.default);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(nrOfTasks);
await paginationPage.checkNextPageButtonIsDisabled();
await paginationPage.checkPreviousPageButtonIsDisabled();
await paginationPage.selectItemsPerPage(itemsPerPage.twenty);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
});
it('[C260304] Should be possible to set Items per page to 5', async () => {
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await paginationPage.selectItemsPerPage(itemsPerPage.five);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fiveValue + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await paginationPage.clickOnNextPage();
currentPage++;
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 6-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await paginationPage.clickOnNextPage();
currentPage++;
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await paginationPage.clickOnNextPage();
currentPage++;
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 16-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
});
it('[C260303] Should be possible to set Items per page to 10', async () => {
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await paginationPage.selectItemsPerPage(itemsPerPage.ten);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
await paginationPage.clickOnNextPage();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.twentyValue + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
});
it('[C260302] Should be possible to set Items per page to 15', async () => {
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await paginationPage.selectItemsPerPage(itemsPerPage.fifteen);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.fifteenValue);
await paginationPage.clickOnNextPage();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 16-' + itemsPerPage.twentyValue + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
});
it('[C261006] Should be possible to navigate to a page with page number dropdown', async () => {
currentPage = 1;
totalPages = 2;
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await paginationPage.selectItemsPerPage(itemsPerPage.ten);
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await expect(await paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
await expect(await paginationPage.getTotalPages()).toEqual('of ' + totalPages);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
await paginationPage.checkNextPageButtonIsEnabled();
await paginationPage.checkPreviousPageButtonIsDisabled();
await paginationPage.clickOnPageDropdown();
await expect(await paginationPage.getPageDropdownOptions()).toEqual(['1', '2']);
currentPage = 2;
await paginationPage.clickOnPageDropdownOption('2');
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await expect(await paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
await expect(await paginationPage.getTotalPages()).toEqual('of ' + totalPages);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
await paginationPage.checkNextPageButtonIsDisabled();
await paginationPage.checkPreviousPageButtonIsEnabled();
await paginationPage.clickOnPageDropdown();
await expect(await paginationPage.getPageDropdownOptions()).toEqual(['1', '2']);
currentPage = 1;
await paginationPage.clickOnPageDropdownOption('1');
await taskPage.tasksListPage().getDataTable().waitForTableBody();
await expect(await paginationPage.getCurrentPage()).toEqual('Page ' + currentPage);
await expect(await paginationPage.getTotalPages()).toEqual('of ' + totalPages);
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
await expect(await taskPage.tasksListPage().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
await paginationPage.checkNextPageButtonIsEnabled();
await paginationPage.checkPreviousPageButtonIsDisabled();
});
});