From 3ac0018160fe8ff0fddc9d3b54a0982fb3eb76d4 Mon Sep 17 00:00:00 2001 From: gmandakini <45559635+gmandakini@users.noreply.github.com> Date: Fri, 1 Mar 2019 23:10:00 +0000 Subject: [PATCH] [ADF-4126] add roles filtering to people cloud component (#4338) * in progress * in progress testcase C297674 * linting fixes * modularised clear field method * made the appearance of select user dropdown work. * in progress * final version * linting fixes * linting fixes * in progress * in progress testcase C297674 * linting fixes * modularised clear field method * made the appearance of select user dropdown work. * in progress * final version * linting fixes * linting fixes * ADF-4103 automated * in progress * Roles Filter automated * async updates * removed the identity User details * roleId extraction done. * linting fixes * using constants instead of hardcoding the typing values. * crc's * crc's * linting * removed hte indexes, as api returns only 1 user record. * fixed errors * in progress * redoing the tests as the PeopleGroupCloudPage has been updated. * redoing the tests as the PeopleGroupCloudPage has been updated. --- .../people-groups-cloud-demo.component.html | 22 +-- e2e/actions/APS-cloud/groupIdentity.ts | 81 ++++++++ e2e/actions/APS-cloud/identity.ts | 16 +- e2e/actions/APS-cloud/roles.ts | 47 +++++ e2e/core/user-info-component-cloud.e2e.ts | 12 +- .../peopleGroupCloudComponentPage.ts | 89 +++++++++ e2e/pages/adf/navigationBarPage.ts | 8 + .../adf/process-cloud/groupCloudComponent.ts | 62 +++++++ .../adf/process-cloud/peopleCloudComponent.ts | 75 ++++++++ .../process-cloud/startTasksCloudComponent.ts | 22 --- .../people-group-cloud-component.e2e.ts | 174 ++++++++++++++++++ .../start-task-custom-app-cloud.e2e.ts | 18 +- e2e/util/constants.js | 7 + 13 files changed, 573 insertions(+), 60 deletions(-) create mode 100644 e2e/actions/APS-cloud/groupIdentity.ts create mode 100644 e2e/actions/APS-cloud/roles.ts create mode 100644 e2e/pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage.ts create mode 100644 e2e/pages/adf/process-cloud/groupCloudComponent.ts create mode 100644 e2e/pages/adf/process-cloud/peopleCloudComponent.ts create mode 100644 e2e/process-services-cloud/people-group-cloud-component.e2e.ts diff --git a/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.html b/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.html index d7344500b0..319c52387d 100644 --- a/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.html +++ b/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.html @@ -6,21 +6,21 @@
- {{ + {{ 'PEOPLE_GROUPS_CLOUD.SINGLE' | translate }} - {{ + {{ 'PEOPLE_GROUPS_CLOUD.MULTI' | translate }}
{{ 'PEOPLE_GROUPS_CLOUD.APP_FILTER_MODE' | translate }} - {{ + {{ 'PEOPLE_GROUPS_CLOUD.ROLE_FILTER_MODE' | translate }} {{ 'PEOPLE_GROUPS_CLOUD.ROLE' | translate }} ['ACTIVITI_ADMIN', "ACTIVITI_USER"] - + {{ 'PEOPLE_GROUPS_CLOUD.APP_NAME' | translate }} @@ -28,7 +28,7 @@ {{ 'PEOPLE_GROUPS_CLOUD.PRESELECTED_VALUE' | translate }}: {{ DEFAULT_PEOPLE_PLACEHOLDER }} - +
@@ -54,21 +54,21 @@
- {{ + {{ 'PEOPLE_GROUPS_CLOUD.SINGLE' | translate }} - {{ + {{ 'PEOPLE_GROUPS_CLOUD.MULTI' | translate }}
{{ 'PEOPLE_GROUPS_CLOUD.APP_FILTER_MODE' | translate }} - {{ + {{ 'PEOPLE_GROUPS_CLOUD.ROLE_FILTER_MODE' | translate }} {{ 'PEOPLE_GROUPS_CLOUD.ROLE' | translate }} ['ACTIVITI_ADMIN', "ACTIVITI_USER"] - + {{ 'PEOPLE_GROUPS_CLOUD.APP_NAME' | translate }} @@ -76,7 +76,7 @@ Preselect: {{ DEFAULT_GROUP_PLACEHOLDER }} - +
@@ -93,4 +93,4 @@
- \ No newline at end of file + diff --git a/e2e/actions/APS-cloud/groupIdentity.ts b/e2e/actions/APS-cloud/groupIdentity.ts new file mode 100644 index 0000000000..2cc15fcbad --- /dev/null +++ b/e2e/actions/APS-cloud/groupIdentity.ts @@ -0,0 +1,81 @@ +/*! + * @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 } from '../APS-cloud/apiservice'; +import { Util } from '../../util/util'; +import { AppConfigService } from '@alfresco/adf-core'; + +export class GroupIdentity { + + api: ApiService = new ApiService(); + + constructor(appConfig: AppConfigService) { + } + + async init(username, password) { + await this.api.login(username, password); + } + + async createIdentityGroup(groupName = Util.generateRandomString(5)) { + await this.createGroup(groupName); + const group = await this.getGroupInfoByGroupName(groupName); + return group; + } + + async deleteIdentityGroup(groupId) { + await this.deleteGroup(groupId); + } + + async createGroup(groupName) { + const path = '/groups'; + const method = 'POST'; + const queryParams = {}, postBody = { + 'name': groupName + 'TestGroup' + }; + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); + return data; + } + + async deleteGroup(groupId) { + const path = `/groups/${groupId}`; + const method = 'DELETE'; + const queryParams = {}, postBody = { + }; + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); + return data; + } + + async getGroupInfoByGroupName(groupName) { + const path = `/groups`; + const method = 'GET'; + const queryParams = { 'search' : groupName }, postBody = {}; + + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); + return data[0]; + } + + async assignRole(groupId, roleId, roleName) { + const path = `/groups/${groupId}/role-mappings/realm`; + const method = 'POST'; + const queryParams = {}, + postBody = [{'id': roleId, 'name': roleName}]; + + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); + return data; + } + +} diff --git a/e2e/actions/APS-cloud/identity.ts b/e2e/actions/APS-cloud/identity.ts index e1ab489b8e..49c5dc320c 100644 --- a/e2e/actions/APS-cloud/identity.ts +++ b/e2e/actions/APS-cloud/identity.ts @@ -33,8 +33,8 @@ export class Identity { async createIdentityUser(username = Util.generateRandomString(5), password = Util.generateRandomString(5)) { await this.createUser(username); const user = await this.getUserInfoByUsername(username); - await this.resetPassword(user[0].id, password); - user[0].password = password; + await this.resetPassword(user.id, password); + user.password = password; return user; } @@ -71,7 +71,7 @@ export class Identity { const queryParams = { 'username' : username }, postBody = {}; const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - return data; + return data[0]; } async resetPassword(id, password) { @@ -84,16 +84,6 @@ export class Identity { return data; } - async getRoleByName(roleName) { - const path = `/roles/${roleName}`; - const method = 'GET'; - const queryParams = {}, - postBody = {}; - - const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); - return data; - } - async assignRole(userId, roleId, roleName) { const path = `/users/${userId}/role-mappings/realm`; const method = 'POST'; diff --git a/e2e/actions/APS-cloud/roles.ts b/e2e/actions/APS-cloud/roles.ts new file mode 100644 index 0000000000..69544436bd --- /dev/null +++ b/e2e/actions/APS-cloud/roles.ts @@ -0,0 +1,47 @@ +/*! + * @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 } from '../APS-cloud/apiservice'; +import { AppConfigService } from '@alfresco/adf-core'; + +export class Roles { + + api: ApiService = new ApiService(); + + constructor(appConfig: AppConfigService) { + } + + async init(username, password) { + await this.api.login(username, password); + } + + async getRoleIdByRoleName(roleName) { + const path = `/roles`; + const method = 'GET'; + let roleId; + const queryParams = {}, postBody = {}; + + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); + for (let key in data) { + if (data[key].name === roleName) { + roleId = data[key].id; + } + } + return roleId; + } + +} diff --git a/e2e/core/user-info-component-cloud.e2e.ts b/e2e/core/user-info-component-cloud.e2e.ts index ff73d65401..c2f4e54d1f 100644 --- a/e2e/core/user-info-component-cloud.e2e.ts +++ b/e2e/core/user-info-component-cloud.e2e.ts @@ -39,20 +39,20 @@ describe('User Info - SSO', () => { settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); browser.ignoreSynchronization = true; - loginSSOPage.loginAPS(identityUser['0'].username, identityUser['0'].password); + loginSSOPage.loginAPS(identityUser.username, identityUser.password); }); - afterAll (() => { - identityService.deleteIdentityUser(identityUser[0].id); + afterAll (async () => { + await identityService.deleteIdentityUser(identityUser.id); }); it('[C290066] Should display UserInfo when login using SSO', () => { navigationBarPage.navigateToProcessServicesCloudPage(); navigationBarPage.clickUserProfile(); - expect(userInfoDialog.getSsoHeaderTitle()).toEqual(identityUser['0'].firstName + ' ' + identityUser['0'].lastName); - expect(userInfoDialog.getSsoTitle()).toEqual(identityUser['0'].firstName + ' ' + identityUser['0'].lastName); - expect(userInfoDialog.getSsoEmail()).toEqual(identityUser['0'].email); + expect(userInfoDialog.getSsoHeaderTitle()).toEqual(identityUser.firstName + ' ' + identityUser.lastName); + expect(userInfoDialog.getSsoTitle()).toEqual(identityUser.firstName + ' ' + identityUser.lastName); + expect(userInfoDialog.getSsoEmail()).toEqual(identityUser.email); userInfoDialog.closeUserProfile(); }); diff --git a/e2e/pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage.ts b/e2e/pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage.ts new file mode 100644 index 0000000000..200c52196d --- /dev/null +++ b/e2e/pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage.ts @@ -0,0 +1,89 @@ +/*! + * @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 { by, element, protractor } from 'protractor'; +import { Util } from '../../../../util/util'; + +export class PeopleGroupCloudComponentPage { + + peopleCloudSingleSelection = element(by.css('mat-radio-button[data-automation-id="adf-people-single-mode"]')); + peopleCloudMultipleSelection = element(by.css('mat-radio-button[data-automation-id="adf-people-multiple-mode"]')); + peopleCloudFilterRole = element(by.css('mat-radio-button[data-automation-id="adf-people-filter-role"]')); + groupCloudSingleSelection = element(by.css('mat-radio-button[data-automation-id="adf-group-single-mode"]')); + groupCloudMultipleSelection = element(by.css('mat-radio-button[data-automation-id="adf-group-multiple-mode"]')); + groupCloudFilterRole = element(by.css('mat-radio-button[data-automation-id="adf-group-filter-role"]')); + peopleRoleInput = element(by.css('input[data-automation-id="adf-people-roles-input"]')); + peoplePreselect = element(by.css('input[data-automation-id="adf-people-preselect-input"]')); + groupRoleInput = element(by.css('input[data-automation-id="adf-group-roles-input"]')); + groupPreselect = element(by.css('input[data-automation-id="adf-group-preselect-input"]')); + peopleCloudComponentTitle = element(by.cssContainingText('mat-card-title', 'People Cloud Component')); + groupCloudComponentTitle = element(by.cssContainingText('mat-card-title', 'Groups Cloud Component')); + + checkPeopleCloudComponentTitleIsDisplayed() { + Util.waitUntilElementIsVisible(this.peopleCloudComponentTitle); + return this; + } + + checkGroupsCloudComponentTitleIsDisplayed() { + Util.waitUntilElementIsVisible(this.groupCloudComponentTitle); + return this; + } + + clickPeopleCloudMultipleSelection() { + Util.waitUntilElementIsVisible(this.peopleCloudMultipleSelection); + this.peopleCloudMultipleSelection.click(); + } + + clickPeopleCloudFilterRole() { + Util.waitUntilElementIsVisible(this.peopleCloudFilterRole); + this.peopleCloudFilterRole.click(); + } + + clickGroupCloudFilterRole() { + Util.waitUntilElementIsVisible(this.groupCloudFilterRole); + this.groupCloudFilterRole.click(); + } + + enterPeopleRoles(roles) { + Util.waitUntilElementIsVisible(this.peopleRoleInput); + this.peopleRoleInput.clear(); + this.peopleRoleInput.sendKeys(roles); + return this; + } + + clearField(locator) { + Util.waitUntilElementIsVisible(locator); + locator.getAttribute('value').then((result) => { + for (let i = result.length; i >= 0; i--) { + locator.sendKeys(protractor.Key.BACK_SPACE); + } + }); + } + + clickGroupCloudMultipleSelection() { + Util.waitUntilElementIsVisible(this.groupCloudMultipleSelection); + this.groupCloudMultipleSelection.click(); + } + + enterGroupRoles(roles) { + Util.waitUntilElementIsVisible(this.groupRoleInput); + this.groupRoleInput.clear(); + this.groupRoleInput.sendKeys(roles); + return this; + } + +} diff --git a/e2e/pages/adf/navigationBarPage.ts b/e2e/pages/adf/navigationBarPage.ts index 442f338635..efb7b3553d 100644 --- a/e2e/pages/adf/navigationBarPage.ts +++ b/e2e/pages/adf/navigationBarPage.ts @@ -20,6 +20,7 @@ import { browser, by, element } from 'protractor'; import { ProcessServicesPage } from './process-services/processServicesPage'; import { AppListCloudComponent } from './process-cloud/appListCloudComponent'; import TestConfig = require('../../test.config'); +import { PeopleGroupCloudComponentPage } from './demo-shell/process-services/peopleGroupCloudComponentPage'; export class NavigationBarPage { @@ -46,6 +47,7 @@ export class NavigationBarPage { iconsButton = element(by.css('a[data-automation-id="Icons"]')); customSourcesButton = element(by.css('a[data-automation-id="Custom Sources"]')); settingsButton = element(by.css('a[data-automation-id="Settings"]')); + peopleGroupCloud = element(by.css('a[data-automation-id="People/Group Cloud"]')); aboutButton = element(by.css('a[data-automation-id="About"]')); navigateToDatatable() { @@ -80,6 +82,12 @@ export class NavigationBarPage { return new AppListCloudComponent(); } + navigateToPeopleGroupCloudPage() { + Util.waitUntilElementIsVisible(this.peopleGroupCloud); + this.peopleGroupCloud.click(); + return new PeopleGroupCloudComponentPage(); + } + navigateToSettingsPage() { Util.waitUntilElementIsVisible(this.settingsButton); this.settingsButton.click(); diff --git a/e2e/pages/adf/process-cloud/groupCloudComponent.ts b/e2e/pages/adf/process-cloud/groupCloudComponent.ts new file mode 100644 index 0000000000..f262903dbf --- /dev/null +++ b/e2e/pages/adf/process-cloud/groupCloudComponent.ts @@ -0,0 +1,62 @@ +/*! + * @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 { by, element, protractor } from 'protractor'; +import { Util } from '../../../util/util'; + +export class GroupCloudComponent { + + groupCloudSearch = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]')); + + searchGroups(name) { + Util.waitUntilElementIsVisible(this.groupCloudSearch); + this.groupCloudSearch.clear().then(() => { + for (let i = 0; i < name.length; i++) { + this.groupCloudSearch.sendKeys(name[i]); + } + this.groupCloudSearch.sendKeys(protractor.Key.BACK_SPACE); + this.groupCloudSearch.sendKeys(name[name.length - 1]); + }); + return this; + } + + selectGroupFromList(name) { + let groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); + Util.waitUntilElementIsVisible(groupRow); + groupRow.click(); + Util.waitUntilElementIsNotVisible(groupRow); + return this; + } + + checkGroupIsDisplayed(name) { + let groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); + Util.waitUntilElementIsVisible(groupRow); + return this; + } + + checkGroupIsNotDisplayed(name) { + let groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); + Util.waitUntilElementIsNotVisible(groupRow); + return this; + } + + checkSelectedGroup(group) { + Util.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group))); + return this; + } + +} diff --git a/e2e/pages/adf/process-cloud/peopleCloudComponent.ts b/e2e/pages/adf/process-cloud/peopleCloudComponent.ts new file mode 100644 index 0000000000..6e802db453 --- /dev/null +++ b/e2e/pages/adf/process-cloud/peopleCloudComponent.ts @@ -0,0 +1,75 @@ +/*! + * @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 { by, element, protractor } from 'protractor'; +import { Util } from '../../../util/util'; + +export class PeopleCloudComponent { + + peopleCloudSearch = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]')); + + searchAssigneeAndSelect(name) { + Util.waitUntilElementIsVisible(this.peopleCloudSearch); + this.peopleCloudSearch.clear(); + this.peopleCloudSearch.sendKeys(name); + this.selectAssigneeFromList(name); + return this; + } + + searchAssignee(name) { + Util.waitUntilElementIsVisible(this.peopleCloudSearch); + this.peopleCloudSearch.clear().then(() => { + for (let i = 0; i < name.length; i++) { + this.peopleCloudSearch.sendKeys(name[i]); + } + this.peopleCloudSearch.sendKeys(protractor.Key.BACK_SPACE); + this.peopleCloudSearch.sendKeys(name[name.length - 1]); + }); + return this; + } + + selectAssigneeFromList(name) { + let assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); + Util.waitUntilElementIsVisible(assigneeRow); + assigneeRow.click(); + Util.waitUntilElementIsNotVisible(assigneeRow); + return this; + } + + getAssignee() { + Util.waitUntilElementIsVisible(this.peopleCloudSearch); + return this.peopleCloudSearch.getAttribute('value'); + } + + checkUserIsDisplayed(name) { + let assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); + Util.waitUntilElementIsVisible(assigneeRow); + return this; + } + + checkUserIsNotDisplayed(name) { + let assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); + Util.waitUntilElementIsNotVisible(assigneeRow); + return this; + } + + checkSelectedPeople(person) { + Util.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person))); + return this; + } + +} diff --git a/e2e/pages/adf/process-cloud/startTasksCloudComponent.ts b/e2e/pages/adf/process-cloud/startTasksCloudComponent.ts index b13d36af4e..74d03d9919 100644 --- a/e2e/pages/adf/process-cloud/startTasksCloudComponent.ts +++ b/e2e/pages/adf/process-cloud/startTasksCloudComponent.ts @@ -23,7 +23,6 @@ export class StartTasksCloudComponent { name = element(by.css('input[id="name_id"]')); dueDate = element(by.css('input[id="date_id"]')); description = element(by.css('textarea[id="description_id"]')); - assignee = element(by.css('adf-cloud-people input')); priority = element(by.css('input[formcontrolname="priority"]')); startButton = element(by.css('button[id="button-start"]')); startButtonEnabled = element(by.css('button[id="button-start"]:not(disabled)')); @@ -55,27 +54,6 @@ export class StartTasksCloudComponent { return this; } - addAssignee(name) { - Util.waitUntilElementIsVisible(this.assignee); - this.assignee.clear(); - this.assignee.sendKeys(name); - this.selectAssigneeFromList(name); - return this; - } - - selectAssigneeFromList(name) { - let assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); - Util.waitUntilElementIsVisible(assigneeRow); - assigneeRow.click(); - Util.waitUntilElementIsNotVisible(assigneeRow); - return this; - } - - getAssignee() { - Util.waitUntilElementIsVisible(this.assignee); - return this.assignee.getAttribute('value'); - } - clickStartButton() { Util.waitUntilElementIsVisible(this.startButton); Util.waitUntilElementIsClickable(this.startButton); diff --git a/e2e/process-services-cloud/people-group-cloud-component.e2e.ts b/e2e/process-services-cloud/people-group-cloud-component.e2e.ts new file mode 100644 index 0000000000..f0f9f5b2d9 --- /dev/null +++ b/e2e/process-services-cloud/people-group-cloud-component.e2e.ts @@ -0,0 +1,174 @@ +/*! + * @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 TestConfig = require('../test.config'); + +import { LoginSSOPage } from '../pages/adf/loginSSOPage'; +import { SettingsPage } from '../pages/adf/settingsPage'; +import { NavigationBarPage } from '../pages/adf/navigationBarPage'; +import { PeopleGroupCloudComponentPage } from '../pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage'; +import { PeopleCloudComponent } from '../pages/adf/process-cloud/peopleCloudComponent'; +import { GroupCloudComponent } from '../pages/adf/process-cloud/groupCloudComponent'; +import { browser } from 'protractor'; +import { Identity } from '../actions/APS-cloud/identity'; +import { GroupIdentity } from '../actions/APS-cloud/groupIdentity'; +import CONSTANTS = require('../util/constants'); +import { Roles } from '../actions/APS-cloud/roles'; + +describe('People Groups Cloud Component', () => { + + describe('People Groups Cloud Component', () => { + const settingsPage = new SettingsPage(); + const loginSSOPage = new LoginSSOPage(); + const navigationBarPage = new NavigationBarPage(); + const peopleGroupCloudComponentPage = new PeopleGroupCloudComponentPage(); + const peopleCloudComponent = new PeopleCloudComponent(); + const groupCloudComponent = new GroupCloudComponent(); + const identityService: Identity = new Identity(); + const groupIdentityService: GroupIdentity = new GroupIdentity(); + const rolesService: Roles = new Roles(); + + let silentLogin; + let apsUser; + let activitiUser; + let noRoleUser ; + let groupAps; + let groupActiviti; + let groupNoRole; + let apsUserRoleId; + let activitiUserRoleId; + let apsAdminRoleId; + let activitiAdminRoleId; + let users = new Array(); + let groups = new Array(); + + beforeAll(async () => { + await identityService.init(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await rolesService.init(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + apsUser = await identityService.createIdentityUser(); + apsUserRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.APS_USER); + await identityService.assignRole(apsUser.id, apsUserRoleId, CONSTANTS.ROLES.APS_USER); + activitiUser = await identityService.createIdentityUser(); + activitiUserRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.ACTIVITI_USER); + await identityService.assignRole(activitiUser.id, activitiUserRoleId, CONSTANTS.ROLES.ACTIVITI_USER); + noRoleUser = await identityService.createIdentityUser(); + await groupIdentityService.init(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + groupAps = await groupIdentityService.createIdentityGroup(); + apsAdminRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.APS_ADMIN); + await groupIdentityService.assignRole(groupAps.id, apsAdminRoleId, CONSTANTS.ROLES.APS_ADMIN); + groupActiviti = await groupIdentityService.createIdentityGroup(); + activitiAdminRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.ACTIVITI_ADMIN); + await groupIdentityService.assignRole(groupActiviti.id, activitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN); + groupNoRole = await groupIdentityService.createIdentityGroup(); + users = [`${apsUser.id}`, `${activitiUser.id}`, `${noRoleUser.id}`]; + groups = [`${groupAps.id}`, `${groupActiviti.id}`, `${groupNoRole.id}`]; + silentLogin = false; + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); + loginSSOPage.clickOnSSOButton(); + loginSSOPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + navigationBarPage.navigateToPeopleGroupCloudPage(); + }); + + afterAll(async () => { + for (let i = 0; i < users.length; i++) { + await identityService.deleteIdentityUser(users[i]); + } + for (let i = 0; i < groups.length; i++) { + await groupIdentityService.deleteIdentityGroup(groups[i]); + } + }); + + beforeEach( () => { + browser.refresh(); + peopleGroupCloudComponentPage.checkGroupsCloudComponentTitleIsDisplayed(); + peopleGroupCloudComponentPage.checkPeopleCloudComponentTitleIsDisplayed(); + }); + + it('[C297674] Add role filtering to PeopleCloudComponent', () => { + peopleGroupCloudComponentPage.clickPeopleCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickPeopleCloudFilterRole(); + peopleGroupCloudComponentPage.enterPeopleRoles(`["${CONSTANTS.ROLES.APS_USER}"]`); + peopleCloudComponent.searchAssignee('LastName'); + peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.checkUserIsNotDisplayed(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.checkUserIsNotDisplayed(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + peopleCloudComponent.selectAssigneeFromList(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + }); + + it('[C297674] Add more than one role filtering to PeopleCloudComponent', () => { + peopleGroupCloudComponentPage.clickPeopleCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickPeopleCloudFilterRole(); + peopleGroupCloudComponentPage.enterPeopleRoles(`["${CONSTANTS.ROLES.APS_USER}", "${CONSTANTS.ROLES.ACTIVITI_USER}"]`); + peopleCloudComponent.searchAssignee('LastName'); + peopleCloudComponent.checkUserIsDisplayed(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.checkUserIsNotDisplayed(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + peopleCloudComponent.selectAssigneeFromList(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${activitiUser.lastName}`); + }); + + it('[C297674] Add no role filters to PeopleCloudComponent', () => { + peopleGroupCloudComponentPage.clickPeopleCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickPeopleCloudFilterRole(); + peopleCloudComponent.searchAssignee('LastName'); + peopleCloudComponent.checkUserIsDisplayed(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.checkUserIsDisplayed(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.selectAssigneeFromList(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + }); + + it('[C297674] Add role filtering to GroupCloudComponent', () => { + peopleGroupCloudComponentPage.clickGroupCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickGroupCloudFilterRole(); + peopleGroupCloudComponentPage.enterGroupRoles(`["${CONSTANTS.ROLES.APS_ADMIN}"]`); + groupCloudComponent.searchGroups('TestGroup'); + groupCloudComponent.checkGroupIsDisplayed(`${groupAps.name}`); + groupCloudComponent.checkGroupIsNotDisplayed(`${groupActiviti.name}`); + groupCloudComponent.checkGroupIsNotDisplayed(`${groupNoRole.name}`); + groupCloudComponent.selectGroupFromList(`${groupAps.name}`); + groupCloudComponent.checkSelectedGroup(`${groupAps.name}`); + }); + + it('[C297674] Add more than one role filtering to GroupCloudComponent', () => { + peopleGroupCloudComponentPage.clickGroupCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickGroupCloudFilterRole(); + peopleGroupCloudComponentPage.enterGroupRoles(`["${CONSTANTS.ROLES.APS_ADMIN}", "${CONSTANTS.ROLES.ACTIVITI_ADMIN}"]`); + groupCloudComponent.searchGroups('TestGroup'); + groupCloudComponent.checkGroupIsDisplayed(`${groupActiviti.name}`); + groupCloudComponent.checkGroupIsDisplayed(`${groupAps.name}`); + groupCloudComponent.checkGroupIsNotDisplayed(`${groupNoRole.name}`); + groupCloudComponent.selectGroupFromList(`${groupActiviti.name}`); + groupCloudComponent.checkSelectedGroup(`${groupActiviti.name}`); + }); + + it('[C297674] Add no role filters to GroupCloudComponent', () => { + peopleGroupCloudComponentPage.clickGroupCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickGroupCloudFilterRole(); + peopleGroupCloudComponentPage.clearField(peopleGroupCloudComponentPage.groupRoleInput); + groupCloudComponent.searchGroups('TestGroup'); + groupCloudComponent.checkGroupIsDisplayed(`${groupNoRole.name}`); + groupCloudComponent.checkGroupIsDisplayed(`${groupActiviti.name}`); + groupCloudComponent.checkGroupIsDisplayed(`${groupAps.name}`); + groupCloudComponent.selectGroupFromList(`${groupNoRole.name}`); + groupCloudComponent.checkSelectedGroup(`${groupNoRole.name}`); + }); + + }); + +}); diff --git a/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts b/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts index 4f2f579be4..11c66ec980 100644 --- a/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts +++ b/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts @@ -23,6 +23,7 @@ import { NavigationBarPage } from '../pages/adf/navigationBarPage'; import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage'; import { StartTasksCloudComponent } from '../pages/adf/process-cloud/startTasksCloudComponent'; import { Util } from '../util/util'; +import { PeopleCloudComponent } from '../pages/adf/process-cloud/peopleCloudComponent'; import { TaskDetailsPage } from '../pages/adf/demo-shell/process-services/taskDetailsPage'; describe('Start Task', () => { @@ -34,6 +35,7 @@ describe('Start Task', () => { const appListCloudComponent = new AppListCloudComponent(); const tasksCloudDemoPage = new TasksCloudDemoPage(); const startTask = new StartTasksCloudComponent(); + const peopleCloudComponent = new PeopleCloudComponent(); const standaloneTaskName = Util.generateRandomString(5); const unassignedTaskName = Util.generateRandomString(5); const taskName255Characters = Util.generateRandomString(255); @@ -105,9 +107,9 @@ describe('Start Task', () => { it('[C290182] Should be possible to assign the task to another user', () => { tasksCloudDemoPage.openNewTaskForm(); - startTask.addName(standaloneTaskName) - .addAssignee('Super Admin') - .clickStartButton(); + startTask.addName(standaloneTaskName); + peopleCloudComponent.searchAssigneeAndSelect('Super Admin'); + startTask.clickStartButton(); tasksCloudDemoPage.myTasksFilter().clickTaskFilter(); expect(tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks'); tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsNotDisplayed(standaloneTaskName); @@ -115,27 +117,27 @@ describe('Start Task', () => { it('[C291953] Assignee field should display the logged user as default', () => { tasksCloudDemoPage.openNewTaskForm(); - expect(startTask.getAssignee()).toContain('Admin', 'does not contain Admin'); + expect(peopleCloudComponent.getAssignee()).toContain('Admin', 'does not contain Admin'); startTask.clickCancelButton(); }); it('[C291956] Should be able to create a new standalone task without assignee', () => { tasksCloudDemoPage.openNewTaskForm(); - startTask.addName(unassignedTaskName); - startTask.clearField(startTask.assignee); + startTask.addName(standaloneTaskName); + startTask.clearField(peopleCloudComponent.peopleCloudSearch); startTask.clickStartButton(); tasksCloudDemoPage.editTaskFilterCloudComponent() .clickCustomiseFilterHeader() .setStateFilterDropDown('CREATED') .clearAssignment(); - tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(unassignedTaskName); + tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(standaloneTaskName); }); it('[C297675] Should create a task unassigned when assignee field is empty in Start Task form', () => { tasksCloudDemoPage.openNewTaskForm(); startTask.addName(unassignedTaskName); - startTask.clearField(startTask.assignee); + startTask.clearField(peopleCloudComponent.peopleCloudSearch); startTask.clickStartButton(); tasksCloudDemoPage.editTaskFilterCloudComponent() .clickCustomiseFilterHeader() diff --git a/e2e/util/constants.js b/e2e/util/constants.js index e4be3c8be0..70a14017b3 100644 --- a/e2e/util/constants.js +++ b/e2e/util/constants.js @@ -110,6 +110,13 @@ exports.APP_ICON = { USER: "person" }; +exports.ROLES = { + APS_USER: "APS_USER", + ACTIVITI_USER: "ACTIVITI_USER", + APS_ADMIN: "APS_ADMIN", + ACTIVITI_ADMIN: "ACTIVITI_ADMIN" +}; + exports.PROCESS_END_DATE = "No date"; exports.PROCESS_CATEGORY = "http://www.activiti.org/processdef";