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,80 @@
/*!
* @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, Application, AppListCloudPage, IdentityService, LocalStorageUtil, LoginPage } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Applications list', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudPage = new AppListCloudPage();
const apiService = new ApiService();
const applicationsService = new Application(apiService);
const identityService = new IdentityService(apiService);
let testUser;
const appNames = [];
let applications;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole( [identityService.ROLES.ACTIVITI_USER, identityService.ROLES.ACTIVITI_DEVOPS]);
await loginSSOPage.login(testUser.username, testUser.password);
await apiService.login(testUser.username, testUser.password);
applications = await applicationsService.getApplicationsByStatus('RUNNING');
applications.list.entries.forEach(app => {
appNames.push(app.entry.name.toLowerCase());
});
await LocalStorageUtil.setConfigField('alfresco-deployed-apps', '[]');
await LocalStorageUtil.apiReset();
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
it('[C310373] Should all the app with running state be displayed on dashboard when alfresco-deployed-apps is not used in config file', async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudPage.checkApsContainer();
const list = await appListCloudPage.getNameOfTheApplications();
await expect(JSON.stringify(list)).toEqual(JSON.stringify(appNames));
});
it('[C289910] Should the app be displayed on dashboard when is deployed on APS', async () => {
await browser.refresh();
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudPage.checkApsContainer();
await appListCloudPage.checkAppIsDisplayed(simpleApp);
await appListCloudPage.checkAppIsDisplayed(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name);
await appListCloudPage.checkAppIsDisplayed(browser.params.resources.ACTIVITI_CLOUD_APPS.SUB_PROCESS_APP.name);
await expect(await appListCloudPage.countAllApps()).toEqual(3);
});
});

View File

@@ -0,0 +1,206 @@
/*!
* @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,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LoginPage
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { ProcessCloudDemoPage } from '../pages/process-cloud-demo.page';
import { TasksCloudDemoPage } from '../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
describe('Edit process filters cloud', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
const processFilter = processCloudDemoPage.processFilterCloudComponent;
const apiService = new ApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
let testUser, groupInfo;
const PROCESSES = CONSTANTS.PROCESS_FILTERS;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
await processFilter.clickOnProcessFilters();
await editProcessFilter.openFilter();
await editProcessFilter.checkCustomiseFilterHeaderIsExpanded();
await processFilter.clickAllProcessesFilter();
});
it('[C291804] Delete Save and Save as actions should be displayed when clicking on default filter header', async () => {
await processFilter.clickAllProcessesFilter();
await expect(await processFilter.getActiveFilterName()).toBe('All');
await editProcessFilter.checkSaveButtonIsDisplayed();
await editProcessFilter.checkSaveAsButtonIsDisplayed();
await editProcessFilter.checkDeleteButtonIsDisplayed();
});
it('[C586757] Delete Save and Save as actions should be displayed and enabled when clicking on custom filter header', async () => {
await createNewProcessCustomFilter('New');
await expect(await processFilter.getActiveFilterName()).toBe('New');
await processFilter.clickProcessFilter('custom-new');
await editProcessFilter.openFilter();
await editProcessFilter.setSortFilterDropDown('Start Date');
await expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Start Date');
await editProcessFilter.checkSaveButtonIsDisplayed();
await editProcessFilter.checkSaveAsButtonIsDisplayed();
await editProcessFilter.checkDeleteButtonIsDisplayed();
await expect(await editProcessFilter.checkSaveButtonIsEnabled()).toEqual(true);
await expect(await editProcessFilter.checkSaveAsButtonIsEnabled()).toEqual(true);
await expect(await editProcessFilter.checkDeleteButtonIsEnabled()).toEqual(true);
});
it('[C291805] New process filter is added when clicking Save As button', async () => {
await createNewProcessCustomFilter('New');
await expect(await processFilter.getActiveFilterName()).toBe('New');
await editProcessFilter.openFilter();
await expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Id');
await processFilter.clickAllProcessesFilter();
await expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Start Date');
await processFilter.clickProcessFilter('custom-new');
await expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Id');
await editProcessFilter.clickDeleteButton();
});
it('[C291807] A process filter is updated when clicking on save button', async () => {
await createNewProcessCustomFilter('New');
await expect(await processFilter.getActiveFilterName()).toBe('New');
await editProcessFilter.openFilter();
await editProcessFilter.checkCustomiseFilterHeaderIsExpanded();
await editProcessFilter.setSortFilterDropDown('Process Name');
await expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Process Name');
await editProcessFilter.clickSaveButton();
await editProcessFilter.openFilter();
await editProcessFilter.checkCustomiseFilterHeaderIsExpanded();
await browser.driver.sleep(1000);
await expect(await processFilter.getActiveFilterName()).toBe('New');
await expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Process Name');
await editProcessFilter.clickDeleteButton();
});
it('[C291808] A process filter is deleted when clicking on delete button', async () => {
await createNewProcessCustomFilter('New');
await editProcessFilter.openFilter();
await expect(await processFilter.getActiveFilterName()).toBe('New');
await expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Id');
await editProcessFilter.clickDeleteButton();
await browser.driver.sleep(1000);
await expect(await processFilter.getActiveFilterName()).toBe(CONSTANTS.PROCESS_FILTERS.RUNNING);
await processFilter.checkProcessFilterNotDisplayed('New');
});
it('[C291810] Process filter should not be created when process filter dialog is closed', async () => {
await editProcessFilter.setSortFilterDropDown('Id');
await processFilter.clickAllProcessesFilter();
await editProcessFilter.clickSaveAsButton();
await editProcessFilter.editProcessFilterDialog().setFilterName('Cancel');
await expect(await editProcessFilter.editProcessFilterDialog().getFilterName()).toEqual('Cancel');
await editProcessFilter.editProcessFilterDialog().clickOnCancelButton();
await processFilter.checkProcessFilterNotDisplayed('Cancel');
await expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.ALL);
await processFilter.clickRunningProcessesFilter();
await expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.RUNNING);
await editProcessFilter.openFilter();
await processFilter.clickAllProcessesFilter();
await expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.ALL);
await expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Start Date');
await editProcessFilter.openFilter();
});
it('[C291811] Save button of process filter dialog should be disabled when process name is empty', async () => {
await editProcessFilter.setSortFilterDropDown('Id');
await editProcessFilter.clickSaveAsButton();
const dialog = editProcessFilter.editProcessFilterDialog();
await dialog.clearFilterName();
await expect(await dialog.getFilterName()).toEqual('');
await expect(await dialog.checkSaveButtonIsEnabled()).toEqual(false);
await expect(await dialog.checkCancelButtonIsEnabled()).toEqual(true);
await dialog.clickOnCancelButton();
await editProcessFilter.openFilter();
await editProcessFilter.checkCustomiseFilterHeaderIsExpanded();
await editProcessFilter.setSortFilterDropDown('Start Date');
await expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Start Date');
await editProcessFilter.clickSaveButton();
});
it('[C291809] Process filter dialog is displayed when clicking on Save As button', async () => {
await editProcessFilter.setSortFilterDropDown('Name');
await editProcessFilter.clickSaveAsButton();
const dialog = editProcessFilter.editProcessFilterDialog();
await expect(await dialog.checkCancelButtonIsEnabled()).toEqual(true);
await expect(await dialog.checkSaveButtonIsEnabled()).toEqual(true);
await expect(await dialog.getTitle()).toEqual('Save filter as');
await expect(await dialog.getFilterName()).toEqual(PROCESSES.ALL);
await dialog.clickOnCancelButton();
});
async function createNewProcessCustomFilter(name: string, sort = 'Id'): Promise<void> {
await processFilter.clickAllProcessesFilter();
await editProcessFilter.setSortFilterDropDown(sort);
await editProcessFilter.saveAs(name);
}
});

View File

@@ -0,0 +1,359 @@
/*!
* @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 {
AppListCloudPage,
StringUtil,
ApiService,
LoginPage,
TasksService,
IdentityService,
GroupIdentityService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Edit task filters cloud', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const apiService = new ApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
let testUser, groupInfo;
const completedTaskName = StringUtil.generateRandomString(),
assignedTaskName = StringUtil.generateRandomString();
async function openFilter() {
await editTaskFilter.openFilter();
}
async function clickTaskFilter(name: string) {
await taskFilter.clickTaskFilter(name);
}
async function waitTillContentLoaded() {
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
}
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
const assignedTask = await tasksService.createStandaloneTask(assignedTaskName, simpleApp);
await tasksService.claimTask(assignedTask.entry.id, simpleApp);
await tasksService.createAndCompleteTask(completedTaskName, simpleApp);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
afterEach(async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
});
it('[C291785] All the filters property should be set up accordingly with the Query Param', async () => {
await openFilter();
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await expect(await editTaskFilter.getStatusFilterDropDownValue()).toEqual('Assigned', `Status is no 'Assigned'`);
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('createdDate', `Sort filter is not 'createdDate'`);
await expect(await editTaskFilter.getOrderFilterDropDownValue()).toEqual('Descending', `Order is not 'Descending'`);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assignedTaskName);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTaskName);
await clickTaskFilter('completed-tasks');
await waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('Completed Tasks');
await expect(await editTaskFilter.getStatusFilterDropDownValue()).toEqual('Completed', `Status is not 'Completed'`);
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('createdDate', `Sort filter is not 'createdDate'`);
await expect(await editTaskFilter.getOrderFilterDropDownValue()).toEqual('Descending', `Order is not 'Descending'`);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(assignedTaskName);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName);
await openFilter();
});
it('[C306896] Delete Save and Save as actions should be displayed and disabled when clicking on default filter header', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await openFilter();
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await editTaskFilter.checkSaveButtonIsDisplayed();
await editTaskFilter.checkSaveAsButtonIsDisplayed();
await editTaskFilter.checkDeleteButtonIsDisplayed();
await expect(await editTaskFilter.checkSaveButtonIsEnabled()).toEqual(false);
await expect(await editTaskFilter.checkSaveAsButtonIsEnabled()).toEqual(false);
await expect(await editTaskFilter.checkDeleteButtonIsEnabled()).toEqual(false);
await openFilter();
});
it('[C586756] Delete, Save and Save as actions should be displayed and enabled when clicking on custom filter header', async () => {
await createNewCustomFilter('New');
await clickTaskFilter('custom-new');
await waitTillContentLoaded();
await openFilter();
await clickTaskFilter('custom-new');
await waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('New');
await editTaskFilter.setSortFilterDropDown('priority');
await editTaskFilter.checkSaveButtonIsDisplayed();
await editTaskFilter.checkSaveAsButtonIsDisplayed();
await editTaskFilter.checkDeleteButtonIsDisplayed();
await expect(await editTaskFilter.checkSaveButtonIsEnabled()).toEqual(true);
await expect(await editTaskFilter.checkSaveAsButtonIsEnabled()).toEqual(true);
await expect(await editTaskFilter.checkDeleteButtonIsEnabled()).toEqual(true);
});
it('[C291795] New filter is added when clicking Save As button', async () => {
await createNewCustomFilter('New');
await expect(await taskFilter.getActiveFilterName()).toBe('New');
await openFilter();
await expect(await editTaskFilter.checkSaveButtonIsEnabled()).toEqual(false);
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await expect(await editTaskFilter.checkSaveAsButtonIsEnabled()).toEqual(false);
await expect(await editTaskFilter.checkDeleteButtonIsEnabled()).toEqual(true);
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('createdDate');
await clickTaskFilter('custom-new');
await waitTillContentLoaded();
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickDeleteButton();
});
it('[C291796] Two filters with same name can be created when clicking the Save As button', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.clickSaveAsButton();
const editTaskFilterDialog = editTaskFilter.editTaskFilterDialog();
await editTaskFilterDialog.setFilterName('New');
await editTaskFilterDialog.clickOnSaveButton();
await expect(await taskFilter.getActiveFilterName()).toBe('New');
await openFilter();
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.setSortFilterDropDown('priority');
await editTaskFilter.clickSaveAsButton();
await editTaskFilter.editTaskFilterDialog().setFilterName('New');
await editTaskFilter.editTaskFilterDialog().clickOnSaveButton();
await expect(await taskFilter.getActiveFilterName()).toBe('New');
await openFilter();
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('priority');
await editTaskFilter.clickDeleteButton();
await clickTaskFilter('custom-new');
await waitTillContentLoaded();
await openFilter();
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickDeleteButton();
});
it('[C291797] A filter is overridden when clicking on save button', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.clickSaveAsButton();
const editTaskFilterDialog = await editTaskFilter.editTaskFilterDialog();
await editTaskFilterDialog.setFilterName('New');
await editTaskFilterDialog.clickOnSaveButton();
await expect(await taskFilter.getActiveFilterName()).toBe('New');
await openFilter();
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.setSortFilterDropDown('name');
await editTaskFilter.clickSaveButton();
await openFilter();
await expect(await taskFilter.getActiveFilterName()).toBe('New');
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('name');
await editTaskFilter.clickDeleteButton();
});
it('[C291798] A filter is deleted when clicking on delete button', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.clickSaveAsButton();
const editTaskFilterDialog = await editTaskFilter.editTaskFilterDialog();
await editTaskFilterDialog.setFilterName('New');
await editTaskFilterDialog.clickOnSaveButton();
await expect(await taskFilter.getActiveFilterName()).toBe('New');
await openFilter();
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickDeleteButton();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskFilter.checkTaskFilterNotDisplayed('New');
});
it('[C291800] Task filter should not be created when task filter dialog is closed', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('priority');
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('priority');
await editTaskFilter.clickSaveAsButton();
const dialog = editTaskFilter.editTaskFilterDialog();
await expect(await dialog.getFilterName()).toEqual('My Tasks');
await dialog.setFilterName('Cancel');
await expect(await dialog.getFilterName()).toEqual('Cancel');
await dialog.clickOnCancelButton();
await taskFilter.checkTaskFilterNotDisplayed('Cancel');
await expect(await taskFilter.getActiveFilterName()).toEqual('My Tasks');
await clickTaskFilter('completed-tasks');
await waitTillContentLoaded();
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await openFilter();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('createdDate');
await openFilter();
});
it('[C291801] Save button of task filter dialog should be disabled when task name is empty', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickSaveAsButton();
const dialog = editTaskFilter.editTaskFilterDialog();
await expect(await dialog.getFilterName()).toEqual('My Tasks');
await dialog.clearFilterName();
await expect(await dialog.getFilterName()).toEqual('');
await expect(await dialog.checkSaveButtonIsEnabled()).toEqual(false);
await expect(await dialog.checkCancelButtonIsEnabled()).toEqual(true);
await dialog.clickOnCancelButton();
});
it('[C291799] Task filter dialog is displayed when clicking on Save As button', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickSaveAsButton();
const dialog = editTaskFilter.editTaskFilterDialog();
await expect(await dialog.checkSaveButtonIsEnabled()).toEqual(true);
await expect(await dialog.checkCancelButtonIsEnabled()).toEqual(true);
await expect(await dialog.getTitle()).toEqual('Save filter as');
await expect(await dialog.getFilterName()).toEqual('My Tasks');
await dialog.clickOnCancelButton();
});
async function createNewCustomFilter(name: string): Promise<void> {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.clickSaveAsButton();
const dialog = editTaskFilter.editTaskFilterDialog();
await dialog.setFilterName(name);
await dialog.clickOnSaveButton();
}
});

View File

@@ -0,0 +1,127 @@
/*!
* @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 {
LoginPage,
TasksService,
ApiService,
AppListCloudPage,
StringUtil,
IdentityService,
GroupIdentityService,
NotificationHistoryPage,
ProcessInstancesService,
ProcessDefinitionsService,
QueryService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Task counters cloud', () => {
describe('Task Counters', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const notificationHistoryPage = new NotificationHistoryPage();
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const apiService = new ApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const queryService = new QueryService(apiService);
let testUser, groupInfo;
const createdTaskName = StringUtil.generateRandomString();
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
it('[C593065] Should display notification in counter when process started', async () => {
await taskFilter.checkTaskFilterCounter('my-tasks');
await expect(await taskFilter.getTaskFilterCounter('my-tasks')).toBe('0');
const processDefinition = await processDefinitionService.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.uploadSingleMultipleFiles, simpleApp);
const processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp, { 'name': StringUtil.generateRandomString() });
const task = await queryService.getProcessInstanceTasks(processInstance.entry.id, simpleApp);
await tasksService.claimTask(task.list.entries[0].entry.id, simpleApp);
await notificationHistoryPage.checkNotificationCenterHasNewNotifications();
await notificationHistoryPage.clickNotificationButton();
await notificationHistoryPage.checkNotificationIsPresent(`task has been assigned`);
await notificationHistoryPage.clickMarkAsRead();
await processInstancesService.deleteProcessInstance(processInstance.entry.id, simpleApp);
});
it('[C593066] Should display notification in counter when task assigned', async () => {
await taskFilter.checkTaskFilterCounter('my-tasks');
await expect(await taskFilter.getTaskFilterCounter('my-tasks')).toBe('0');
const taskCounter = await taskFilter.getTaskFilterCounter('my-tasks');
const assigneeTask = await tasksService.createStandaloneTask(createdTaskName, simpleApp);
await tasksService.claimTask(assigneeTask.entry.id, simpleApp);
await taskFilter.checkNotificationCounterValue('my-tasks', (parseInt(taskCounter, 10) + 1).toString());
await notificationHistoryPage.clickNotificationButton();
await notificationHistoryPage.clickMarkAsRead();
await tasksService.deleteTask(assigneeTask.entry.id, simpleApp);
});
it('[C290009] Should display notification in task center', async () => {
await taskFilter.checkTaskFilterCounter('my-tasks');
const assigneeTask = await tasksService.createStandaloneTask(createdTaskName, simpleApp);
await tasksService.claimTask(assigneeTask.entry.id, simpleApp);
await notificationHistoryPage.checkNotificationCenterHasNewNotifications();
await notificationHistoryPage.clickNotificationButton();
await notificationHistoryPage.checkNotificationIsPresent(`${assigneeTask.entry.name} task has been assigned`);
await notificationHistoryPage.clickMarkAsRead();
await tasksService.deleteTask(assigneeTask.entry.id, simpleApp);
});
});
});

View File

@@ -0,0 +1,116 @@
/*!
* @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 {
LoginPage,
TasksService,
ApiService,
AppListCloudPage,
StringUtil,
IdentityService,
GroupIdentityService,
QueryService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Task filters cloud', () => {
describe('Task Filters', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const apiService = new ApiService();
const queryService = new QueryService(apiService);
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
let testUser, groupInfo;
const newTask = StringUtil.generateRandomString(5), completedTask = StringUtil.generateRandomString(5);
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
it('[C290009] Should display default filters and created task', async () => {
const task = await tasksService.createStandaloneTask(newTask, simpleApp);
await tasksService.claimTask(task.entry.id, simpleApp);
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('Completed Tasks');
await taskList.checkContentIsNotDisplayedByName(newTask);
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsDisplayedByName(newTask);
});
it('[C289955] Should display task in Complete Tasks List when task is completed', async () => {
const toBeCompletedTask = await tasksService.createStandaloneTask(completedTask, simpleApp);
await tasksService.claimTask(toBeCompletedTask.entry.id, simpleApp);
await tasksService.completeTask(toBeCompletedTask.entry.id, simpleApp);
await queryService.getTaskByStatus(toBeCompletedTask.entry.name, simpleApp, 'COMPLETED');
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsNotDisplayedByName(completedTask);
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('Completed Tasks');
await taskList.checkContentIsDisplayedByName(completedTask);
});
});
});

View File

@@ -0,0 +1,349 @@
/*!
* @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 {
AppListCloudPage,
StringUtil,
ApiService,
LoginPage,
TasksService,
ProcessDefinitionsService,
ProcessInstancesService,
TaskHeaderCloudPage,
TaskFormCloudComponent,
IdentityService, GroupIdentityService, ProcessCloudWidgetPage, FormCloudService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Task form cloud component', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const taskFormCloudComponent = new TaskFormCloudComponent();
const widget = new ProcessCloudWidgetPage();
let processDefinitionService: ProcessDefinitionsService;
let processInstancesService: ProcessInstancesService;
let identityService: IdentityService;
let completedTask, assigneeTask, toBeCompletedTask, formValidationsTask, testUser;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const completedTaskName = StringUtil.generateRandomString(), assignedTaskName = StringUtil.generateRandomString();
const apiService = new ApiService();
const apiServiceHrUser = new ApiService();
const visibilityConditionTasks = [];
const tab = {
tabWithFields: 'tabWithFields',
tabFieldValue: 'tabBasicFieldValue',
tabVarValue: 'tabBasicVarValue',
tabVarField: 'tabBasicVarField',
tabFieldField: 'tabBasicFieldField',
tabVarVar: 'tabBasicVarVar',
tabFieldVar: 'tabBasicFieldVar',
tabNextOperators: 'tabNextOperators',
tabMultipleConditions: 'tabMultipleConditions'
};
const widgets = {
textOneId: 'TextOne',
textTwoId: 'TextTwo',
textThreeId: 'TextThree',
textFourId: 'TextFour',
numberOneId: 'NumberOne'
};
const value = {
displayTab: 'showTab',
notDisplayTab: 'anythingElse'
};
const myTasksFilter = 'my-tasks';
const myTasksFilterTitle = 'My Tasks';
const completedTasksFilter = 'completed-tasks';
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
testUser = await identityService.createIdentityUserWithRole( [identityService.ROLES.ACTIVITI_USER]);
const groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiServiceHrUser.login(testUser.username, testUser.password);
const tasksService = new TasksService(apiServiceHrUser);
assigneeTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(assigneeTask.entry.id, candidateBaseApp);
const formCloudService = new FormCloudService(apiServiceHrUser);
const tabVisibilityFieldsId = await formCloudService.getIdByFormName(simpleApp, browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms.tabVisibilityFields.name);
const tabVisibilityVarsId = await formCloudService.getIdByFormName(simpleApp, browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms.tabVisibilityVars.name);
for (let i = 0; i < 4; i++) {
visibilityConditionTasks[i] = await tasksService.createStandaloneTaskWithForm(StringUtil.generateRandomString(),
simpleApp, tabVisibilityFieldsId);
await tasksService.claimTask(visibilityConditionTasks[i].entry.id, simpleApp);
}
for (let i = 4; i < 7; i++) {
visibilityConditionTasks[i] = await tasksService.createStandaloneTaskWithForm(StringUtil.generateRandomString(),
simpleApp, tabVisibilityVarsId);
await tasksService.claimTask(visibilityConditionTasks[i].entry.id, simpleApp);
}
const formToTestValidationsKey = await formCloudService.getIdByFormName(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name,
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.forms.formtotestvalidations);
formValidationsTask = await tasksService.createStandaloneTaskWithForm(StringUtil.generateRandomString(), candidateBaseApp, formToTestValidationsKey);
await tasksService.claimTask(formValidationsTask.entry.id, candidateBaseApp);
toBeCompletedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(toBeCompletedTask.entry.id, candidateBaseApp);
completedTask = await tasksService.createStandaloneTask(assignedTaskName, candidateBaseApp);
await tasksService.claimTask(completedTask.entry.id, candidateBaseApp);
await tasksService.createAndCompleteTask(completedTaskName, candidateBaseApp);
processDefinitionService = new ProcessDefinitionsService(apiServiceHrUser);
const processDefinition = await processDefinitionService
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.candidateUserProcess, candidateBaseApp);
processInstancesService = new ProcessInstancesService(apiServiceHrUser);
await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
await loginSSOPage.login(testUser.username, testUser.password);
}, 5 * 60 * 1000);
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
afterAll(async () => {
try {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
} catch (error) {
}
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();');
});
describe('Complete task with form - cloud directive', () => {
it('[C315174] Should be able to complete a standalone task with visible tab with empty value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[0].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
await taskFormCloudComponent.clickCompleteButton();
await expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[0].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[0].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
});
it('[C315177] Should be able to complete a standalone task with invisible tab with invalid value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[1].entry.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.textThreeId, value.displayTab);
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.numberOneId);
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 taskFormCloudComponent.clickCompleteButton();
await expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[1].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[1].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
});
it('[C315178] Should be able to complete a standalone task with invisible tab with valid value', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[2].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldVar);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textFourId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldVar);
await widget.tab().clickTabByLabel(tab.tabFieldVar);
await widget.textWidget().isWidgetVisible(widgets.textFourId);
await widget.textWidget().setValue(widgets.textFourId, value.displayTab);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldVar);
await taskFormCloudComponent.clickCompleteButton();
await expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[2].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[2].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldVar);
});
it('[C315175] Should be able to complete a standalone task with invisible tab with empty value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[4].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarValue);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await taskFormCloudComponent.clickCompleteButton();
await expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[4].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[4].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarValue);
});
it('[C315176] Should not be able to complete a standalone task with visible tab with invalid value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[5].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.numberOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarField);
await widget.tab().clickTabByLabel(tab.tabVarField);
await widget.textWidget().setValue(widgets.numberOneId, value.displayTab);
await expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toEqual(false);
});
it('[C315179] Should be able to complete a standalone task with visible tab with valid value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[6].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarVar);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.tab().clickTabByLabel(tab.tabVarVar);
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await taskFormCloudComponent.clickCompleteButton();
await expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[6].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[6].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarVar);
});
it('[C315180] Should be able to complete a standalone task with tab when has multiple visibility conditions and next condition operators', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[3].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabMultipleConditions);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().isWidgetVisible(widgets.textThreeId);
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabMultipleConditions);
await widget.textWidget().setValue(widgets.textThreeId, value.notDisplayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabMultipleConditions);
await taskFormCloudComponent.clickCompleteButton();
await expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[3].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[3].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabMultipleConditions);
});
async function chooseFilterAndSelectTaskByName(filterName: string, taskName: string): Promise<void> {
await taskFilter.clickTaskFilter(filterName);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(taskName);
await taskList.selectRow(taskName);
}
async function selectTaskByName(taskName: string): Promise<void> {
await taskList.checkContentIsDisplayedByName(taskName);
await taskList.selectRow(taskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
}
async function chooseFilter(filterName: string, filterTitle: string): Promise<void> {
await taskFilter.clickTaskFilter(filterName);
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe(filterTitle);
}
});
});

View File

@@ -0,0 +1,402 @@
/*!
* @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, protractor } from 'protractor';
import {
ApiService,
AppListCloudPage,
LoginPage,
ProcessCloudWidgetPage,
ProcessDefinitionsService,
ProcessInstancesService,
QueryService,
StringUtil,
TaskFormCloudComponent,
TaskHeaderCloudPage,
TasksService,
FormCloudService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Task form cloud component', () => {
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const simpleAppProcess = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes;
const simpleAppForm = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const taskFormCloudComponent = new TaskFormCloudComponent();
const widget = new ProcessCloudWidgetPage();
const apiService = new ApiService();
const tasksService = new TasksService(apiService);
const queryService = new QueryService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const formCloudService = new FormCloudService(apiService);
const completedTaskName = StringUtil.generateRandomString(), assignedTaskName = StringUtil.generateRandomString();
const myTasksFilter = 'my-tasks';
const completedTasksFilter = 'completed-tasks';
const dateFieldId = 'Date0rzbb6';
const defaultDate = '2020-07-09';
const changedDate = '2020-07-10';
const dropdownFieldId = 'DropdownOptions';
let completedTask, createdTask, assigneeTask, toBeCompletedTask, formValidationsTask, formTaskId, assigneeTaskId, assigneeReleaseTask, candidateUsersTask ;
let dateTimerTaskId, dateTimerTask, dateTimerChangedTaskId, dateTimerChangedTask, dropdownOptionsTask;
beforeAll(async () => {
await apiService.loginWithProfile('hrUser');
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
assigneeTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(assigneeTask.entry.id, candidateBaseApp);
const formToTestValidationsKey = await formCloudService.getIdByFormName(candidateBaseApp,
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.forms.formtotestvalidations);
formValidationsTask = await tasksService.createStandaloneTaskWithForm(StringUtil.generateRandomString(), candidateBaseApp, formToTestValidationsKey);
await tasksService.claimTask(formValidationsTask.entry.id, candidateBaseApp);
toBeCompletedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(toBeCompletedTask.entry.id, candidateBaseApp);
completedTask = await tasksService.createStandaloneTask(assignedTaskName, candidateBaseApp);
await tasksService.claimTask(completedTask.entry.id, candidateBaseApp);
await tasksService.createAndCompleteTask(completedTaskName, candidateBaseApp);
let processDefinition = await processDefinitionService
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.candidateUserProcess, candidateBaseApp);
const candidateUsersProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
const processInstanceTasks = await queryService.getProcessInstanceTasks(candidateUsersProcessInstance.entry.id, candidateBaseApp);
candidateUsersTask = processInstanceTasks.list.entries[0];
await tasksService.claimTask(candidateUsersTask.entry.id, candidateBaseApp);
processDefinition = await processDefinitionService
.getProcessDefinitionByName(simpleAppProcess.dropdownrestprocess, simpleApp);
const formProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
const formTasks = await queryService.getProcessInstanceTasks(formProcess.entry.id, simpleApp);
formTaskId = formTasks.list.entries[0].entry.id;
const dropdownOptionsId = await formCloudService.getIdByFormName(simpleApp, simpleAppForm.dropdownWithOptions.name);
dropdownOptionsTask = await tasksService.createStandaloneTaskWithForm(StringUtil.generateRandomString(),
simpleApp, dropdownOptionsId);
await tasksService.claimTask(dropdownOptionsTask.entry.id, simpleApp);
const timerProcessDefinition = await processDefinitionService
.getProcessDefinitionByName(simpleAppProcess.intermediateDateProcessVarTimer, simpleApp);
const dateTimerProcess = await processInstancesService.createProcessInstance(timerProcessDefinition.entry.key, simpleApp);
dateTimerTask = await queryService.getProcessInstanceTasks(dateTimerProcess.entry.id, simpleApp);
dateTimerTaskId = dateTimerTask.list.entries[0].entry.id;
const timerChangedProcessDefinition = await processDefinitionService
.getProcessDefinitionByName(simpleAppProcess.intermediateDateProcessVarTimer, simpleApp);
const dateTimerChangedProcess = await processInstancesService.createProcessInstance(timerChangedProcessDefinition.entry.key, simpleApp);
dateTimerChangedTask = await queryService.getProcessInstanceTasks(dateTimerChangedProcess.entry.id, simpleApp);
dateTimerChangedTaskId = dateTimerChangedTask.list.entries[0].entry.id;
/* cspell: disable-next-line */
const assigneeProcessDefinition = await processDefinitionService.getProcessDefinitionByName(simpleAppProcess.calledprocess, simpleApp);
const assigneeProcess = await processInstancesService.createProcessInstance(assigneeProcessDefinition.entry.key, simpleApp);
assigneeReleaseTask = await queryService.getProcessInstanceTasks(assigneeProcess.entry.id, simpleApp);
assigneeTaskId = assigneeReleaseTask.list.entries[0].entry.id;
await loginSSOPage.loginWithProfile('hrUser');
}, 5 * 60 * 1000);
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
});
afterAll(async () => {
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();');
});
it('[C310366] Should refresh buttons and form after an action is complete', async () => {
await appListCloudComponent.goToApp(simpleApp);
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await expect(taskFilter.getActiveFilterName()).toBe('My Tasks');
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Created');
await taskList.checkContentIsDisplayedById(formTaskId);
await taskList.selectRowByTaskId(formTaskId);
await taskFormCloudComponent.checkFormIsReadOnly();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsNotDisplayed();
await taskFormCloudComponent.clickClaimButton();
await taskFormCloudComponent.checkFormIsDisplayed();
await taskFormCloudComponent.checkFormIsNotReadOnly();
await taskFormCloudComponent.checkClaimButtonIsNotDisplayed();
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsDisplayed();
await taskFormCloudComponent.clickCompleteButton();
await openTaskByIdFromFilters(completedTasksFilter, formTaskId);
await taskFormCloudComponent.checkFormIsReadOnly();
await taskFormCloudComponent.checkClaimButtonIsNotDisplayed();
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsNotDisplayed();
await taskFormCloudComponent.checkCancelButtonIsDisplayed();
});
it('[C306872] Should not be able to Release a process task which has only assignee', async () => {
await appListCloudComponent.goToApp(simpleApp);
await openTaskByIdFromFilters(myTasksFilter, assigneeTaskId);
await expect(await taskHeaderCloudPage.getAssignee()).toEqual(assigneeReleaseTask.list.entries[0].entry.assignee);
await expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
await taskFormCloudComponent.checkReleaseButtonIsNotDisplayed();
});
it('[C310200] Should be able to save a task form', async () => {
const selectedOption = 'option1';
const dropdownId = '#DropdownOptions';
await goToAppOpenDropdownTaskByNameFromFilters(myTasksFilter, dropdownOptionsTask.entry.name);
await widget.dropdown().openDropdown(dropdownId);
await widget.dropdown().selectOption(selectedOption, dropdownId );
await taskFormCloudComponent.checkSaveButtonIsDisplayed();
await taskFormCloudComponent.clickSaveButton();
await navigationBarPage.clickHomeButton();
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await goToAppOpenDropdownTaskByNameFromFilters(myTasksFilter, dropdownOptionsTask.entry.name);
await expect(await widget.dropdown().getSelectedOptionText(dropdownFieldId)).toBe(selectedOption);
});
it('[C313200] Should be able to complete a Task form with process date variable mapped to a Date widget in the form', async () => {
await appListCloudComponent.goToApp(simpleApp);
await openTaskByIdFromFilters(myTasksFilter, dateTimerTaskId);
await verifyDateInput(dateFieldId, defaultDate);
await completeTask();
await verifyDateCompletedTask(dateTimerTaskId, defaultDate);
await openTaskByIdFromFilters(myTasksFilter, dateTimerChangedTaskId );
await verifyDateInput(dateFieldId, defaultDate);
await widget.dateWidget().clearDateInput(dateFieldId);
await widget.dateWidget().setDateInput(dateFieldId, changedDate );
await completeTask();
await verifyDateCompletedTask(dateTimerChangedTaskId, changedDate);
});
describe('Candidate Base App', () => {
beforeEach(async () => {
await appListCloudComponent.goToApp(candidateBaseApp);
});
it('[C307032] Should display the appropriate title for the unclaim option of a Task', async () => {
await openTaskByIdFromFilters(myTasksFilter, candidateUsersTask.entry.id);
await expect(await taskFormCloudComponent.getReleaseButtonText()).toBe('RELEASE');
});
it('[C310142] Empty content is displayed when having a task without form', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(assigneeTask.entry.name);
await taskList.selectRow(assigneeTask.entry.name);
await taskFormCloudComponent.checkFormIsNotDisplayed();
await expect(await taskFormCloudComponent.getFormTitle()).toBe(assigneeTask.entry.name);
await taskFormCloudComponent.checkFormContentIsEmpty();
await expect(await taskFormCloudComponent.getEmptyFormContentTitle()).toBe(`No form available`);
await expect(await taskFormCloudComponent.getEmptyFormContentSubtitle()).toBe(`Attach a form that can be viewed later`);
});
it('[C310199] Should not be able to complete a task when required field is empty or invalid data is added to a field', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await selectTaskByName(formValidationsTask.entry.name);
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Text0tma8h');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Date0m1moq');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Number0klykr');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Amount0mtp1h');
await expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(false);
await widget.textWidget().setValue('Text0tma8h', 'Some random text');
await expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(true);
await widget.dateWidget().setDateInput('Date0m1moq', 'invalid date');
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(false);
await widget.dateWidget().setDateInput('Date0m1moq', '20-10-2018');
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(true);
await widget.numberWidget().setFieldValue('Number0klykr', 'invalid number');
await expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(false);
await widget.numberWidget().setFieldValue('Number0klykr', '26');
await expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(true);
await widget.amountWidget().setFieldValue('Amount0mtp1h', 'invalid amount');
await expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(false);
await widget.amountWidget().setFieldValue('Amount0mtp1h', '660');
await expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(true);
});
it('[C307093] Complete button is not displayed when the task is already completed', async () => {
await taskFilter.clickTaskFilter(completedTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('Completed Tasks');
await taskList.checkContentIsDisplayedByName(completedTaskName);
await taskList.selectRow(completedTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
});
it('[C307095] Task can not be completed by owner user', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await editTaskFilter.openFilter();
await browser.driver.sleep(1000);
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Created');
await selectTaskByName(createdTask.entry.name);
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
});
it('[C307110] Task list is displayed after clicking on Cancel button', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await selectTaskByName(assigneeTask.entry.name);
await taskFormCloudComponent.clickCancelButton();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsDisplayedByName(assigneeTask.entry.name);
});
it('[C307094] Standalone Task can be completed by a user that is owner and assignee', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await selectTaskByName(toBeCompletedTask.entry.name);
await completeTask();
await taskList.checkContentIsNotDisplayedByName(toBeCompletedTask.entry.name);
await taskFilter.clickTaskFilter(completedTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(toBeCompletedTask.entry.name);
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
});
it('[C307111] Task of a process can be completed by a user that is owner and assignee', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await selectTaskByName(completedTask.entry.name);
await completeTask();
await taskList.checkContentIsNotDisplayedByName(completedTask.entry.name);
await taskFilter.clickTaskFilter(completedTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(completedTask.entry.name);
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
});
});
async function openTaskByIdFromFilters(filterName: string, taskId: string): Promise<void> {
await taskFilter.clickTaskFilter(filterName);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedById(taskId);
await taskList.selectRowByTaskId(taskId);
}
async function verifyDateInput(widgetId: string, input: string): Promise<void> {
await widget.dateWidget().checkWidgetIsVisible(widgetId);
await expect(await widget.dateWidget().getDateInput(widgetId)).toBe(input);
}
async function selectTaskByName(taskName: string): Promise<void> {
await taskList.checkContentIsDisplayedByName(taskName);
await taskList.selectRow(taskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
}
async function verifyDateCompletedTask(taskId: string, input: string): Promise<void> {
await openTaskByIdFromFilters(completedTasksFilter, taskId );
await taskFormCloudComponent.checkFormIsReadOnly();
await verifyDateInput(dateFieldId, input);
await taskFormCloudComponent.clickCancelButton();
}
async function goToAppOpenDropdownTaskByNameFromFilters(filterName: string, taskName: string): Promise<void> {
await appListCloudComponent.goToApp(simpleApp);
await taskFilter.clickTaskFilter(filterName);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(taskName);
await taskList.selectRow(taskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await widget.dropdown().isWidgetVisible(dropdownFieldId);
}
async function completeTask(): Promise<void> {
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
await taskFormCloudComponent.clickCompleteButton();
}
});

View File

@@ -0,0 +1,270 @@
/*!
* @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 CONSTANTS = require('../../util/constants');
import {
ApiService,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LocalStorageUtil,
LoginPage,
StringUtil,
TaskHeaderCloudPage,
TasksService,
PeopleCloudComponentPage
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import moment = require('moment');
const isValueInvalid = (value: any): boolean => {
return value === null || value === undefined;
};
describe('Task Header cloud component', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const peopleCloudComponentPage = new PeopleCloudComponentPage();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const apiService = new ApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const basicCreatedTaskName = StringUtil.generateRandomString();
const completedTaskName = StringUtil.generateRandomString();
const unclaimedTaskName = StringUtil.generateRandomString();
let basicCreatedTask: any;
let basicCreatedDate: any;
let completedTask: any;
let completedCreatedDate: string;
let dueDate: string;
let subTask: any;
let subTaskCreatedDate: string;
let completedEndDate: string;
let defaultDate: string;
let groupInfo: any;
let testUser: any;
let unclaimedTask: any;
const priority = 0;
const description = 'descriptionTask';
const formatDate = 'MMM D, YYYY';
const dateTimeFormat = 'MMM D, Y, H:mm';
const defaultFormat = 'M/D/YY';
const createCompletedTask = async function () {
const completedTaskId = await tasksService.createStandaloneTask(completedTaskName,
simpleApp, { priority: priority, description: description, dueDate: basicCreatedTask.entry.createdDate });
await tasksService.claimTask(completedTaskId.entry.id, simpleApp);
await tasksService.completeTask(completedTaskId.entry.id, simpleApp);
return tasksService.getTask(completedTaskId.entry.id, simpleApp);
};
const createSubTask = async function (createdTaskId) {
const subTaskId = await tasksService.createStandaloneSubtask(createdTaskId.entry.id, simpleApp, StringUtil.generateRandomString());
await tasksService.claimTask(subTaskId.entry.id, simpleApp);
return tasksService.getTask(subTaskId.entry.id, simpleApp);
};
const createTask = async function () {
const createdTaskId = await tasksService.createStandaloneTask(basicCreatedTaskName, simpleApp);
await tasksService.claimTask(createdTaskId.entry.id, simpleApp);
basicCreatedTask = await tasksService.getTask(createdTaskId.entry.id, simpleApp);
basicCreatedDate = moment(basicCreatedTask.entry.createdDate).format(formatDate);
return createdTaskId;
};
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole( [identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
unclaimedTask = await tasksService.createStandaloneTask(unclaimedTaskName, simpleApp);
const createdTaskId = await createTask();
completedTask = await createCompletedTask();
completedCreatedDate = moment(completedTask.entry.createdDate).format(formatDate);
dueDate = moment(completedTask.entry.dueDate).format(dateTimeFormat);
completedEndDate = moment(completedTask.entry.endDate).format(formatDate);
defaultDate = moment(completedTask.entry.createdDate).format(defaultFormat);
subTask = await createSubTask(createdTaskId);
subTaskCreatedDate = moment(subTask.entry.createdDate).format(formatDate);
await browser.sleep(3000);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
it('[C291943] Should display task details for assigned task', async () => {
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(basicCreatedTaskName);
await taskList.selectRow(basicCreatedTaskName);
await tasksCloudDemoPage.waitTillContentLoaded();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await expect(await taskHeaderCloudPage.getId()).toEqual(basicCreatedTask.entry.id);
await expect(await taskHeaderCloudPage.getDescription())
.toEqual(isValueInvalid(basicCreatedTask.entry.description) ? CONSTANTS.TASK_DETAILS.NO_DESCRIPTION : basicCreatedTask.entry.description);
await expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
await expect(await taskHeaderCloudPage.getPriority()).toEqual('None');
await expect(await taskHeaderCloudPage.getCategory()).toEqual(!basicCreatedTask.entry.category ?
CONSTANTS.TASK_DETAILS.NO_CATEGORY : basicCreatedTask.entry.category);
await expect(await taskHeaderCloudPage.getDueDate()).toEqual(isValueInvalid(basicCreatedTask.entry.dueDate) ?
CONSTANTS.TASK_DETAILS.NO_DATE : basicCreatedDate);
await expect(await taskHeaderCloudPage.getEndDate()).toEqual('');
await expect(await taskHeaderCloudPage.getCreated()).toEqual(basicCreatedDate);
await expect(await taskHeaderCloudPage.getAssignee()).toEqual(isValueInvalid(basicCreatedTask.entry.assignee) ? '' : basicCreatedTask.entry.assignee);
await expect(await taskHeaderCloudPage.getParentName()).toEqual(CONSTANTS.TASK_DETAILS.NO_PARENT);
});
it('[C291944] Should display task details for completed task', async () => {
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(completedTaskName);
await taskList.selectRow(completedTaskName);
await tasksCloudDemoPage.waitTillContentLoaded();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await expect(await taskHeaderCloudPage.getId()).toEqual(completedTask.entry.id);
await expect(await taskHeaderCloudPage.getDescription())
.toEqual(isValueInvalid(completedTask.entry.description) ? CONSTANTS.TASK_DETAILS.NO_DESCRIPTION : completedTask.entry.description);
await expect(await taskHeaderCloudPage.getStatus()).toEqual('COMPLETED');
await expect(await taskHeaderCloudPage.getReadonlyPriority()).toEqual('None');
await expect(await taskHeaderCloudPage.getCategory()).toEqual(!completedTask.entry.category ?
CONSTANTS.TASK_DETAILS.NO_CATEGORY : completedTask.entry.category);
await expect(await taskHeaderCloudPage.getDueDate()).toEqual(isValueInvalid(completedTask.entry.dueDate) ?
CONSTANTS.TASK_DETAILS.NO_DATE : dueDate);
await expect(await taskHeaderCloudPage.getEndDate()).toEqual(completedEndDate);
await expect(await taskHeaderCloudPage.getCreated()).toEqual(completedCreatedDate);
await expect(await taskHeaderCloudPage.getAssignee()).toEqual(isValueInvalid(completedTask.entry.assignee) ? '' : completedTask.entry.assignee);
await expect(await taskHeaderCloudPage.getParentName()).toEqual(CONSTANTS.TASK_DETAILS.NO_PARENT);
});
it('[C291945] Should Parent Name and Parent Id not be empty in task details for sub task', async () => {
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(subTask.entry.name);
await taskList.selectRow(subTask.entry.name);
await tasksCloudDemoPage.waitTillContentLoaded();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await expect(await taskHeaderCloudPage.getId()).toEqual(subTask.entry.id);
await expect(await taskHeaderCloudPage.getDescription())
.toEqual(isValueInvalid(subTask.entry.description) ? CONSTANTS.TASK_DETAILS.NO_DESCRIPTION : subTask.entry.description);
await expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
await expect(await taskHeaderCloudPage.getPriority()).toEqual('None');
await expect(await taskHeaderCloudPage.getCategory()).toEqual(!subTask.entry.category ?
CONSTANTS.TASK_DETAILS.NO_CATEGORY : subTask.entry.category);
await expect(await taskHeaderCloudPage.getDueDate()).toEqual(isValueInvalid(subTask.entry.dueDate) ? CONSTANTS.TASK_DETAILS.NO_DATE : subTaskCreatedDate);
await expect(await taskHeaderCloudPage.getEndDate()).toEqual('');
await expect(await taskHeaderCloudPage.getCreated()).toEqual(subTaskCreatedDate);
await expect(await taskHeaderCloudPage.getAssignee()).toEqual(isValueInvalid(subTask.entry.assignee) ? '' : subTask.entry.assignee);
await expect(await taskHeaderCloudPage.getParentName()).toEqual(basicCreatedTask.entry.name);
await expect(await taskHeaderCloudPage.getParentTaskId())
.toEqual(isValueInvalid(subTask.entry.parentTaskId) ? '' : subTask.entry.parentTaskId);
});
it('[C309698] Should validate the Priority field', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.clearAssignee();
await taskList.checkContentIsDisplayedByName(unclaimedTask.entry.name);
await taskList.selectRow(unclaimedTask.entry.name);
await tasksCloudDemoPage.waitTillContentLoaded();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
const currentAssignee = await taskHeaderCloudPage.assigneeCardTextItem.getFieldValue();
await expect(currentAssignee).toBe('No assignee');
await taskHeaderCloudPage.priorityCardSelectItem.checkElementIsReadonly();
await taskHeaderCloudPage.statusCardTextItem.checkElementIsReadonly();
});
it('[C291991] Should be able to assign a task only to the users that have access to the selected app', async () => {
await tasksCloudDemoPage.clickStartNewTaskButton();
const currentAssignee = await peopleCloudComponentPage.getChipAssignee();
await expect(currentAssignee).toContain(testUser.firstName, 'Invalid Assignee first name set for the new task');
await expect(currentAssignee).toContain(testUser.lastName, 'Invalid Assignee last name set for the new task');
await peopleCloudComponentPage.searchAssignee('hrUser');
await peopleCloudComponentPage.selectAssigneeFromList('HR User');
await peopleCloudComponentPage.checkSelectedPeople('HR User');
await peopleCloudComponentPage.searchAssignee('modeler');
await peopleCloudComponentPage.checkNoResultsFoundError();
});
describe('Default Date format', () => {
beforeEach(async () => {
await LocalStorageUtil.setConfigField('dateValues', '{' +
'"defaultDateFormat": "shortDate",' +
'"defaultDateTimeFormat": "M/d/yy, h:mm a",' +
'"defaultLocale": "uk"' +
'}');
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
it('[C311280] Should pick up the default date format from the app configuration', async () => {
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(completedTaskName);
await taskList.selectRow(completedTaskName);
await tasksCloudDemoPage.waitTillContentLoaded();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await expect(await taskHeaderCloudPage.getCreated()).toEqual(defaultDate);
});
});
});

View File

@@ -0,0 +1,231 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser } from 'protractor';
import {
StringUtil, TasksService,
LoginPage, ApiService,
AppListCloudPage, LocalStorageUtil, IdentityService, GroupIdentityService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { TaskListCloudConfiguration } from './../config/task-list-cloud.config';
describe('Edit task filters and task list properties', () => {
const SORT_ORDER = {
ASC: 'Ascending',
DESC: 'Descending'
};
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const apiService = new ApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
let createdTask, notDisplayedTask, noPriorityTask, lowPriorityTask, normalPriorityTask, hightPriorityTask, subTask,
otherOwnerTask, testUser, groupInfo;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole( [identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
otherOwnerTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(otherOwnerTask.entry.id, simpleApp);
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(createdTask.entry.id, simpleApp);
noPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 0 });
lowPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 1 });
normalPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 2 });
hightPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 3 });
await tasksService.claimTask(noPriorityTask.entry.id, simpleApp);
await tasksService.claimTask(lowPriorityTask.entry.id, simpleApp);
await tasksService.claimTask(normalPriorityTask.entry.id, simpleApp);
await tasksService.claimTask(hightPriorityTask.entry.id, simpleApp);
notDisplayedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(notDisplayedTask.entry.id, candidateBaseApp);
subTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { 'parentTaskId': createdTask.entry.id });
await tasksService.claimTask(subTask.entry.id, simpleApp);
const jsonFile = new TaskListCloudConfiguration().getConfiguration();
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-cloud-task-list', JSON.stringify(jsonFile));
await LocalStorageUtil.setConfigField('adf-edit-task-filter', JSON.stringify({
'filterProperties': [
'taskId',
'appName',
'status',
'assignee',
'taskName',
'parentTaskId',
'priority',
'standalone',
'owner',
'processDefinitionId',
'processInstanceId',
'lastModified',
'sort',
'order'
],
'sortProperties': [
'id',
'name',
'createdDate',
'priority',
'processDefinitionId',
'processInstanceId',
'parentTaskId',
'priority',
'standalone',
'owner',
'assignee'
],
'actions': [
'save',
'saveAs',
'delete'
]
}));
}, 5 * 60 * 1000);
afterAll(async (done) => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
done();
});
describe('Edit task filters and task list properties - sort properties', () => {
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await editTaskFilter.openFilter();
await taskFilter.checkTaskFilterIsDisplayed('my-tasks');
});
it('[C306901] Should display tasks sorted by task name when taskName is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('Assigned');
await editTaskFilter.setSortFilterDropDown('name');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Name')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Name')).toBe(true);
});
it('[C290156] Should display tasks ordered by id when Id is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('Assigned');
await editTaskFilter.setSortFilterDropDown('id');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Id')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Id')).toBe(true);
});
it('[C306903] Should display tasks sorted by processDefinitionId when processDefinitionId is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('Assigned');
await editTaskFilter.setSortFilterDropDown('processDefinitionId');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'ProcessDefinitionId')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'ProcessDefinitionId')).toBe(true);
});
it('[C306905] Should display tasks sorted by processInstanceId when processInstanceId is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('Assigned');
await editTaskFilter.setSortFilterDropDown('processInstanceId');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'ProcessInstanceId')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'ProcessInstanceId')).toBe(true);
});
it('[C306907] Should display tasks sorted by assignee when assignee is selected from sort dropdown', async () => {
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.setSortFilterDropDown('assignee');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Assignee')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Assignee')).toBe(true);
});
it('[C306911] Should display tasks sorted by parentTaskId when parentTaskId is selected from sort dropdown', async () => {
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.setSortFilterDropDown('parentTaskId');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'ParentTaskId')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'ParentTaskId')).toBe(true);
});
it('[C290087] Should display tasks ordered by priority when Priority is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.setSortFilterDropDown('priority');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Priority', 'PRIORITY')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Priority', 'PRIORITY')).toBe(true);
});
it('[C307115] Should display tasks sorted by owner when owner is selected from sort dropdown', async () => {
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.setSortFilterDropDown('owner');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Owner')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
await expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Owner')).toBe(true);
});
});
});

View File

@@ -0,0 +1,272 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser } from 'protractor';
import {
StringUtil, TasksService,
ProcessDefinitionsService, ProcessInstancesService,
LoginPage, ApiService,
AppListCloudPage, LocalStorageUtil, IdentityService, GroupIdentityService, DateUtil
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { TaskListCloudConfiguration } from './../config/task-list-cloud.config';
import moment = require('moment');
import { taskFilterConfiguration } from './../config/task-filter.config';
describe('Edit task filters and task list properties', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const apiService = new ApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const noTasksFoundMessage = 'No Tasks Found';
let createdTask, notAssigned, notDisplayedTask, processDefinition, processInstance, priorityTask, subTask,
otherOwnerTask, testUser, groupInfo, simpleTask;
const priority = 1;
const beforeDate = moment().add(-1, 'days').format('DD/MM/YYYY');
const currentDate = DateUtil.formatDate('DD/MM/YYYY');
const afterDate = moment().add(1, 'days').format('DD/MM/YYYY');
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
otherOwnerTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(otherOwnerTask.entry.id, simpleApp);
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(createdTask.entry.id, simpleApp);
simpleTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
notAssigned = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
priorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: priority });
await tasksService.claimTask(priorityTask.entry.id, simpleApp);
notDisplayedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(notDisplayedTask.entry.id, candidateBaseApp);
processDefinition = await processDefinitionService
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.dropdownrestprocess, simpleApp);
processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
subTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { 'parentTaskId': createdTask.entry.id });
await tasksService.claimTask(subTask.entry.id, simpleApp);
const jsonFile = new TaskListCloudConfiguration().getConfiguration();
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-cloud-task-list', JSON.stringify(jsonFile));
await LocalStorageUtil.setConfigField('adf-edit-task-filter', JSON.stringify(taskFilterConfiguration));
}, 5 * 60 * 1000);
afterAll(async (done) => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
done();
});
describe('Edit task filters and task list properties - filter properties', () => {
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await editTaskFilter.openFilter();
await taskFilter.checkTaskFilterIsDisplayed('my-tasks');
});
it('[C292004] Filter by appName', async () => {
await expect(await editTaskFilter.getAppNameDropDownValue()).toEqual(simpleApp);
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(notDisplayedTask.entry.name);
await editTaskFilter.setAppNameDropDown(candidateBaseApp);
await expect(await editTaskFilter.getAppNameDropDownValue()).toEqual(candidateBaseApp);
await taskList.checkContentIsDisplayedByName(notDisplayedTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C291906] Should be able to see only the task with specific taskId when typing it in the task Id field', async () => {
await editTaskFilter.setId(createdTask.entry.id);
await expect(await editTaskFilter.getId()).toEqual(createdTask.entry.id);
await taskList.checkContentIsDisplayedById(createdTask.entry.id);
await taskList.getRowsWithSameId(createdTask.entry.id).then(async (list) => {
await expect(list.length).toEqual(1);
});
});
it('[C291907] Should be able to see No tasks found when typing an invalid task id', async () => {
await editTaskFilter.setId('invalidId');
await expect(await editTaskFilter.getId()).toEqual('invalidId');
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297476] Filter by taskName', async () => {
await editTaskFilter.setTaskName(createdTask.entry.name);
await expect(await editTaskFilter.getTaskName()).toEqual(createdTask.entry.name);
await taskList.getRowsWithSameName(createdTask.entry.name).then(async (list) => {
await expect(list.length).toEqual(1);
});
});
it('[C297613] Should be able to see No tasks found when typing a task name that does not exist', async () => {
await editTaskFilter.setTaskName('invalidName');
await expect(await editTaskFilter.getTaskName()).toEqual('invalidName');
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297480] Should be able to see only tasks that are part of a specific process when processInstanceId is set', async () => {
await editTaskFilter.setProcessInstanceId(processInstance.entry.id);
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.clearAssignee();
await expect(await taskList.getDataTable().getNumberOfRows()).toBe(1);
await taskList.checkContentIsDisplayedByProcessInstanceId(processInstance.entry.id);
});
it('[C297684] Should be able to see No tasks found when typing an invalid processInstanceId', async () => {
await editTaskFilter.setProcessInstanceId('invalidTaskId');
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297478] Should be able to see only tasks that are assigned to a specific user when assignee is set', async () => {
await editTaskFilter.setAssignee(testUser.username);
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(notAssigned.entry.name);
});
it('[C297686] Should be able to see No tasks found when typing an invalid user to assignee field', async () => {
await editTaskFilter.setAssignee('invalid');
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297482] Should be able to see only tasks with specific priority when priority is set', async () => {
await editTaskFilter.setPriority('Low');
await taskList.checkContentIsDisplayedByName(priorityTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297687] Should be able to see No tasks found when typing unused value for priority field', async () => {
await editTaskFilter.setPriority('Normal');
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297481] Should be able to see only tasks with specific parentTaskId when parentTaskId is set', async () => {
await editTaskFilter.setParentTaskId(subTask.entry.parentTaskId);
await taskList.checkContentIsDisplayedByName(subTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297486] Filter by Owner', async () => {
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.clearAssignee();
await editTaskFilter.setOwner(testUser.username);
await taskList.checkContentIsDisplayedByName(notAssigned.entry.name);
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await editTaskFilter.setOwner('invalid');
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297484] Task is displayed when typing into lastModifiedFrom field a date before the task CreatedDate', async () => {
await editTaskFilter.setLastModifiedFrom(beforeDate);
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await editTaskFilter.setLastModifiedFrom(afterDate);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297689] Task is not displayed when typing into lastModifiedFrom field the same date as tasks CreatedDate', async () => {
await editTaskFilter.setLastModifiedFrom(currentDate);
await editTaskFilter.setTaskName(simpleTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(simpleTask.entry.name);
});
it('[C297485] Task is displayed when typing into lastModifiedTo field a date after the task CreatedDate', async () => {
await editTaskFilter.setLastModifiedTo(afterDate);
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await editTaskFilter.setLastModifiedTo(beforeDate);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297690] Task is not displayed when typing into lastModifiedTo field the same date as tasks CreatedDate', async () => {
await editTaskFilter.setLastModifiedTo(currentDate);
await editTaskFilter.setTaskName(simpleTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(simpleTask.entry.name);
});
it('[C297691] Task is not displayed when typing into lastModifiedFrom field a date before the task due date ' +
'and into lastModifiedTo a date before task due date', async () => {
await editTaskFilter.setLastModifiedFrom(beforeDate);
await editTaskFilter.setLastModifiedTo(beforeDate);
await editTaskFilter.setTaskName(createdTask.entry.name);
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297692] Task is displayed when typing into lastModifiedFrom field a date before the tasks due date ' +
'and into lastModifiedTo a date after', async () => {
await editTaskFilter.setLastModifiedFrom(beforeDate);
await editTaskFilter.setLastModifiedTo(afterDate);
await editTaskFilter.setTaskName(createdTask.entry.name);
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
});
it('[C297693] Task is not displayed when typing into lastModifiedFrom field a date after the tasks due date ' +
'and into lastModifiedTo a date after', async () => {
await editTaskFilter.setLastModifiedFrom(afterDate);
await editTaskFilter.setLastModifiedTo(afterDate);
await expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
});
});

View File

@@ -0,0 +1,184 @@
/*!
* @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,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LoginPage,
StringUtil,
TasksService
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Task list cloud - selection', () => {
describe('Task list cloud - selection', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const apiService = new ApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const noOfTasks = 3;
let response, testUser, groupInfo;
const tasks = [];
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
for (let i = 0; i < noOfTasks; i++) {
response = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(response.entry.id, simpleApp);
tasks.push(response.entry.name);
}
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await taskFilter.checkTaskFilterIsDisplayed('my-tasks');
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
});
it('[C291914] Should not be able to select any row when selection mode is set to None', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.selectSelectionMode('None');
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkNoRowIsSelected();
});
it('[C291918] Should be able to select only one row when selection mode is set to Single', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.selectSelectionMode('Single');
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[0]);
await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().getNumberOfSelectedRows()).toEqual(1);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[1]);
await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().getNumberOfSelectedRows()).toEqual(1);
});
it('[C291919] Should be able to select only one row when selection mode is set to Multiple', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.enableMultiSelection();
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().selectRowWithKeyboard(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsNotSelected(tasks[2]);
});
it('[C291916] Should be able to select multiple row when multiselect is true', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[2]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsNotChecked(tasks[2]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsNotChecked(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[0]);
});
it('[C291915] Should be possible select all the rows when multiselect is true', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkAllRowsButtonIsDisplayed();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkAllRows();
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[2]);
});
it('[C297472] Should be able to see selected tasks with Multiselection and Testing switched on', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.enableMultiSelection();
await tasksCloudDemoPage.enableTestingMode();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[1]);
await expect(await tasksCloudDemoPage.getNoOfSelectedRows()).toBe(2);
await expect(await tasksCloudDemoPage.getSelectedTaskRowText('1')).toBe(tasks[0]);
await expect(await tasksCloudDemoPage.getSelectedTaskRowText('2')).toBe(tasks[1]);
});
});
});

View File

@@ -0,0 +1,209 @@
/*!
* @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,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LocalStorageUtil,
LoginPage,
ProcessDefinitionsService,
ProcessInstancesService, StatusType,
TaskFormCloudComponent,
TaskHeaderCloudPage
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { ProcessInstanceCloud } from '@alfresco/adf-process-services-cloud';
import { taskFilterConfiguration } from './../config/task-filter.config';
describe('Task claim/release', () => {
const candidateApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const taskFormCloudComponent = new TaskFormCloudComponent();
const apiService = new ApiService();
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
let processInstance: ProcessInstanceCloud;
describe('candidate user', () => {
beforeAll(async () => {
await apiService.login(browser.params.testConfig.users.hrUser.username, browser.params.testConfig.users.hrUser.password);
const processDefinition = await processDefinitionService.getProcessDefinitionByName(candidateApp.processes.candidateUserProcess, candidateApp.name);
processInstance = (await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateApp.name)).entry;
});
beforeEach(async () => {
await navigateToApp(browser.params.testConfig.users.hrUser);
});
afterAll(async () => {
await processInstancesService.deleteProcessInstance(processInstance.id, processInstance.appName);
await navigationBarPage.clickLogoutButton();
});
it('[C306874] Should be able to Claim/Release a process task which has a candidate user', async () => {
await setTaskFilter('Created', processInstance.id);
await taskList.checkContentIsDisplayedByName(candidateApp.tasks.candidateUserTask);
await taskList.selectRow(candidateApp.tasks.candidateUserTask);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
await expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
await taskFormCloudComponent.clickClaimButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsDisplayed();
await expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
await expect(await taskHeaderCloudPage.getAssignee()).toEqual(browser.params.testConfig.users.hrUser.username);
await taskFormCloudComponent.clickReleaseButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
await expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
await expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
});
});
describe('candidate group', () => {
let identityService: IdentityService;
let groupIdentityService: GroupIdentityService;
let candidate;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
identityService = new IdentityService(apiService);
groupIdentityService = new GroupIdentityService(apiService);
candidate = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
const groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(candidate.idIdentityService, groupInfo.id);
await apiService.login(browser.params.testConfig.users.hrUser.username, browser.params.testConfig.users.hrUser.password);
const processDefinition = await processDefinitionService.getProcessDefinitionByName(candidateApp.processes.uploadFileProcess, candidateApp.name);
processInstance = (await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateApp.name)).entry;
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(candidate.idIdentityService);
await apiService.login(browser.params.testConfig.users.hrUser.username, browser.params.testConfig.users.hrUser.password);
await processInstancesService.deleteProcessInstance(processInstance.id, processInstance.appName);
await navigationBarPage.clickLogoutButton();
});
it('[C306875] should be able to Claim/Release a process task which has a candidate group', async () => {
await navigateToApp(browser.params.testConfig.users.hrUser);
await setTaskFilter('Created', processInstance.id);
await taskList.checkContentIsDisplayedByName(candidateApp.tasks.uploadFileTask);
await taskList.selectRow(candidateApp.tasks.uploadFileTask);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
await expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
await expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
await taskFormCloudComponent.clickClaimButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsDisplayed();
await expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
await expect(await taskHeaderCloudPage.getAssignee()).toEqual(browser.params.testConfig.users.hrUser.username);
await taskFormCloudComponent.clickReleaseButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
await expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
await expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
await navigationBarPage.clickLogoutButton();
await navigateToApp(candidate);
await setTaskFilter('Created', processInstance.id);
await taskList.checkContentIsDisplayedByName(candidateApp.tasks.uploadFileTask);
await taskList.selectRow(candidateApp.tasks.uploadFileTask);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
await expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
await expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
await taskFormCloudComponent.clickClaimButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsDisplayed();
await expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
await expect(await taskHeaderCloudPage.getAssignee()).toEqual(candidate.username);
await taskFormCloudComponent.clickReleaseButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
await expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
await expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
});
});
async function navigateToApp(user: { username: string; password: string }) {
await loginSSOPage.login(user.username, user.password);
await LocalStorageUtil.setConfigField('adf-edit-task-filter', JSON.stringify(taskFilterConfiguration));
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(candidateApp.name);
await taskList.getDataTable().waitForTableBody();
}
async function setTaskFilter(status: StatusType, processInstanceId: string) {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown(status);
await editTaskFilter.setProcessInstanceId(processInstanceId);
await editTaskFilter.openFilter();
}
});

View File

@@ -0,0 +1,187 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser } from 'protractor';
import {
StringUtil,
TasksService,
QueryService,
ProcessDefinitionsService,
ProcessInstancesService,
LoginPage,
ApiService,
IdentityService,
GroupIdentityService,
AppListCloudPage, TaskListCloudComponentPage
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Task filters cloud', () => {
describe('Filters', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskList = new TaskListCloudComponentPage();
const apiService = new ApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const queryService = new QueryService(apiService);
const createdTaskName = StringUtil.generateRandomString(),
completedTaskName = StringUtil.generateRandomString(),
assignedTaskName = StringUtil.generateRandomString(), deletedTaskName = StringUtil.generateRandomString();
let assignedTask, deletedTask, testUser, groupInfo;
const orderByNameAndPriority = ['cCreatedTask', 'dCreatedTask', 'eCreatedTask'];
let priority = 1;
const nrOfTasks = 3;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole( [identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
await tasksService.createStandaloneTask(createdTaskName, simpleApp);
assignedTask = await tasksService.createStandaloneTask(assignedTaskName, simpleApp);
await tasksService.claimTask(assignedTask.entry.id, simpleApp);
await tasksService.createAndCompleteTask(completedTaskName, simpleApp);
deletedTask = await tasksService.createStandaloneTask(deletedTaskName, simpleApp);
await tasksService.deleteTask(deletedTask.entry.id, simpleApp);
for (let i = 0; i < nrOfTasks; i++) {
await tasksService.createStandaloneTask(orderByNameAndPriority[i], simpleApp, { priority: priority });
priority = priority + 1;
}
const processDefinition = await processDefinitionService
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.simpleProcess, simpleApp);
const processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
const secondProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
await queryService.getProcessInstanceTasks(secondProcessInstance.entry.id, simpleApp);
await processInstancesService.suspendProcessInstance(processInstance.entry.id, simpleApp);
await processInstancesService.deleteProcessInstance(secondProcessInstance.entry.id, simpleApp);
await queryService.getProcessInstanceTasks(processInstance.entry.id, simpleApp);
await loginSSOPage.login(testUser.username, testUser.password);
}, 5 * 60 * 1000);
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
}, 60000);
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await taskList.getDataTable().waitForTableBody();
});
it('[C290045] Should display only tasks with Assigned status when Assigned is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.setStatusFilterDropDown('Assigned');
await taskList.checkContentIsDisplayedByName(assignedTaskName);
await taskList.checkContentIsNotDisplayedByName(createdTaskName);
await taskList.checkContentIsNotDisplayedByName(completedTaskName);
await taskList.checkContentIsNotDisplayedByName(deletedTaskName);
});
it('[C290061] Should display only tasks with Completed status when Completed is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.setStatusFilterDropDown('Completed');
await taskList.checkContentIsDisplayedByName(completedTaskName);
await taskList.checkContentIsNotDisplayedByName(assignedTaskName);
await taskList.checkContentIsNotDisplayedByName(createdTaskName);
await taskList.checkContentIsNotDisplayedByName(deletedTaskName);
});
it('[C290139] Should display only tasks with all statuses when All is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('All');
await taskList.checkContentIsDisplayedByName(deletedTaskName);
await taskList.checkContentIsDisplayedByName(assignedTaskName);
await taskList.checkContentIsDisplayedByName(createdTaskName);
await taskList.checkContentIsDisplayedByName(completedTaskName);
});
it('[C290060] Should display only tasks with Created status when Created is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Created');
await taskList.checkContentIsDisplayedByName(createdTaskName);
await taskList.checkContentIsNotDisplayedByName(assignedTaskName);
await taskList.checkContentIsNotDisplayedByName(completedTaskName);
await taskList.checkContentIsNotDisplayedByName(deletedTaskName);
});
it('[C290155] Should display only tasks with Cancelled status when Cancelled is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Cancelled');
await taskList.checkContentIsDisplayedByName(deletedTaskName);
await taskList.checkContentIsNotDisplayedByName(assignedTaskName);
await taskList.checkContentIsNotDisplayedByName(completedTaskName);
await taskList.checkContentIsNotDisplayedByName(createdTaskName);
});
describe('Dropdown', () => {
let taskAssigned;
beforeEach(async () => {
const processDefinition = await processDefinitionService
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.dropdownrestprocess, simpleApp);
const processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
taskAssigned = await queryService.getProcessInstanceTasks(processInstance.entry.id, simpleApp);
await processInstancesService.suspendProcessInstance(processInstance.entry.id, simpleApp);
});
it('[C317658] Should display only tasks with Suspended status when SUSPENDED is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Suspended');
await taskList.checkContentIsDisplayedByName(taskAssigned.list.entries[0].entry.name);
});
});
});
});