mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-1453] added e2e tests for checking different configurations for people/group cloud widgets (#5446)
This commit is contained in:
committed by
GitHub
parent
4b1471d9c3
commit
9276333352
47
lib/testing/src/lib/core/pages/config-editor-page.ts
Normal file
47
lib/testing/src/lib/core/pages/config-editor-page.ts
Normal file
@@ -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 { element, by, browser, ElementFinder } from 'protractor';
|
||||
import { BrowserVisibility } from '../utils/browser-visibility';
|
||||
import { BrowserActions } from '../utils/browser-actions';
|
||||
|
||||
export class ConfigEditorPage {
|
||||
|
||||
textField: ElementFinder = element(by.css('#adf-form-config-editor div.overflow-guard > textarea'));
|
||||
|
||||
async enterConfiguration(text): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.textField, text);
|
||||
}
|
||||
|
||||
async clickSaveButton(): Promise<void> {
|
||||
const saveButton: ElementFinder = element(by.id('app-form-config-save'));
|
||||
await BrowserActions.click(saveButton);
|
||||
}
|
||||
|
||||
async clickClearButton(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
|
||||
const clearButton: ElementFinder = element(by.id('app-form-config-clear'));
|
||||
await BrowserActions.click(clearButton);
|
||||
}
|
||||
|
||||
async enterBulkConfiguration(text): Promise<void> {
|
||||
await this.clickClearButton();
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
|
||||
await browser.executeScript('this.monaco.editor.getModels()[0].setValue(`' + JSON.stringify(text) + '`)');
|
||||
await this.clickSaveButton();
|
||||
}
|
||||
}
|
@@ -29,3 +29,4 @@ export * from './notification-history.page';
|
||||
export * from './form/public-api';
|
||||
export * from './card-view/public-api';
|
||||
export * from './viewerPage';
|
||||
export * from './config-editor-page';
|
||||
|
@@ -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 { by, element, ElementFinder } from 'protractor';
|
||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
import { ConfigEditorPage } from '../../core/pages/config-editor-page';
|
||||
|
||||
export class FormCloudComponentPage {
|
||||
|
||||
formCloudEditor: ElementFinder = element.all(by.css('.mat-tab-list .mat-tab-label')).get(1);
|
||||
formCloudRender: ElementFinder = element.all(by.css('.mat-tab-list .mat-tab-label')).get(0);
|
||||
|
||||
configEditorPage = new ConfigEditorPage();
|
||||
|
||||
async goToEditor(): Promise<void> {
|
||||
await BrowserActions.click(this.formCloudEditor);
|
||||
}
|
||||
|
||||
async goToRenderedForm(): Promise<void> {
|
||||
await BrowserActions.click(this.formCloudRender);
|
||||
}
|
||||
|
||||
async setConfigToEditor(text): Promise<void> {
|
||||
const configEditor = element(by.id('adf-form-config-editor'));
|
||||
const form = element(by.css('adf-cloud-form'));
|
||||
await this.goToEditor();
|
||||
await BrowserVisibility.waitUntilElementIsVisible(configEditor);
|
||||
await this.configEditorPage.enterBulkConfiguration(text);
|
||||
await this.goToRenderedForm();
|
||||
await BrowserVisibility.waitUntilElementIsVisible(form);
|
||||
}
|
||||
}
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { browser, by, element, ElementFinder } from 'protractor';
|
||||
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/formFields';
|
||||
@@ -26,8 +26,6 @@ export class GroupCloudComponentPage {
|
||||
formFields: FormFields = new FormFields();
|
||||
|
||||
async searchGroups(name: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
|
||||
await browser.sleep(1000);
|
||||
await BrowserActions.clearSendKeys(this.groupCloudSearch, name);
|
||||
}
|
||||
|
||||
@@ -42,7 +40,7 @@ export class GroupCloudComponentPage {
|
||||
|
||||
async selectGroupFromList(name: string): Promise<void> {
|
||||
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
|
||||
await browser.sleep(1000);
|
||||
|
||||
await BrowserActions.click(groupRow);
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
|
||||
}
|
||||
@@ -79,4 +77,24 @@ export class GroupCloudComponentPage {
|
||||
}
|
||||
}
|
||||
|
||||
async checkGroupWidgetIsReadOnly (): Promise <boolean> {
|
||||
const readOnlyGroup = element(by.css('group-cloud-widget .adf-readonly'));
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(readOnlyGroup);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async checkGroupActiveField(name): Promise <boolean> {
|
||||
const activeGroupField = element(by.css('group-cloud-widget .adf-readonly'));
|
||||
try {
|
||||
await BrowserActions.clearSendKeys(activeGroupField, name);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { browser, by, element, ElementFinder, Locator, protractor } from 'protractor';
|
||||
import { by, element, ElementFinder, Locator, protractor } from 'protractor';
|
||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
import { FormFields } from '../../core/pages/form/formFields';
|
||||
@@ -44,9 +44,6 @@ export class PeopleCloudComponentPage {
|
||||
}
|
||||
|
||||
async searchAssignee(name: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
|
||||
await BrowserVisibility.waitUntilElementIsClickable(this.peopleCloudSearch);
|
||||
await browser.sleep(1000);
|
||||
await BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
|
||||
}
|
||||
|
||||
@@ -56,7 +53,6 @@ export class PeopleCloudComponentPage {
|
||||
|
||||
async selectAssigneeFromList(name: string): Promise<void> {
|
||||
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
|
||||
await browser.sleep(2000);
|
||||
await BrowserActions.click(assigneeRow);
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
|
||||
}
|
||||
@@ -82,7 +78,6 @@ export class PeopleCloudComponentPage {
|
||||
|
||||
async getAssigneeFieldContent(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.assigneeField);
|
||||
await browser.sleep(1000);
|
||||
return this.assigneeField.getAttribute('value');
|
||||
}
|
||||
|
||||
@@ -118,4 +113,24 @@ export class PeopleCloudComponentPage {
|
||||
await BrowserActions.click(peopleInput);
|
||||
}
|
||||
|
||||
async checkPeopleWidgetIsReadOnly (): Promise <boolean> {
|
||||
const readOnlyAttribute = element(by.css('people-cloud-widget .adf-readonly'));
|
||||
try {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(readOnlyAttribute);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async checkPeopleActiveField(name): Promise <boolean> {
|
||||
const activePeopleField = element(by.css('people-cloud-widget .adf-readonly'));
|
||||
try {
|
||||
await BrowserActions.clearSendKeys(activePeopleField, name);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -28,5 +28,6 @@ export * from './task-filters-cloud-component.page';
|
||||
export * from './task-list-cloud-component.page';
|
||||
export * from './start-process-cloud-component.page';
|
||||
export * from './task-form-cloud-component.page';
|
||||
export * from './form-cloud-component.page';
|
||||
export * from './dialog/public-api';
|
||||
export * from './form/public-api';
|
||||
|
Reference in New Issue
Block a user