diff --git a/demo-shell/src/app/components/cloud/people-groups-cloud-demo.component.html b/demo-shell/src/app/components/cloud/people-groups-cloud-demo.component.html index febd6f6414..dda47274ac 100644 --- a/demo-shell/src/app/components/cloud/people-groups-cloud-demo.component.html +++ b/demo-shell/src/app/components/cloud/people-groups-cloud-demo.component.html @@ -24,7 +24,7 @@ {{ 'PEOPLE_GROUPS_CLOUD.APP_NAME' | translate }} - + {{ 'PEOPLE_GROUPS_CLOUD.PRESELECTED_VALUE' | translate }}: {{ DEFAULT_PEOPLE_PLACEHOLDER }} @@ -81,7 +81,7 @@ {{ 'PEOPLE_GROUPS_CLOUD.APP_NAME' | translate }} - + Preselect: {{ DEFAULT_GROUP_PLACEHOLDER }} diff --git a/e2e/pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage.ts b/e2e/pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage.ts index a7ff4a75df..6b2b1b6aaf 100644 --- a/e2e/pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage.ts +++ b/e2e/pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage.ts @@ -21,17 +21,24 @@ import { BrowserVisibility } from '@alfresco/adf-testing'; export class PeopleGroupCloudComponentPage { peopleCloudSingleSelection = element(by.css('mat-radio-button[data-automation-id="adf-people-single-mode"]')); + peopleCloudSingleSelectionChecked = element(by.css('mat-radio-button[data-automation-id="adf-people-single-mode"][class*="mat-radio-checked"]')); 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"]')); + peopleAppInput = element(by.css('input[data-automation-id="adf-people-app-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"]')); + groupAppInput = element(by.css('input[data-automation-id="adf-group-app-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')); + preselectValidation = element(by.css('mat-checkbox.adf-preselect-value')); + preselectValidationStatus = element(by.css('mat-checkbox.adf-preselect-value label input')); + peopleFilterByAppName = element(by.css('.people-control-options mat-radio-button[value="appName"]')); + groupFilterByAppName = element(by.css('.groups-control-options mat-radio-button[value="appName"]')); checkPeopleCloudComponentTitleIsDisplayed() { BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudComponentTitle); @@ -48,6 +55,15 @@ export class PeopleGroupCloudComponentPage { this.peopleCloudMultipleSelection.click(); } + clickPeopleCloudSingleSelection() { + BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSingleSelection); + this.peopleCloudSingleSelection.click(); + } + + checkPeopleCloudSingleSelectionIsSelected() { + BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSingleSelectionChecked); + } + clickPeopleCloudFilterRole() { BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudFilterRole); this.peopleCloudFilterRole.click(); @@ -65,6 +81,13 @@ export class PeopleGroupCloudComponentPage { return this; } + enterPeoplePreselect(preselect) { + BrowserVisibility.waitUntilElementIsVisible(this.peoplePreselect); + this.peoplePreselect.clear(); + this.peoplePreselect.sendKeys(preselect); + return this; + } + clearField(locator) { BrowserVisibility.waitUntilElementIsVisible(locator); locator.getAttribute('value').then((result) => { @@ -74,6 +97,11 @@ export class PeopleGroupCloudComponentPage { }); } + clickGroupCloudSingleSelection() { + BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSingleSelection); + this.groupCloudSingleSelection.click(); + } + clickGroupCloudMultipleSelection() { BrowserVisibility.waitUntilElementIsVisible(this.groupCloudMultipleSelection); this.groupCloudMultipleSelection.click(); @@ -86,4 +114,38 @@ export class PeopleGroupCloudComponentPage { return this; } + clickPreselectValidation() { + BrowserVisibility.waitUntilElementIsVisible(this.preselectValidation); + this.preselectValidation.click(); + } + + getPreselectValidationStatus() { + BrowserVisibility.waitUntilElementIsVisible(this.preselectValidationStatus); + return this.preselectValidationStatus.getAttribute('aria-checked'); + } + + clickPeopleFilerByApp() { + BrowserVisibility.waitUntilElementIsVisible(this.peopleFilterByAppName); + return this.peopleFilterByAppName.click(); + } + + clickGroupFilerByApp() { + BrowserVisibility.waitUntilElementIsVisible(this.groupFilterByAppName); + return this.groupFilterByAppName.click(); + } + + enterPeopleAppName(appName) { + BrowserVisibility.waitUntilElementIsVisible(this.peopleAppInput); + this.peopleAppInput.clear(); + this.peopleAppInput.sendKeys(appName); + return this; + } + + enterGroupAppName(appName) { + BrowserVisibility.waitUntilElementIsVisible(this.groupAppInput); + this.groupAppInput.clear(); + this.groupAppInput.sendKeys(appName); + return this; + } + } diff --git a/e2e/process-services-cloud/people-group-cloud-component.e2e.ts b/e2e/process-services-cloud/people-group-cloud-component.e2e.ts index 1f93f7170f..888a223beb 100644 --- a/e2e/process-services-cloud/people-group-cloud-component.e2e.ts +++ b/e2e/process-services-cloud/people-group-cloud-component.e2e.ts @@ -49,8 +49,10 @@ describe('People Groups Cloud Component', () => { let activitiUserRoleId; let apsAdminRoleId; let activitiAdminRoleId; + let clientActivitiAdminRoleId, clientActivitiUserRoleId; let users = []; let groups = []; + let clientId; beforeAll(async () => { @@ -58,6 +60,11 @@ describe('People Groups Cloud Component', () => { await apiService.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); identityService = new IdentityService(apiService); rolesService = new RolesService(apiService); + groupIdentityService = new GroupIdentityService(apiService); + clientId = await groupIdentityService.getClientIdByApplicationName('simple-app'); + groupActiviti = await groupIdentityService.createIdentityGroup(); + clientActivitiAdminRoleId = await rolesService.getClientRoleIdByRoleName(groupActiviti.id, clientId, CONSTANTS.ROLES.ACTIVITI_ADMIN); + clientActivitiUserRoleId = await rolesService.getClientRoleIdByRoleName(groupActiviti.id, clientId, CONSTANTS.ROLES.ACTIVITI_USER); apsUser = await identityService.createIdentityUser(); apsUserRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.APS_USER); @@ -66,14 +73,18 @@ describe('People Groups Cloud Component', () => { activitiUserRoleId = await rolesService.getRoleIdByRoleName(CONSTANTS.ROLES.ACTIVITI_USER); await identityService.assignRole(activitiUser.idIdentityService, activitiUserRoleId, CONSTANTS.ROLES.ACTIVITI_USER); noRoleUser = await identityService.createIdentityUser(); - groupIdentityService = new GroupIdentityService(apiService); + await identityService.deleteClientRole(noRoleUser.idIdentityService, clientId, clientActivitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN); + await identityService.deleteClientRole(noRoleUser.idIdentityService, clientId, clientActivitiUserRoleId, CONSTANTS.ROLES.ACTIVITI_USER); + 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(); + + await groupIdentityService.addClientRole(groupAps.id, clientId, clientActivitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN ); + await groupIdentityService.addClientRole(groupActiviti.id, clientId, clientActivitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN ); users = [`${apsUser.idIdentityService}`, `${activitiUser.idIdentityService}`, `${noRoleUser.idIdentityService}`]; groups = [`${groupAps.id}`, `${groupActiviti.id}`, `${groupNoRole.id}`]; silentLogin = false; @@ -104,11 +115,11 @@ describe('People Groups Cloud Component', () => { peopleGroupCloudComponentPage.clickPeopleCloudFilterRole(); peopleGroupCloudComponentPage.enterPeopleRoles(`["${CONSTANTS.ROLES.APS_USER}"]`); peopleCloudComponent.searchAssignee('LastName'); - peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}` + 'LastName'); - peopleCloudComponent.checkUserIsNotDisplayed(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}` + 'LastName'); - peopleCloudComponent.checkUserIsNotDisplayed(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}` + 'LastName'); - peopleCloudComponent.selectAssigneeFromList(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}` + 'LastName'); - peopleCloudComponent.checkSelectedPeople(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}` + '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', () => { @@ -116,22 +127,22 @@ describe('People Groups Cloud Component', () => { peopleGroupCloudComponentPage.clickPeopleCloudFilterRole(); peopleGroupCloudComponentPage.enterPeopleRoles(`["${CONSTANTS.ROLES.APS_USER}", "${CONSTANTS.ROLES.ACTIVITI_USER}"]`); peopleCloudComponent.searchAssignee('LastName'); - peopleCloudComponent.checkUserIsDisplayed(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}` + 'LastName'); - peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}` + 'LastName'); - peopleCloudComponent.checkUserIsNotDisplayed(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}` + 'LastName'); - peopleCloudComponent.selectAssigneeFromList(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}` + 'LastName'); - peopleCloudComponent.checkSelectedPeople(`${activitiUser.lastName}` + '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}` + 'LastName'); - peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}` + 'LastName'); - peopleCloudComponent.checkUserIsDisplayed(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}` + 'LastName'); - peopleCloudComponent.selectAssigneeFromList(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}` + 'LastName'); - peopleCloudComponent.checkSelectedPeople(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}` + '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', () => { @@ -170,6 +181,148 @@ describe('People Groups Cloud Component', () => { groupCloudComponentPage.checkSelectedGroup(`${groupNoRole.name}`); }); + it('[C305033] Should fetch the preselect users based on the Validate flag set to True in Single mode selection', () => { + + peopleGroupCloudComponentPage.checkPeopleCloudSingleSelectionIsSelected(); + peopleGroupCloudComponentPage.clickPreselectValidation(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('true'); + peopleGroupCloudComponentPage.enterPeoplePreselect(`[{"id":"${noRoleUser.idIdentityService}"}]`); + browser.sleep(100); + expect(peopleCloudComponent.getAssigneeFieldContent()).toBe(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + + peopleGroupCloudComponentPage.clickPreselectValidation(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('false'); + peopleGroupCloudComponentPage.clickPreselectValidation(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('true'); + peopleGroupCloudComponentPage.enterPeoplePreselect(`[{"email":"${apsUser.email}"}]`); + browser.sleep(100); + expect(peopleCloudComponent.getAssigneeFieldContent()).toBe(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + + peopleGroupCloudComponentPage.clickPreselectValidation(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('false'); + peopleGroupCloudComponentPage.clickPreselectValidation(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('true'); + peopleGroupCloudComponentPage.enterPeoplePreselect(`[{"username":"${activitiUser.username}"}]`); + browser.sleep(100); + expect(peopleCloudComponent.getAssigneeFieldContent()).toBe(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + + peopleGroupCloudComponentPage.enterPeoplePreselect('[{"id":"12345","username":"someUsername","email":"someEmail"}]'); + peopleGroupCloudComponentPage.clickPreselectValidation(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('false'); + peopleGroupCloudComponentPage.clickPreselectValidation(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('true'); + browser.sleep(100); + expect(peopleCloudComponent.getAssigneeFieldContent()).toBe(''); + }); + + it('[C305033] Should fetch the preselect users based on the Validate flag set to True in Multiple mode selection', () => { + + peopleGroupCloudComponentPage.enterPeoplePreselect(`[{"id":"${apsUser.idIdentityService}"},{"id":"${activitiUser.idIdentityService}"},` + + `{"id":"${noRoleUser.idIdentityService}"}]`); + peopleGroupCloudComponentPage.clickPeopleCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickPreselectValidation(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('true'); + peopleCloudComponent.checkSelectedPeople(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + + peopleGroupCloudComponentPage.enterPeoplePreselect(`[{"email":"${apsUser.email}"},{"email":"${activitiUser.email}"},{"email":"${noRoleUser.email}"}]`); + peopleCloudComponent.checkSelectedPeople(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + + peopleGroupCloudComponentPage.enterPeoplePreselect(`[{"username":"${apsUser.username}"},{"username":"${activitiUser.username}"},` + + `{"username":"${noRoleUser.username}"}]`); + peopleCloudComponent.checkSelectedPeople(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + + peopleCloudComponent.searchAssigneeToExisting('LastName'); + peopleCloudComponent.checkUserIsNotDisplayed(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + peopleCloudComponent.checkUserIsNotDisplayed(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.checkUserIsNotDisplayed(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + + }); + + it('[C305033] Should populate the Users without any validation when the Preselect flag is set to false', () => { + peopleGroupCloudComponentPage.clickPeopleCloudMultipleSelection(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('false'); + peopleGroupCloudComponentPage.enterPeoplePreselect(`[{"firstName":"TestFirstName1","lastName":"TestLastName1"},` + + `{"firstName":"TestFirstName2","lastName":"TestLastName2"},{"firstName":"TestFirstName3","lastName":"TestLastName3"}]`); + peopleCloudComponent.checkSelectedPeople('TestFirstName1 TestLastName1'); + peopleCloudComponent.checkSelectedPeople('TestFirstName2 TestLastName2'); + peopleCloudComponent.checkSelectedPeople('TestFirstName3 TestLastName3'); + + }); + + it('[C305033] Should not fetch the preselect users when mandatory parameters Id, Email and username are missing', () => { + peopleGroupCloudComponentPage.clickPeopleCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickPreselectValidation(); + expect(peopleGroupCloudComponentPage.getPreselectValidationStatus()).toBe('true'); + peopleGroupCloudComponentPage.enterPeoplePreselect(`[{"firstName":"${apsUser.firstName}","lastName":"${apsUser.lastName},"` + + `{"firstName":"${activitiUser.firstName}","lastName":"${activitiUser.lastName}",{"firstName":"${noRoleUser.firstName}","lastName":"${noRoleUser.lastName}"]`); + browser.sleep(100); + expect(peopleCloudComponent.getAssigneeFieldContent()).toBe(''); + + }); + + it('[C305041] Should filter the People Single Selection with the Application name filter', () => { + peopleGroupCloudComponentPage.checkPeopleCloudSingleSelectionIsSelected(); + peopleGroupCloudComponentPage.clickPeopleFilerByApp(); + peopleGroupCloudComponentPage.enterPeopleAppName('simple-app'); + peopleCloudComponent.searchAssignee(`${activitiUser.firstName}`); + peopleCloudComponent.checkUserIsDisplayed(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.selectAssigneeFromList(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + browser.sleep(100); + expect(peopleCloudComponent.getAssigneeFieldContent()).toBe(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + }); + + it('[C305041] Should filter the People Multiple Selection with the Application name filter', () => { + peopleGroupCloudComponentPage.clickPeopleCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickPeopleFilerByApp(); + peopleGroupCloudComponentPage.enterPeopleAppName('simple-app'); + peopleCloudComponent.searchAssignee(`${apsUser.firstName}`); + peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.selectAssigneeFromList(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${apsUser.firstName}` + ' ' + `${apsUser.lastName}`); + + peopleCloudComponent.searchAssigneeToExisting(`${activitiUser.firstName}`); + peopleCloudComponent.checkUserIsDisplayed(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.selectAssigneeFromList(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + peopleCloudComponent.checkSelectedPeople(`${activitiUser.firstName}` + ' ' + `${activitiUser.lastName}`); + + peopleCloudComponent.searchAssigneeToExisting(`${noRoleUser.firstName}`); + peopleCloudComponent.checkUserIsNotDisplayed(`${noRoleUser.firstName}` + ' ' + `${noRoleUser.lastName}`); + }); + + it('[C305041] Should filter the Groups Single Selection with the Application name filter', () => { + peopleGroupCloudComponentPage.clickGroupCloudSingleSelection(); + peopleGroupCloudComponentPage.clickGroupFilerByApp(); + peopleGroupCloudComponentPage.enterGroupAppName('simple-app'); + groupCloudComponentPage.searchGroups(`${groupActiviti.name}`); + groupCloudComponentPage.checkGroupIsDisplayed(`${groupActiviti.name}`); + groupCloudComponentPage.selectGroupFromList(`${groupActiviti.name}`); + expect(groupCloudComponentPage.getGroupsFieldContent()).toBe(`${groupActiviti.name}`); + }); + + it('[C305041] Should filter the Groups Multiple Selection with the Application name filter', () => { + peopleGroupCloudComponentPage.clickGroupCloudMultipleSelection(); + peopleGroupCloudComponentPage.clickGroupFilerByApp(); + peopleGroupCloudComponentPage.enterGroupAppName('simple-app'); + groupCloudComponentPage.searchGroups(`${groupAps.name}`); + groupCloudComponentPage.checkGroupIsDisplayed(`${groupAps.name}`); + groupCloudComponentPage.selectGroupFromList(`${groupAps.name}`); + groupCloudComponentPage.checkSelectedGroup(`${groupAps.name}`); + + groupCloudComponentPage.searchGroupsToExisting(`${groupActiviti.name}`); + groupCloudComponentPage.checkGroupIsDisplayed(`${groupActiviti.name}`); + groupCloudComponentPage.selectGroupFromList(`${groupActiviti.name}`); + groupCloudComponentPage.checkSelectedGroup(`${groupActiviti.name}`); + + groupCloudComponentPage.searchGroupsToExisting(`${groupNoRole.name}`); + groupCloudComponentPage.checkGroupIsNotDisplayed(`${groupNoRole.name}`); + }); + }); }); diff --git a/lib/testing/src/lib/core/actions/identity/group-identity.service.ts b/lib/testing/src/lib/core/actions/identity/group-identity.service.ts index 9f7b9a346d..1cea809cf0 100644 --- a/lib/testing/src/lib/core/actions/identity/group-identity.service.ts +++ b/lib/testing/src/lib/core/actions/identity/group-identity.service.ts @@ -74,4 +74,38 @@ export class GroupIdentityService { return data; } + /** + * Add client roles. + * @param groupId ID of the target group + * @param clientId ID of the client + * @param roleId ID of the clientRole + * @param roleName of the clientRole + */ + async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string) { + const path = `/groups/${groupId}/role-mappings/clients/${clientId}`; + const method = 'POST', queryParams = {}, + postBody = [{ + 'id': roleId, + 'name': roleName, + 'composite': false, + 'clientRole': true, + 'containerId': clientId + }]; + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); + return data; + } + + /** + * Gets the client ID using the app name. + * @param applicationName Name of the app + * @returns client ID string + */ + async getClientIdByApplicationName(applicationName: string) { + const path = `/clients`; + const method = 'GET', queryParams = {clientId: applicationName}, postBody = {}; + + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); + return data[0].id; + } + } diff --git a/lib/testing/src/lib/core/actions/identity/identity.service.ts b/lib/testing/src/lib/core/actions/identity/identity.service.ts index e42a46e4a7..0c1e3a08e7 100644 --- a/lib/testing/src/lib/core/actions/identity/identity.service.ts +++ b/lib/testing/src/lib/core/actions/identity/identity.service.ts @@ -29,7 +29,7 @@ export class IdentityService { async createIdentityUser(user: UserModel = new UserModel()) { await this.createUser(user); - const userIdentity = await this.getUserInfoByUsername(user.email); + const userIdentity = await this.getUserInfoByUsername(user.username); await this.resetPassword(userIdentity.id, user.password); user.idIdentityService = userIdentity.id; return user; @@ -63,7 +63,7 @@ export class IdentityService { const path = '/users'; const method = 'POST'; const queryParams = {}, postBody = { - 'username': user.email, + 'username': user.username, 'firstName': user.firstName, 'lastName': user.lastName, 'enabled': true, @@ -110,4 +110,18 @@ export class IdentityService { return data; } + async deleteClientRole(userId: string, clientId: string, roleId: string, roleName: string) { + const path = `/users/${userId}/role-mappings/clients/${clientId}`; + const method = 'DELETE', queryParams = {}, + postBody = [{ + 'id': roleId, + 'name': roleName, + 'composite': false, + 'clientRole': true, + 'containerId': clientId + }]; + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); + return data; + } + } diff --git a/lib/testing/src/lib/core/actions/identity/roles.service.ts b/lib/testing/src/lib/core/actions/identity/roles.service.ts index acce862c4b..1b2c60da5c 100644 --- a/lib/testing/src/lib/core/actions/identity/roles.service.ts +++ b/lib/testing/src/lib/core/actions/identity/roles.service.ts @@ -40,4 +40,19 @@ export class RolesService { return roleId; } + async getClientRoleIdByRoleName(groupId, clientId, clientRoleName) { + const path = `/groups/${groupId}/role-mappings/clients/${clientId}/available`; + const method = 'GET'; + let clientRoleId; + const queryParams = {}, postBody = {}; + + const data = await this.api.performIdentityOperation(path, method, queryParams, postBody); + for (const key in data) { + if (data[key].name === clientRoleName) { + clientRoleId = data[key].id; + } + } + return clientRoleId; + } + } diff --git a/lib/testing/src/lib/core/models/user.model.ts b/lib/testing/src/lib/core/models/user.model.ts index b307c35a09..d3efd3db37 100644 --- a/lib/testing/src/lib/core/models/user.model.ts +++ b/lib/testing/src/lib/core/models/user.model.ts @@ -20,9 +20,10 @@ import { StringUtil } from '../string.util'; export class UserModel { firstName: string = StringUtil.generateRandomString(); - lastName: string = StringUtil.generateRandomString(); + lastName: string = StringUtil.generateRandomString() + 'LastName'; password: string = StringUtil.generateRandomString(); email: string = StringUtil.generateRandomEmail('@alfresco.com'); + username: string = StringUtil.generateRandomString().toLowerCase(); idIdentityService: string; constructor(details?: any) { diff --git a/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts index 67c0320e67..2ee1e1c1f5 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/group-cloud-component.page.ts @@ -34,6 +34,22 @@ export class GroupCloudComponentPage { return this; } + searchGroupsToExisting(name) { + BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch); + 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; + } + + getGroupsFieldContent() { + BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch); + return this.groupCloudSearch.getAttribute('value'); + + } + selectGroupFromList(name) { const groupRow = element.all(by.cssContainingText('mat-option span', name)).first(); BrowserVisibility.waitUntilElementIsVisible(groupRow); diff --git a/lib/testing/src/lib/process-services-cloud/pages/people-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/people-cloud-component.page.ts index 428dfeceb0..13f38b45e4 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/people-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/people-cloud-component.page.ts @@ -21,6 +21,7 @@ import { BrowserVisibility } from '../../core/browser-visibility'; export class PeopleCloudComponentPage { peopleCloudSearch = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]')); + assigneeField = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]')); searchAssigneeAndSelect(name) { BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch); @@ -32,6 +33,7 @@ export class PeopleCloudComponentPage { searchAssignee(name) { BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch); + BrowserVisibility.waitUntilElementIsClickable(this.peopleCloudSearch); this.peopleCloudSearch.clear().then(() => { for (let i = 0; i < name.length; i++) { this.peopleCloudSearch.sendKeys(name[i]); @@ -42,6 +44,16 @@ export class PeopleCloudComponentPage { return this; } + searchAssigneeToExisting(name) { + BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch); + 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) { const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); BrowserVisibility.waitUntilElementIsVisible(assigneeRow); @@ -72,4 +84,10 @@ export class PeopleCloudComponentPage { return this; } + getAssigneeFieldContent() { + BrowserVisibility.waitUntilElementIsVisible(this.assigneeField); + return this.assigneeField.getAttribute('value'); + + } + }