mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4278][ADF-4277] - Should fetch the preselect users (#4535)
* C305033 Preselect Users automated. * fix the LastName issue failing. * C305041 automated * in progress * in progress * in progress * in progress * lint fix * moving the assignee filed to PeopleCloudComponent * moving the assignee filed to PeopleCloudComponent * split the tests into smaller chunks for easy understandability. * added the missing check and renamed the method appropriately. * fixes for flakiness
This commit is contained in:
committed by
Eugenio Romano
parent
7a2a8a1ed3
commit
1336fbee0e
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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) {
|
||||
|
@@ -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);
|
||||
|
@@ -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');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user