mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
* update project script possible different JS-API * first commit no controll flow * second commit no controll flow * third commit no controll flow * 4 commit no controll flow * 5 commit no controll flow * 6 commit no controll flow * 7 commit no controll flow * 8 commit no controll flow * 9 commit no controll flow * 10 commit no controll flow * 11 commit no controll flow * 12 commit no controll flow * 13 commit no controll flow * 14 commit no controll flow * 15 commit no controll flow * 16 commit no controll flow * 17 commit no controll flow * 18 commit no controll flow * 19 commit no controll flow * 20 commit no controll flow * remove wdpromise, protractor promise and deferred promises * - fixed some incorrect “expect” calls - fixed some matchers - removed “return this;” when not needed - added a few more await-s * forgot a file * fix some failing tests * replaced driver calls with browser calls and enabled back waitForAngular * fix rightClick methods and hopefully some tests * fix settings-component * some more fixes for core and content tests * try to fix some more issues * linting * revert some changes, allowing download on headless chrome won’t work with multiple browser instances * fixes for Search tests * try to remove some wait calls * fix build * increase allScriptsTimeout and try another protractor and web driver version * improve navigation methods * some fixes for notification history and login sso * forgot a space * fix packages and enable some screenshots * navigation bar fixes * fix some test * some fixes for notification history and navigation bar use correct visibility method in attachFileWidget test * fix searching and another fix for navigation * try solve sso login * some more fixes * refactor async forEach into for..of * try fix for search tests * resolve rebabse problems * remove install * fix lint * fix core e2e * fix core e2e * fix core e2e * fix ps tests * fix some tests * fix core e2e * fix core e2e * fix core * fix some issues PS * fix core * fix core * fix some ps test * fix rebase issues * remove save * fix url regressed after rebase * fix url regressed after rebase * fix ps and core * fix lint * more parallel e2e ps * fix some ps cloud test * some cloud fix * fix lint * fix some test * remove files to be ignored * out-tsc * improve one cs test * fix candidate base app * fix ps test * remove click function * clean methods alrady present in browser action * try ugly wait * move wait * remove duplicate call * remove underscore * fix after review * fix imports * minor cosmetic fixes * fix comments test
262 lines
14 KiB
TypeScript
262 lines
14 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 { browser, protractor } from 'protractor';
|
|
import {
|
|
AppListCloudPage,
|
|
StringUtil,
|
|
ApiService,
|
|
LoginSSOPage,
|
|
TasksService,
|
|
ProcessDefinitionsService,
|
|
ProcessInstancesService,
|
|
SettingsPage,
|
|
TaskHeaderCloudPage,
|
|
TaskFormCloudComponent,
|
|
Widget, IdentityService, GroupIdentityService
|
|
} from '@alfresco/adf-testing';
|
|
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
|
|
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
|
|
|
|
import resources = require('../util/resources');
|
|
|
|
describe('Task form cloud component', () => {
|
|
|
|
const loginSSOPage = new LoginSSOPage();
|
|
const navigationBarPage = new NavigationBarPage();
|
|
const appListCloudComponent = new AppListCloudPage();
|
|
const tasksCloudDemoPage = new TasksCloudDemoPage();
|
|
const taskHeaderCloudPage = new TaskHeaderCloudPage();
|
|
const taskFormCloudComponent = new TaskFormCloudComponent();
|
|
const settingsPage = new SettingsPage();
|
|
const widget = new Widget();
|
|
const formToTestValidationsKey = 'form-49904910-603c-48e9-8c8c-1d442c0fa524';
|
|
|
|
let tasksService: TasksService;
|
|
let processDefinitionService: ProcessDefinitionsService;
|
|
let processInstancesService: ProcessInstancesService;
|
|
let identityService: IdentityService;
|
|
let groupIdentityService: GroupIdentityService;
|
|
|
|
let completedTask, createdTask, assigneeTask, toBeCompletedTask, formValidationsTask, testUser;
|
|
const candidateBaseApp = resources.ACTIVITI7_APPS.CANDIDATE_BASE_APP.name;
|
|
const completedTaskName = StringUtil.generateRandomString(), assignedTaskName = StringUtil.generateRandomString();
|
|
|
|
beforeAll(async () => {
|
|
const apiService = new ApiService(browser.params.config.oauth2.clientId, browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers);
|
|
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
|
|
|
|
identityService = new IdentityService(apiService);
|
|
groupIdentityService = new GroupIdentityService(apiService);
|
|
|
|
testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]);
|
|
|
|
const groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
|
|
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
|
|
await apiService.login(testUser.email, testUser.password);
|
|
|
|
tasksService = new TasksService(apiService);
|
|
|
|
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
|
|
|
|
assigneeTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
|
|
|
|
await tasksService.claimTask(assigneeTask.entry.id, candidateBaseApp);
|
|
|
|
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(apiService);
|
|
|
|
const processDefinition = await processDefinitionService
|
|
.getProcessDefinitionByName(resources.ACTIVITI7_APPS.CANDIDATE_BASE_APP.processes.candidateUserProcess, candidateBaseApp);
|
|
|
|
processInstancesService = new ProcessInstancesService(apiService);
|
|
await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
|
|
|
|
await settingsPage.setProviderBpmSso(
|
|
browser.params.config.bpmHost,
|
|
browser.params.config.oauth2.host,
|
|
browser.params.config.identityHost);
|
|
await loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password);
|
|
|
|
}, 5 * 60 * 1000);
|
|
|
|
afterAll(async () => {
|
|
try {
|
|
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
|
await identityService.deleteIdentityUser(testUser.id);
|
|
} catch (error) {
|
|
}
|
|
await this.alfrescoJsApi.logout();
|
|
await browser.executeScript('window.sessionStorage.clear();');
|
|
await browser.executeScript('window.localStorage.clear();');
|
|
});
|
|
|
|
it('[C307032] Should display the appropriate title for the unclaim option of a Task', async () => {
|
|
await navigationBarPage.navigateToProcessServicesCloudPage();
|
|
await appListCloudComponent.checkApsContainer();
|
|
await appListCloudComponent.goToApp(candidateBaseApp);
|
|
await tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assigneeTask.entry.name);
|
|
await tasksCloudDemoPage.taskListCloudComponent().selectRow(assigneeTask.entry.name);
|
|
await expect(await taskFormCloudComponent.getReleaseButtonText()).toBe('RELEASE');
|
|
});
|
|
|
|
it('[C310142] Empty content is displayed when having a task without form', async () => {
|
|
await navigationBarPage.navigateToProcessServicesCloudPage();
|
|
await appListCloudComponent.checkApsContainer();
|
|
await appListCloudComponent.goToApp(candidateBaseApp);
|
|
await tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assigneeTask.entry.name);
|
|
await tasksCloudDemoPage.taskListCloudComponent().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 navigationBarPage.navigateToProcessServicesCloudPage();
|
|
await appListCloudComponent.checkApsContainer();
|
|
await appListCloudComponent.goToApp(candidateBaseApp);
|
|
await tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(formValidationsTask.entry.name);
|
|
await tasksCloudDemoPage.taskListCloudComponent().selectRow(formValidationsTask.entry.name);
|
|
await taskFormCloudComponent.checkFormIsDisplayed();
|
|
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 (await taskFormCloudComponent.getCompleteButton()).isEnabled()).toBe(false);
|
|
await widget.textWidget().setValue('Text0tma8h', 'Some random text');
|
|
await expect(await (await taskFormCloudComponent.getCompleteButton()).isEnabled()).toBe(true);
|
|
|
|
await widget.dateWidget().setDateInput('Date0m1moq', 'invalid date');
|
|
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
|
await expect(await (await taskFormCloudComponent.getCompleteButton()).isEnabled()).toBe(false);
|
|
|
|
await widget.dateWidget().setDateInput('Date0m1moq', '20-10-2018');
|
|
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
|
await expect(await (await taskFormCloudComponent.getCompleteButton()).isEnabled()).toBe(true);
|
|
|
|
await widget.numberWidget().setFieldValue('Number0klykr', 'invalid number');
|
|
await expect(await (await taskFormCloudComponent.getCompleteButton()).isEnabled()).toBe(false);
|
|
|
|
await widget.numberWidget().setFieldValue('Number0klykr', '26');
|
|
await expect(await (await taskFormCloudComponent.getCompleteButton()).isEnabled()).toBe(true);
|
|
|
|
await widget.amountWidget().setFieldValue('Amount0mtp1h', 'invalid amount');
|
|
await expect(await (await taskFormCloudComponent.getCompleteButton()).isEnabled()).toBe(false);
|
|
|
|
await widget.amountWidget().setFieldValue('Amount0mtp1h', '660');
|
|
await expect(await (await taskFormCloudComponent.getCompleteButton()).isEnabled()).toBe(true);
|
|
|
|
});
|
|
|
|
describe('Complete task - cloud directive', () => {
|
|
|
|
beforeEach(async () => {
|
|
await navigationBarPage.navigateToProcessServicesCloudPage();
|
|
await appListCloudComponent.checkApsContainer();
|
|
await appListCloudComponent.goToApp(candidateBaseApp);
|
|
|
|
});
|
|
|
|
it('[C307093] Complete button is not displayed when the task is already completed', async () => {
|
|
await tasksCloudDemoPage.completedTasksFilter().clickTaskFilter();
|
|
await expect(await tasksCloudDemoPage.getActiveFilterName()).toBe('Completed Tasks');
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName);
|
|
await tasksCloudDemoPage.taskListCloudComponent().selectRow(completedTaskName);
|
|
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
|
|
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
|
|
});
|
|
|
|
it('[C307095] Task can not be completed by owner user', async () => {
|
|
await tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
|
|
await expect(await tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
|
|
await tasksCloudDemoPage.editTaskFilterCloudComponent().clickCustomiseFilterHeader();
|
|
|
|
await browser.driver.sleep(1000);
|
|
|
|
await tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee();
|
|
await tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('CREATED');
|
|
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name);
|
|
await tasksCloudDemoPage.taskListCloudComponent().selectRow(createdTask.entry.name);
|
|
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
|
|
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
|
|
});
|
|
|
|
it('[C307110] Task list is displayed after clicking on Cancel button', async () => {
|
|
await tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
|
|
await expect(await tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
|
|
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assigneeTask.entry.name);
|
|
await tasksCloudDemoPage.taskListCloudComponent().selectRow(assigneeTask.entry.name);
|
|
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
|
|
await taskFormCloudComponent.clickCancelButton();
|
|
|
|
await expect(await tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assigneeTask.entry.name);
|
|
});
|
|
|
|
it('[C307094] Standalone Task can be completed by a user that is owner and assignee', async () => {
|
|
await tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
|
|
await expect(await tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
|
|
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(toBeCompletedTask.entry.name);
|
|
await tasksCloudDemoPage.taskListCloudComponent().selectRow(toBeCompletedTask.entry.name);
|
|
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
|
|
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
|
|
await taskFormCloudComponent.clickCompleteButton();
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(toBeCompletedTask.entry.name);
|
|
|
|
await tasksCloudDemoPage.completedTasksFilter().clickTaskFilter();
|
|
await tasksCloudDemoPage.taskListCloudComponent().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 tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
|
|
await expect(await tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
|
|
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTask.entry.name);
|
|
await tasksCloudDemoPage.taskListCloudComponent().selectRow(completedTask.entry.name);
|
|
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
|
|
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
|
|
await taskFormCloudComponent.clickCompleteButton();
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTask.entry.name);
|
|
|
|
await tasksCloudDemoPage.completedTasksFilter().clickTaskFilter();
|
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTask.entry.name);
|
|
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
|
|
});
|
|
});
|
|
|
|
});
|