mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-24 14:31:41 +00:00
* bug fixes * bug fixes * bug fixes * cleanup tests * travis workaround * travis workaround * travis workaround * travis workaround * travis workaround * travis workaround * Revert "travis workaround" This reverts commit b67efccfb0aab8c7f6b9235d01525487771b8123. * Revert "travis workaround" This reverts commit 448f4e6d1211771e914f35183860af6df3452c16. * Revert "travis workaround" This reverts commit 542fae649c0501a9150ccac2e5a2cd54ee39a690. * Revert "travis workaround" This reverts commit 12f58568fbb0f8d2defb4c21a3ab1683bc8aa312. * Revert "travis workaround" This reverts commit b0ffef3bee0f81faf6088be8b5c2b072ad2762e7. * Revert "travis workaround" This reverts commit c6d95a2ff3b38b543fea83d3fc53016ac657b3bb. * service fixes * remove junk tests * code fixes * reduce code complexity * update e2e * update e2e * fix i18n * e2e fixes * bug fixes * rebase and fix * properly serialize query params * rework process filters demo * remove dead code * code fixes * code fixes * e2e improvements * fix bug and remove e2e testing a bug * bug fixes for date ranges * fix e2e * fix unit test * reusable code * fix flaky e2e * fix angular cli version * remove useless e2e (already tested by unit tests) * remove useless e2e (already tested by unit tests) * demo shell fixes * remove fit * disable flaky test * update code as per review suggestions * fix after rebase * fix after rebase
299 lines
15 KiB
TypeScript
299 lines
15 KiB
TypeScript
/*!
|
|
* @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,
|
|
BrowserActions,
|
|
FilterProps,
|
|
GroupIdentityService,
|
|
IdentityService,
|
|
LocalStorageUtil,
|
|
LoginPage,
|
|
ProcessDefinitionsService,
|
|
ProcessInstancesService,
|
|
QueryService,
|
|
StringUtil,
|
|
TasksService
|
|
} 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 { EditProcessFilterConfiguration } from './config/edit-process-filter.config';
|
|
import { ProcessListCloudConfiguration } from './config/process-list-cloud.config';
|
|
|
|
describe('Process list cloud', () => {
|
|
|
|
// en-US values for the process status
|
|
const PROCESS_STATUS = {
|
|
ALL: 'All',
|
|
RUNNING: 'Running',
|
|
SUSPENDED: 'Suspended',
|
|
COMPLETED: 'Completed'
|
|
};
|
|
|
|
// en-US values for the sort direction
|
|
const SORT_DIRECTION = {
|
|
ASC: 'Ascending',
|
|
DESC: 'Descending'
|
|
};
|
|
|
|
describe('Process List', () => {
|
|
|
|
const loginSSOPage = new LoginPage();
|
|
const navigationBarPage = new NavigationBarPage();
|
|
const appListCloudComponent = new AppListCloudPage();
|
|
|
|
const processCloudDemoPage = new ProcessCloudDemoPage();
|
|
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
|
|
const processList = processCloudDemoPage.processListCloudComponent();
|
|
|
|
const tasksCloudDemoPage = new TasksCloudDemoPage();
|
|
|
|
const apiService = new ApiService();
|
|
const identityService = new IdentityService(apiService);
|
|
const groupIdentityService = new GroupIdentityService(apiService);
|
|
const processDefinitionService = new ProcessDefinitionsService(apiService);
|
|
const processInstancesService = new ProcessInstancesService(apiService);
|
|
const queryService = new QueryService(apiService);
|
|
const tasksService = new TasksService(apiService);
|
|
|
|
const processListCloudConfiguration = new ProcessListCloudConfiguration();
|
|
const editProcessFilterConfiguration = new EditProcessFilterConfiguration();
|
|
const processListCloudConfigFile = processListCloudConfiguration.getConfiguration();
|
|
const editProcessFilterConfigFile = editProcessFilterConfiguration.getConfiguration();
|
|
|
|
let completedProcess, runningProcessInstance, switchProcessInstance, noOfApps, testUser, groupInfo,
|
|
anotherProcessInstance;
|
|
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
|
|
|
|
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 processDefinition = await processDefinitionService
|
|
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.candidateGroupProcess, candidateBaseApp);
|
|
|
|
const anotherProcessDefinition = await processDefinitionService
|
|
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.anotherCandidateGroupProcess, candidateBaseApp);
|
|
|
|
await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
|
|
|
|
runningProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
|
|
'name': StringUtil.generateRandomString(),
|
|
'businessKey': StringUtil.generateRandomString()
|
|
});
|
|
|
|
anotherProcessInstance = await processInstancesService.createProcessInstance(anotherProcessDefinition.entry.key, candidateBaseApp, {
|
|
'name': StringUtil.generateRandomString(),
|
|
'businessKey': StringUtil.generateRandomString()
|
|
});
|
|
|
|
switchProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
|
|
'name': StringUtil.generateRandomString(),
|
|
'businessKey': StringUtil.generateRandomString()
|
|
});
|
|
|
|
completedProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
|
|
'name': StringUtil.generateRandomString(),
|
|
'businessKey': StringUtil.generateRandomString()
|
|
});
|
|
|
|
const task = await queryService.getProcessInstanceTasks(completedProcess.entry.id, candidateBaseApp);
|
|
const claimedTask = await tasksService.claimTask(task.list.entries[0].entry.id, candidateBaseApp);
|
|
await tasksService.completeTask(claimedTask.entry.id, candidateBaseApp);
|
|
|
|
await loginSSOPage.login(testUser.username, testUser.password);
|
|
await LocalStorageUtil.setConfigField('adf-edit-process-filter', JSON.stringify(editProcessFilterConfigFile));
|
|
await LocalStorageUtil.setConfigField('adf-cloud-process-list', JSON.stringify(processListCloudConfigFile));
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await apiService.login(testUser.username, testUser.password);
|
|
await processInstancesService.deleteProcessInstance(anotherProcessInstance.entry.id, candidateBaseApp);
|
|
await apiService.loginWithProfile('identityAdmin');
|
|
await identityService.deleteIdentityUser(testUser.idIdentityService);
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
await navigationBarPage.navigateToProcessServicesCloudPage();
|
|
await appListCloudComponent.checkApsContainer();
|
|
await appListCloudComponent.goToApp(candidateBaseApp);
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
|
|
await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters();
|
|
});
|
|
|
|
function setFilter(props: FilterProps): Promise<void> {
|
|
return editProcessFilter.setFilter(props);
|
|
}
|
|
|
|
async function waitTillContentLoaded() {
|
|
await processList.getDataTable().waitTillContentLoaded();
|
|
}
|
|
|
|
it('[C290069] Should display processes ordered by name when Name is selected from sort dropdown', async () => {
|
|
await setFilter({ status: PROCESS_STATUS.RUNNING, sort: 'Name', order: SORT_DIRECTION.ASC });
|
|
await waitTillContentLoaded();
|
|
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Name')).toBe(true);
|
|
|
|
await setFilter({ order: SORT_DIRECTION.DESC});
|
|
await waitTillContentLoaded();
|
|
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Name')).toBe(true);
|
|
});
|
|
|
|
it('[C291783] Should display processes ordered by id when Id is selected from sort dropdown', async () => {
|
|
await setFilter({ status: PROCESS_STATUS.RUNNING, sort: 'Id', order: SORT_DIRECTION.ASC });
|
|
await waitTillContentLoaded();
|
|
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Id')).toBe(true);
|
|
|
|
await setFilter({ order: SORT_DIRECTION.DESC});
|
|
await waitTillContentLoaded();
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Id')).toBe(true);
|
|
});
|
|
|
|
it('[C305054] Should display processes ordered by status when Status is selected from sort dropdown', async () => {
|
|
await setFilter({ status: PROCESS_STATUS.ALL, sort: 'Status', order: SORT_DIRECTION.ASC });
|
|
await waitTillContentLoaded();
|
|
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Status')).toBe(true);
|
|
|
|
await setFilter({ order: SORT_DIRECTION.DESC});
|
|
await waitTillContentLoaded();
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Status')).toBe(true);
|
|
});
|
|
|
|
it('[C305054] Should display processes ordered by started by when Started By is selected from sort dropdown', async () => {
|
|
await setFilter({ status: PROCESS_STATUS.ALL, sort: 'Started by', order: SORT_DIRECTION.ASC });
|
|
await waitTillContentLoaded();
|
|
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Started by')).toBe(true);
|
|
|
|
await setFilter({ order: SORT_DIRECTION.DESC});
|
|
await waitTillContentLoaded();
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Started by')).toBe(true);
|
|
});
|
|
|
|
it('[C305054] Should display processes ordered by processdefinitionid date when ProcessDefinitionId is selected from sort dropdown', async () => {
|
|
await setFilter({ status: PROCESS_STATUS.ALL, sort: 'ProcessDefinitionId', order: SORT_DIRECTION.ASC });
|
|
await waitTillContentLoaded();
|
|
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Process Definition Id')).toBe(true);
|
|
|
|
await setFilter({ order: SORT_DIRECTION.DESC});
|
|
await waitTillContentLoaded();
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Process Definition Id')).toBe(true);
|
|
});
|
|
|
|
it('[C305054] Should display processes ordered by processdefinitionkey date when ProcessDefinitionKey is selected from sort dropdown', async () => {
|
|
await setFilter({ status: PROCESS_STATUS.ALL, sort: 'ProcessDefinitionKey', order: SORT_DIRECTION.ASC });
|
|
await waitTillContentLoaded();
|
|
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Process Definition Key')).toBe(true);
|
|
|
|
await setFilter({ order: SORT_DIRECTION.DESC});
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Process Definition Key')).toBe(true);
|
|
});
|
|
|
|
it('[C305054] Should display processes ordered by last modified date when Last Modified is selected from sort dropdown', async () => {
|
|
await setFilter({ status: PROCESS_STATUS.ALL, sort: 'Last Modified', order: SORT_DIRECTION.ASC });
|
|
await waitTillContentLoaded();
|
|
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Last Modified')).toBe(true);
|
|
|
|
await setFilter({ order: SORT_DIRECTION.DESC });
|
|
await waitTillContentLoaded();
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Last Modified')).toBe(true);
|
|
});
|
|
|
|
it('[C305054] Should display processes ordered by business key date when BusinessKey is selected from sort dropdown', async () => {
|
|
await setFilter({ status: PROCESS_STATUS.ALL, sort: 'Business Key', order: SORT_DIRECTION.ASC });
|
|
await waitTillContentLoaded();
|
|
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Business Key')).toBe(true);
|
|
|
|
await setFilter({ order: SORT_DIRECTION.DESC});
|
|
await waitTillContentLoaded();
|
|
await expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Business Key')).toBe(true);
|
|
});
|
|
|
|
it('[C297697] The value of the filter should be preserved when saving it', async () => {
|
|
await processCloudDemoPage.processFilterCloudComponent.clickAllProcessesFilter();
|
|
await editProcessFilter.openFilter();
|
|
await editProcessFilter.setProcessInstanceId(completedProcess.entry.id);
|
|
|
|
await editProcessFilter.saveAs('New');
|
|
|
|
await expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('New');
|
|
|
|
await processList.checkContentIsDisplayedById(completedProcess.entry.id);
|
|
await expect(await processList.getDataTable().numberOfRows()).toBe(1);
|
|
|
|
await editProcessFilter.openFilter();
|
|
|
|
await expect(await editProcessFilter.getProcessInstanceId()).toEqual(completedProcess.entry.id);
|
|
});
|
|
|
|
it('[C297646] Should display the filter dropdown fine , after switching between saved filters', async () => {
|
|
await editProcessFilter.openFilter();
|
|
noOfApps = await editProcessFilter.getNumberOfAppNameOptions();
|
|
|
|
await expect(await editProcessFilter.checkAppNamesAreUnique()).toBe(true);
|
|
await BrowserActions.closeMenuAndDialogs();
|
|
await editProcessFilter.setStatusFilterDropDown(PROCESS_STATUS.RUNNING);
|
|
await editProcessFilter.setAppNameDropDown(candidateBaseApp);
|
|
await editProcessFilter.setProcessInstanceId(runningProcessInstance.entry.id);
|
|
await waitTillContentLoaded();
|
|
|
|
await processList.checkContentIsDisplayedById(runningProcessInstance.entry.id);
|
|
await expect(await editProcessFilter.getNumberOfAppNameOptions()).toBe(noOfApps);
|
|
await expect(await editProcessFilter.checkAppNamesAreUnique()).toBe(true);
|
|
await BrowserActions.closeMenuAndDialogs();
|
|
|
|
await editProcessFilter.saveAs('SavedFilter');
|
|
await expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('SavedFilter');
|
|
|
|
await editProcessFilter.openFilter();
|
|
await expect(await editProcessFilter.getProcessInstanceId()).toEqual(runningProcessInstance.entry.id);
|
|
|
|
await editProcessFilter.setStatusFilterDropDown(PROCESS_STATUS.RUNNING);
|
|
await editProcessFilter.setAppNameDropDown(candidateBaseApp);
|
|
await editProcessFilter.setProcessInstanceId(switchProcessInstance.entry.id);
|
|
await waitTillContentLoaded();
|
|
|
|
await processList.checkContentIsDisplayedById(switchProcessInstance.entry.id);
|
|
await editProcessFilter.saveAs('SwitchFilter');
|
|
await expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('SwitchFilter');
|
|
|
|
await editProcessFilter.openFilter();
|
|
await expect(await editProcessFilter.getProcessInstanceId()).toEqual(switchProcessInstance.entry.id);
|
|
await expect(await editProcessFilter.getNumberOfAppNameOptions()).toBe(noOfApps);
|
|
await expect(await editProcessFilter.checkAppNamesAreUnique()).toBe(true);
|
|
await BrowserActions.closeMenuAndDialogs();
|
|
});
|
|
|
|
});
|
|
});
|