mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-8061] Fix the group restriction for people widget (#7601)
* FIx the restrinction * Fix unit test about restricted groups * Add a small sleep to make it green * Add sleep to other checks * Remove sleeps, improve assertions Co-authored-by: MichalFidor <michal.fidor@hyland.com>
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { by, element, $, $$ } from 'protractor';
|
import { by, element, $, $$, browser } from 'protractor';
|
||||||
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
|
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
|
||||||
|
|
||||||
export class PeopleGroupCloudComponentPage {
|
export class PeopleGroupCloudComponentPage {
|
||||||
@@ -40,6 +40,11 @@ export class PeopleGroupCloudComponentPage {
|
|||||||
peopleFilterByAppName = $('.app-people-control-options mat-radio-button[value="appName"]');
|
peopleFilterByAppName = $('.app-people-control-options mat-radio-button[value="appName"]');
|
||||||
groupFilterByAppName = $('.app-groups-control-options mat-radio-button[value="appName"]');
|
groupFilterByAppName = $('.app-groups-control-options mat-radio-button[value="appName"]');
|
||||||
|
|
||||||
|
async navigateTo() {
|
||||||
|
await browser.get('#/cloud/people-group-cloud');
|
||||||
|
await browser.waitForAngular();
|
||||||
|
}
|
||||||
|
|
||||||
async checkPeopleCloudComponentTitleIsDisplayed(): Promise<void> {
|
async checkPeopleCloudComponentTitleIsDisplayed(): Promise<void> {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudComponentTitle);
|
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudComponentTitle);
|
||||||
}
|
}
|
||||||
|
@@ -18,14 +18,12 @@
|
|||||||
import { createApiService, GroupCloudComponentPage, GroupIdentityService, IdentityService, LoginPage, PeopleCloudComponentPage } from '@alfresco/adf-testing';
|
import { createApiService, GroupCloudComponentPage, GroupIdentityService, IdentityService, LoginPage, PeopleCloudComponentPage } from '@alfresco/adf-testing';
|
||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
import { PeopleGroupCloudComponentPage } from './../pages/people-group-cloud-component.page';
|
import { PeopleGroupCloudComponentPage } from './../pages/people-group-cloud-component.page';
|
||||||
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
|
|
||||||
|
|
||||||
describe('People Groups Cloud Component', () => {
|
describe('People Groups Cloud Component', () => {
|
||||||
|
|
||||||
describe('People Groups Cloud Component', () => {
|
describe('People Groups Cloud Component', () => {
|
||||||
|
|
||||||
const loginSSOPage = new LoginPage();
|
const loginSSOPage = new LoginPage();
|
||||||
const navigationBarPage = new NavigationBarPage();
|
|
||||||
const peopleGroupCloudComponentPage = new PeopleGroupCloudComponentPage();
|
const peopleGroupCloudComponentPage = new PeopleGroupCloudComponentPage();
|
||||||
const peopleCloudComponent = new PeopleCloudComponentPage();
|
const peopleCloudComponent = new PeopleCloudComponentPage();
|
||||||
const groupCloudComponentPage = new GroupCloudComponentPage();
|
const groupCloudComponentPage = new GroupCloudComponentPage();
|
||||||
@@ -46,13 +44,13 @@ describe('People Groups Cloud Component', () => {
|
|||||||
|
|
||||||
hrGroup = await groupIdentityService.getGroupInfoByGroupName('hr');
|
hrGroup = await groupIdentityService.getGroupInfoByGroupName('hr');
|
||||||
testGroup = await groupIdentityService.getGroupInfoByGroupName('testgroup');
|
testGroup = await groupIdentityService.getGroupInfoByGroupName('testgroup');
|
||||||
|
|
||||||
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
|
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
|
||||||
apsUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
|
apsUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
|
||||||
|
|
||||||
await identityService.addUserToGroup(testUser.idIdentityService, testGroup.id);
|
await identityService.addUserToGroup(testUser.idIdentityService, testGroup.id);
|
||||||
await identityService.addUserToGroup(apsUser.idIdentityService, hrGroup.id);
|
await identityService.addUserToGroup(apsUser.idIdentityService, hrGroup.id);
|
||||||
noRoleUser = await identityService.createIdentityUser();
|
|
||||||
|
|
||||||
|
noRoleUser = await identityService.createIdentityUser();
|
||||||
groupNoRole = await groupIdentityService.createIdentityGroup();
|
groupNoRole = await groupIdentityService.createIdentityGroup();
|
||||||
|
|
||||||
users = [apsUser.idIdentityService, noRoleUser.idIdentityService, testUser.idIdentityService];
|
users = [apsUser.idIdentityService, noRoleUser.idIdentityService, testUser.idIdentityService];
|
||||||
@@ -62,21 +60,15 @@ describe('People Groups Cloud Component', () => {
|
|||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await apiService.loginWithProfile('identityAdmin');
|
await apiService.loginWithProfile('identityAdmin');
|
||||||
for (let i = 0; i < users.length; i++) {
|
for (const user of users) {
|
||||||
await identityService.deleteIdentityUser(users[i]);
|
await identityService.deleteIdentityUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
await groupIdentityService.deleteIdentityGroup(groupNoRole.id);
|
await groupIdentityService.deleteIdentityGroup(groupNoRole.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await navigationBarPage.navigateToPeopleGroupCloudPage();
|
await peopleGroupCloudComponentPage.navigateTo();
|
||||||
await peopleGroupCloudComponentPage.checkGroupsCloudComponentTitleIsDisplayed();
|
|
||||||
await peopleGroupCloudComponentPage.checkPeopleCloudComponentTitleIsDisplayed();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
await browser.refresh();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C305041] Should filter the People Single Selection with the Application name filter', async () => {
|
it('[C305041] Should filter the People Single Selection with the Application name filter', async () => {
|
||||||
@@ -88,8 +80,7 @@ describe('People Groups Cloud Component', () => {
|
|||||||
await peopleCloudComponent.checkUserIsDisplayed(`${testUser.firstName} ${testUser.lastName}`);
|
await peopleCloudComponent.checkUserIsDisplayed(`${testUser.firstName} ${testUser.lastName}`);
|
||||||
await peopleCloudComponent.selectAssigneeFromList(`${testUser.firstName} ${testUser.lastName}`);
|
await peopleCloudComponent.selectAssigneeFromList(`${testUser.firstName} ${testUser.lastName}`);
|
||||||
|
|
||||||
await browser.sleep(100);
|
await expect(await peopleCloudComponent.checkSelectedPeople(`${testUser.firstName} ${testUser.lastName}`)).toBeTruthy(`${testUser.firstName} ${testUser.lastName} is not visible here!`);
|
||||||
await expect(await peopleCloudComponent.checkSelectedPeople(`${testUser.firstName} ${testUser.lastName}`));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C305041] Should filter the People Multiple Selection with the Application name filter', async () => {
|
it('[C305041] Should filter the People Multiple Selection with the Application name filter', async () => {
|
||||||
@@ -99,15 +90,14 @@ describe('People Groups Cloud Component', () => {
|
|||||||
await peopleCloudComponent.searchAssignee(testUser.firstName);
|
await peopleCloudComponent.searchAssignee(testUser.firstName);
|
||||||
await peopleCloudComponent.checkUserIsDisplayed(`${testUser.firstName} ${testUser.lastName}`);
|
await peopleCloudComponent.checkUserIsDisplayed(`${testUser.firstName} ${testUser.lastName}`);
|
||||||
await peopleCloudComponent.selectAssigneeFromList(`${testUser.firstName} ${testUser.lastName}`);
|
await peopleCloudComponent.selectAssigneeFromList(`${testUser.firstName} ${testUser.lastName}`);
|
||||||
await peopleCloudComponent.checkSelectedPeople(`${testUser.firstName} ${testUser.lastName}`);
|
|
||||||
|
|
||||||
await peopleCloudComponent.searchAssignee(apsUser.firstName);
|
await peopleCloudComponent.searchAssignee(apsUser.firstName);
|
||||||
await peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName} ${apsUser.lastName}`);
|
await peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName} ${apsUser.lastName}`);
|
||||||
await peopleCloudComponent.selectAssigneeFromList(`${apsUser.firstName} ${apsUser.lastName}`);
|
await peopleCloudComponent.selectAssigneeFromList(`${apsUser.firstName} ${apsUser.lastName}`);
|
||||||
await peopleCloudComponent.checkSelectedPeople(`${apsUser.firstName} ${apsUser.lastName}`);
|
await expect(await peopleCloudComponent.checkSelectedPeople(`${apsUser.firstName} ${apsUser.lastName}`)).toBeTruthy(`${apsUser.firstName} ${apsUser.lastName} is not visible here!`);
|
||||||
|
|
||||||
await peopleCloudComponent.searchAssignee(noRoleUser.firstName);
|
await peopleCloudComponent.searchAssignee(noRoleUser.firstName);
|
||||||
await peopleCloudComponent.checkNoResultsFoundError();
|
await expect(await peopleCloudComponent.checkNoResultsFoundError()).toBeTruthy('There is something in the list!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C305041] Should filter the Groups Single Selection with the Application name filter', async () => {
|
it('[C305041] Should filter the Groups Single Selection with the Application name filter', async () => {
|
||||||
@@ -117,7 +107,7 @@ describe('People Groups Cloud Component', () => {
|
|||||||
await groupCloudComponentPage.searchGroups(hrGroup.name);
|
await groupCloudComponentPage.searchGroups(hrGroup.name);
|
||||||
await groupCloudComponentPage.checkGroupIsDisplayed(hrGroup.name);
|
await groupCloudComponentPage.checkGroupIsDisplayed(hrGroup.name);
|
||||||
await groupCloudComponentPage.selectGroupFromList(hrGroup.name);
|
await groupCloudComponentPage.selectGroupFromList(hrGroup.name);
|
||||||
await expect(await groupCloudComponentPage.checkSelectedGroup(hrGroup.name));
|
await expect(await groupCloudComponentPage.checkSelectedGroup(hrGroup.name)).toBeTruthy(`${hrGroup.name} is not visible here!`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C305041] Should filter the Groups Multiple Selection with the Application name filter', async () => {
|
it('[C305041] Should filter the Groups Multiple Selection with the Application name filter', async () => {
|
||||||
@@ -128,11 +118,13 @@ describe('People Groups Cloud Component', () => {
|
|||||||
await groupCloudComponentPage.checkGroupIsDisplayed(testGroup.name);
|
await groupCloudComponentPage.checkGroupIsDisplayed(testGroup.name);
|
||||||
await groupCloudComponentPage.selectGroupFromList(testGroup.name);
|
await groupCloudComponentPage.selectGroupFromList(testGroup.name);
|
||||||
await groupCloudComponentPage.checkSelectedGroup(testGroup.name);
|
await groupCloudComponentPage.checkSelectedGroup(testGroup.name);
|
||||||
|
await expect(await groupCloudComponentPage.checkSelectedGroup(testGroup.name)).toBeTruthy(`${testGroup.name} is not visible here!`);
|
||||||
|
|
||||||
await groupCloudComponentPage.searchGroupsToExisting(hrGroup.name);
|
await groupCloudComponentPage.searchGroupsToExisting(hrGroup.name);
|
||||||
await groupCloudComponentPage.checkGroupIsDisplayed(hrGroup.name);
|
await groupCloudComponentPage.checkGroupIsDisplayed(hrGroup.name);
|
||||||
await groupCloudComponentPage.selectGroupFromList(hrGroup.name);
|
await groupCloudComponentPage.selectGroupFromList(hrGroup.name);
|
||||||
await groupCloudComponentPage.checkSelectedGroup(hrGroup.name);
|
await groupCloudComponentPage.checkSelectedGroup(hrGroup.name);
|
||||||
|
await expect(await groupCloudComponentPage.checkSelectedGroup(hrGroup.name)).toBeTruthy(`${hrGroup.name} is not visible here!`);
|
||||||
|
|
||||||
await groupCloudComponentPage.searchGroupsToExisting(groupNoRole.name);
|
await groupCloudComponentPage.searchGroupsToExisting(groupNoRole.name);
|
||||||
await groupCloudComponentPage.checkGroupIsNotDisplayed(groupNoRole.name);
|
await groupCloudComponentPage.checkGroupIsNotDisplayed(groupNoRole.name);
|
||||||
|
@@ -824,6 +824,8 @@ describe('PeopleCloudComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Groups restriction', () => {
|
describe('Groups restriction', () => {
|
||||||
|
const GROUP_1 = 0;
|
||||||
|
const GROUP_2 = 1;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -831,8 +833,8 @@ describe('PeopleCloudComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Shoud display all users if groups restriction is empty', async () => {
|
it('Shoud display all users if groups restriction is empty', async () => {
|
||||||
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of(mockInvolvedGroups));
|
|
||||||
component.groupsRestriction = [];
|
component.groupsRestriction = [];
|
||||||
|
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of({name: 'fire'}));
|
||||||
typeInputValue('M');
|
typeInputValue('M');
|
||||||
|
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
@@ -842,21 +844,41 @@ describe('PeopleCloudComponent', () => {
|
|||||||
expect(fixture.debugElement.queryAll(By.css('[data-automation-id="adf-people-cloud-row"]')).length).toEqual(mockUsers.length);
|
expect(fixture.debugElement.queryAll(By.css('[data-automation-id="adf-people-cloud-row"]')).length).toEqual(mockUsers.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should display users that belongs to restricted groups', async () => {
|
it('Should display users that belongs to every restricted groups', async () => {
|
||||||
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of(mockInvolvedGroups));
|
component.groupsRestriction = ['water', 'fire', 'air'];
|
||||||
component.groupsRestriction = [mockInvolvedGroups[0].name, mockInvolvedGroups[1].name];
|
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of([{name: 'fire'}, {name: 'air'}, {name: 'water'}]));
|
||||||
typeInputValue('M');
|
typeInputValue('M');
|
||||||
|
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
const userList = fixture.debugElement.queryAll(By.css('[data-automation-id="adf-people-cloud-row"]'));
|
||||||
expect(getInvolvedGroupsSpy).toHaveBeenCalledTimes(3);
|
expect(userList.length).toEqual(3);
|
||||||
expect(fixture.debugElement.queryAll(By.css('[data-automation-id="adf-people-cloud-row"]')).length).toEqual(mockUsers.length);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should not display users that not belongs to restricted groups', async () => {
|
it('Should not display user if belong to partial restricted groups', async () => {
|
||||||
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of([mockInvolvedGroups[0]]));
|
component.groupsRestriction = ['water', 'fire', 'air'];
|
||||||
component.groupsRestriction = [mockInvolvedGroups[0].name, mockInvolvedGroups[1].name];
|
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of([{name: 'fire'}, {name: 'water'}]));
|
||||||
|
typeInputValue('M');
|
||||||
|
|
||||||
|
await fixture.whenStable();
|
||||||
|
fixture.detectChanges();
|
||||||
|
const userList = fixture.debugElement.queryAll(By.css('[data-automation-id="adf-people-cloud-row"]'));
|
||||||
|
expect(userList.length).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should not display user if belong to none of the restricted groups', async () => {
|
||||||
|
component.groupsRestriction = ['water', 'fire', 'air'];
|
||||||
|
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of([]));
|
||||||
|
typeInputValue('M');
|
||||||
|
|
||||||
|
await fixture.whenStable();
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(fixture.debugElement.queryAll(By.css('[data-automation-id="adf-people-cloud-row"]')).length).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should not be able to see a user that does not belong to the restricted group', async () => {
|
||||||
|
component.groupsRestriction = ['water'];
|
||||||
|
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of([{name: 'fire'}]));
|
||||||
typeInputValue('M');
|
typeInputValue('M');
|
||||||
|
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
@@ -867,7 +889,7 @@ describe('PeopleCloudComponent', () => {
|
|||||||
|
|
||||||
it('Should mark as invalid preselected user if is not belongs to restricted groups', (done) => {
|
it('Should mark as invalid preselected user if is not belongs to restricted groups', (done) => {
|
||||||
spyOn(identityService, 'findUserById').and.returnValue(of(mockPreselectedUsers[0]));
|
spyOn(identityService, 'findUserById').and.returnValue(of(mockPreselectedUsers[0]));
|
||||||
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of([mockInvolvedGroups[0]]));
|
getInvolvedGroupsSpy = spyOn(identityService, 'getInvolvedGroups').and.returnValue(of([mockInvolvedGroups[GROUP_1]]));
|
||||||
|
|
||||||
const expectedWarning = {
|
const expectedWarning = {
|
||||||
message: 'INVALID_PRESELECTED_USERS',
|
message: 'INVALID_PRESELECTED_USERS',
|
||||||
@@ -882,7 +904,7 @@ describe('PeopleCloudComponent', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
component.groupsRestriction = [mockInvolvedGroups[0].name, mockInvolvedGroups[1].name];
|
component.groupsRestriction = [mockInvolvedGroups[GROUP_1].name, mockInvolvedGroups[GROUP_2].name];
|
||||||
component.mode = 'single';
|
component.mode = 'single';
|
||||||
component.validate = true;
|
component.validate = true;
|
||||||
component.preSelectUsers = [mockPreselectedUsers[0]];
|
component.preSelectUsers = [mockPreselectedUsers[0]];
|
||||||
|
@@ -33,7 +33,6 @@ import { Observable, of, BehaviorSubject, Subject } from 'rxjs';
|
|||||||
import { switchMap, debounceTime, distinctUntilChanged, mergeMap, tap, filter, map, takeUntil } from 'rxjs/operators';
|
import { switchMap, debounceTime, distinctUntilChanged, mergeMap, tap, filter, map, takeUntil } from 'rxjs/operators';
|
||||||
import {
|
import {
|
||||||
FullNamePipe,
|
FullNamePipe,
|
||||||
IdentityGroupModel,
|
|
||||||
IdentityUserModel,
|
IdentityUserModel,
|
||||||
IdentityUserService,
|
IdentityUserService,
|
||||||
LogService
|
LogService
|
||||||
@@ -563,15 +562,13 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
|
|
||||||
private isUserPartOfAllRestrictedGroups(user: IdentityUserModel): Observable<boolean> {
|
private isUserPartOfAllRestrictedGroups(user: IdentityUserModel): Observable<boolean> {
|
||||||
return this.getUserGroups(user.id).pipe(
|
return this.getUserGroups(user.id).pipe(
|
||||||
map(userGroups => userGroups.filter(
|
map(userGroups => this.groupsRestriction.every(restricted => userGroups.includes(restricted)))
|
||||||
restrictedGroup => userGroups.includes(restrictedGroup)
|
|
||||||
).length >= this.groupsRestriction.length)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getUserGroups(userId: string): Observable<IdentityGroupModel[]> {
|
private getUserGroups(userId: string): Observable<string[]> {
|
||||||
return this.identityUserService.getInvolvedGroups(userId).pipe(
|
return this.identityUserService.getInvolvedGroups(userId).pipe(
|
||||||
map(groups => groups.map(({id, name}) => ({id, name})))
|
map(groups => groups.map((group) => group.name))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IdentityGroupModel } from '@alfresco/adf-core';
|
|
||||||
|
|
||||||
export const mockUsers = [
|
export const mockUsers = [
|
||||||
{ id: 'fake-id-1', username: 'first-name-1 last-name-1', firstName: 'first-name-1', lastName: 'last-name-1', email: 'abc@xyz.com' },
|
{ id: 'fake-id-1', username: 'first-name-1 last-name-1', firstName: 'first-name-1', lastName: 'last-name-1', email: 'abc@xyz.com' },
|
||||||
{ id: 'fake-id-2', username: 'first-name-2 last-name-2', firstName: 'first-name-2', lastName: 'last-name-2', email: 'abcd@xyz.com'},
|
{ id: 'fake-id-2', username: 'first-name-2 last-name-2', firstName: 'first-name-2', lastName: 'last-name-2', email: 'abcd@xyz.com'},
|
||||||
@@ -49,6 +47,6 @@ export const mockPreselectedUsers = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const mockInvolvedGroups = [
|
export const mockInvolvedGroups = [
|
||||||
{ id: 'mock-group-id-1', name: 'Mock Group 1', path: '/mock', subGroups: [] } as IdentityGroupModel,
|
{ id: 'mock-group-id-1', name: 'Mock Group 1', path: '/mock', subGroups: [] },
|
||||||
{ id: 'mock-group-id-2', name: 'Mock Group 2', path: '', subGroups: [] } as IdentityGroupModel
|
{ id: 'mock-group-id-2', name: 'Mock Group 2', path: '', subGroups: [] }
|
||||||
];
|
];
|
||||||
|
@@ -19,9 +19,9 @@ import { by, element, $, ElementFinder, $$ } from 'protractor';
|
|||||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||||
import { FormFields } from '../../core/pages/form/form-fields';
|
import { FormFields } from '../../core/pages/form/form-fields';
|
||||||
|
import { TestElement } from '../../core/test-element';
|
||||||
|
|
||||||
export class GroupCloudComponentPage {
|
export class GroupCloudComponentPage {
|
||||||
|
|
||||||
groupCloudSearch = $('input[data-automation-id="adf-cloud-group-search-input"]');
|
groupCloudSearch = $('input[data-automation-id="adf-cloud-group-search-input"]');
|
||||||
groupField = $('group-cloud-widget .adf-readonly');
|
groupField = $('group-cloud-widget .adf-readonly');
|
||||||
formFields = new FormFields();
|
formFields = new FormFields();
|
||||||
@@ -29,11 +29,11 @@ export class GroupCloudComponentPage {
|
|||||||
getGroupRowLocatorByName = async (name: string): Promise<ElementFinder> => $$(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`).first();
|
getGroupRowLocatorByName = async (name: string): Promise<ElementFinder> => $$(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`).first();
|
||||||
|
|
||||||
async searchGroups(name: string): Promise<void> {
|
async searchGroups(name: string): Promise<void> {
|
||||||
await BrowserActions.clearSendKeys(this.groupCloudSearch, name);
|
await BrowserActions.clearSendKeys(this.groupCloudSearch, name, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
async searchGroupsToExisting(name: string) {
|
async searchGroupsToExisting(name: string) {
|
||||||
await BrowserActions.clearSendKeys(this.groupCloudSearch, name);
|
await BrowserActions.clearSendKeys(this.groupCloudSearch, name, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupsFieldContent(): Promise<string> {
|
async getGroupsFieldContent(): Promise<string> {
|
||||||
@@ -57,8 +57,13 @@ export class GroupCloudComponentPage {
|
|||||||
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
|
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkSelectedGroup(group: string): Promise<void> {
|
async checkSelectedGroup(group: string): Promise<boolean> {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group)));
|
try {
|
||||||
|
await TestElement.byText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group).waitVisible();
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkGroupNotSelected(group: string): Promise<void> {
|
async checkGroupNotSelected(group: string): Promise<void> {
|
||||||
|
@@ -22,7 +22,6 @@ import { FormFields } from '../../core/pages/form/form-fields';
|
|||||||
import { TestElement } from '../../core/test-element';
|
import { TestElement } from '../../core/test-element';
|
||||||
|
|
||||||
export class PeopleCloudComponentPage {
|
export class PeopleCloudComponentPage {
|
||||||
|
|
||||||
peopleCloudSearch = $('input[data-automation-id="adf-people-cloud-search-input"]');
|
peopleCloudSearch = $('input[data-automation-id="adf-people-cloud-search-input"]');
|
||||||
assigneeField = $('input[data-automation-id="adf-people-cloud-search-input"]');
|
assigneeField = $('input[data-automation-id="adf-people-cloud-search-input"]');
|
||||||
selectionReady = $('div[data-automation-id="adf-people-cloud-row"]');
|
selectionReady = $('div[data-automation-id="adf-people-cloud-row"]');
|
||||||
@@ -50,7 +49,7 @@ export class PeopleCloudComponentPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async searchAssignee(name: string): Promise<void> {
|
async searchAssignee(name: string): Promise<void> {
|
||||||
await BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
|
await BrowserActions.clearSendKeys(this.peopleCloudSearch, name, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectAssigneeFromList(name: string): Promise<void> {
|
async selectAssigneeFromList(name: string): Promise<void> {
|
||||||
@@ -103,8 +102,13 @@ export class PeopleCloudComponentPage {
|
|||||||
await BrowserVisibility.waitUntilElementIsNotVisible(optionList);
|
await BrowserVisibility.waitUntilElementIsNotVisible(optionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkSelectedPeople(person: string): Promise<void> {
|
async checkSelectedPeople(person: string): Promise<boolean> {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person)));
|
try {
|
||||||
|
await TestElement.byText('mat-chip-list mat-chip', person).waitVisible();
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAssigneeFieldContent(): Promise<string> {
|
async getAssigneeFieldContent(): Promise<string> {
|
||||||
@@ -163,9 +167,13 @@ export class PeopleCloudComponentPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkNoResultsFoundError(): Promise<void> {
|
async checkNoResultsFoundError(): Promise<boolean> {
|
||||||
const errorLocator = $('[data-automation-id="adf-people-cloud-no-results"]');
|
try {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(errorLocator);
|
await TestElement.byCss('[data-automation-id="adf-people-cloud-no-results"]').waitVisible();
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user