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:
@@ -19,9 +19,9 @@ import { by, element, $, ElementFinder, $$ } from 'protractor';
|
||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
import { FormFields } from '../../core/pages/form/form-fields';
|
||||
import { TestElement } from '../../core/test-element';
|
||||
|
||||
export class GroupCloudComponentPage {
|
||||
|
||||
groupCloudSearch = $('input[data-automation-id="adf-cloud-group-search-input"]');
|
||||
groupField = $('group-cloud-widget .adf-readonly');
|
||||
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();
|
||||
|
||||
async searchGroups(name: string): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.groupCloudSearch, name);
|
||||
await BrowserActions.clearSendKeys(this.groupCloudSearch, name, 100);
|
||||
}
|
||||
|
||||
async searchGroupsToExisting(name: string) {
|
||||
await BrowserActions.clearSendKeys(this.groupCloudSearch, name);
|
||||
await BrowserActions.clearSendKeys(this.groupCloudSearch, name, 100);
|
||||
}
|
||||
|
||||
async getGroupsFieldContent(): Promise<string> {
|
||||
@@ -57,8 +57,13 @@ export class GroupCloudComponentPage {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
|
||||
}
|
||||
|
||||
async checkSelectedGroup(group: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group)));
|
||||
async checkSelectedGroup(group: string): Promise<boolean> {
|
||||
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> {
|
||||
|
@@ -22,7 +22,6 @@ import { FormFields } from '../../core/pages/form/form-fields';
|
||||
import { TestElement } from '../../core/test-element';
|
||||
|
||||
export class PeopleCloudComponentPage {
|
||||
|
||||
peopleCloudSearch = $('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"]');
|
||||
@@ -50,7 +49,7 @@ export class PeopleCloudComponentPage {
|
||||
}
|
||||
|
||||
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> {
|
||||
@@ -103,8 +102,13 @@ export class PeopleCloudComponentPage {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(optionList);
|
||||
}
|
||||
|
||||
async checkSelectedPeople(person: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person)));
|
||||
async checkSelectedPeople(person: string): Promise<boolean> {
|
||||
try {
|
||||
await TestElement.byText('mat-chip-list mat-chip', person).waitVisible();
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async getAssigneeFieldContent(): Promise<string> {
|
||||
@@ -163,9 +167,13 @@ export class PeopleCloudComponentPage {
|
||||
}
|
||||
}
|
||||
|
||||
async checkNoResultsFoundError(): Promise<void> {
|
||||
const errorLocator = $('[data-automation-id="adf-people-cloud-no-results"]');
|
||||
await BrowserVisibility.waitUntilElementIsVisible(errorLocator);
|
||||
async checkNoResultsFoundError(): Promise<boolean> {
|
||||
try {
|
||||
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