mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4514] Move widgets pages to Testing package (#4703)
This commit is contained in:
committed by
Denys Vuika
parent
7a3b3583f8
commit
446efe4297
157
lib/testing/src/lib/core/pages/form/formFields.ts
Normal file
157
lib/testing/src/lib/core/pages/form/formFields.ts
Normal file
@@ -0,0 +1,157 @@
|
||||
/*!
|
||||
* @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 } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '../../utils/public-api';
|
||||
import { ElementFinder } from 'protractor/built/element';
|
||||
|
||||
export class FormFields {
|
||||
|
||||
formContent = element(by.css('adf-form'));
|
||||
refreshButton = element(by.css('div[class*="form-reload-button"] mat-icon'));
|
||||
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
|
||||
valueLocator = by.css('input');
|
||||
labelLocator = by.css('label');
|
||||
noFormMessage = element(by.css('span[id*="no-form-message"]'));
|
||||
completedTaskNoFormMessage = element(by.css('div[id*="completed-form-message"] p'));
|
||||
attachFormButton = element(by.id('adf-no-form-attach-form-button'));
|
||||
selectFormDropDownArrow = element.all(by.css('adf-attach-form div[class*="mat-select-arrow"]')).first();
|
||||
selectFormContent = element(by.css('div[class*="mat-select-panel"]'));
|
||||
completeButton = element(by.id('adf-form-complete'));
|
||||
errorMessage = by.css('.adf-error-text-container .adf-error-text');
|
||||
|
||||
setFieldValue(locator, field, value) {
|
||||
const fieldElement = element(locator(field));
|
||||
BrowserActions.clearSendKeys(fieldElement, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkWidgetIsVisible(fieldId) {
|
||||
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
|
||||
BrowserVisibility.waitUntilElementIsVisible(fieldElement);
|
||||
}
|
||||
|
||||
checkWidgetIsHidden(fieldId) {
|
||||
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
|
||||
BrowserVisibility.waitUntilElementIsVisible(hiddenElement);
|
||||
}
|
||||
|
||||
getWidget(fieldId) {
|
||||
const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
|
||||
BrowserVisibility.waitUntilElementIsVisible(widget);
|
||||
return widget;
|
||||
}
|
||||
|
||||
getFieldValue(fieldId, valueLocatorParam?: any) {
|
||||
const value = this.getWidget(fieldId).element(valueLocatorParam || this.valueLocator);
|
||||
BrowserVisibility.waitUntilElementIsVisible(value);
|
||||
return value.getAttribute('value');
|
||||
}
|
||||
|
||||
getFieldLabel(fieldId, labelLocatorParam?: any) {
|
||||
const label = this.getWidget(fieldId).all(labelLocatorParam || this.labelLocator).first();
|
||||
return BrowserActions.getText(label);
|
||||
}
|
||||
|
||||
getFieldErrorMessage(fieldId) {
|
||||
const error = this.getWidget(fieldId).element(this.errorMessage);
|
||||
return BrowserActions.getText(error);
|
||||
}
|
||||
|
||||
getFieldText(fieldId, labelLocatorParam?: any) {
|
||||
const label = this.getWidget(fieldId).element(labelLocatorParam || this.labelLocator);
|
||||
return BrowserActions.getText(label);
|
||||
}
|
||||
|
||||
getFieldPlaceHolder(fieldId, locator = 'input') {
|
||||
const placeHolderLocator: ElementFinder = element(by.css(`${locator}#${fieldId}`));
|
||||
BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
|
||||
return placeHolderLocator.getAttribute('placeholder');
|
||||
}
|
||||
|
||||
checkFieldValue(locator, field, val) {
|
||||
BrowserVisibility.waitUntilElementHasValue(element(locator(field)), val);
|
||||
return this;
|
||||
}
|
||||
|
||||
refreshForm() {
|
||||
BrowserActions.click(this.refreshButton);
|
||||
return this;
|
||||
}
|
||||
|
||||
saveForm() {
|
||||
BrowserActions.click(this.saveButton);
|
||||
return this;
|
||||
}
|
||||
|
||||
noFormIsDisplayed() {
|
||||
BrowserVisibility.waitUntilElementIsNotOnPage(this.formContent);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkFormIsDisplayed() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.formContent);
|
||||
return this;
|
||||
}
|
||||
|
||||
getNoFormMessage() {
|
||||
return BrowserActions.getText(this.noFormMessage);
|
||||
}
|
||||
|
||||
getCompletedTaskNoFormMessage() {
|
||||
return BrowserActions.getText(this.completedTaskNoFormMessage);
|
||||
}
|
||||
|
||||
clickOnAttachFormButton() {
|
||||
BrowserActions.click(this.attachFormButton);
|
||||
return this;
|
||||
}
|
||||
|
||||
selectForm(formName) {
|
||||
BrowserActions.click(this.selectFormDropDownArrow);
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.selectFormContent);
|
||||
this.selectFormFromDropDown(formName);
|
||||
return this;
|
||||
}
|
||||
|
||||
selectFormFromDropDown(formName) {
|
||||
const formNameElement = element(by.cssContainingText('span', formName));
|
||||
BrowserActions.click(formNameElement);
|
||||
}
|
||||
|
||||
checkWidgetIsReadOnlyMode(fieldId) {
|
||||
const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
|
||||
const widgetReadOnly = widget.element(by.css('div[class*="adf-readonly"]'));
|
||||
BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly);
|
||||
return widgetReadOnly;
|
||||
}
|
||||
|
||||
completeForm() {
|
||||
BrowserActions.click(this.completeButton);
|
||||
}
|
||||
|
||||
setValueInInputById(fieldId, value) {
|
||||
const input = element(by.id(fieldId));
|
||||
BrowserActions.clearSendKeys(input, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
isCompleteFormButtonDisabled() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
|
||||
return this.completeButton.getAttribute('disabled');
|
||||
}
|
||||
}
|
43
lib/testing/src/lib/core/pages/form/formPage.ts
Normal file
43
lib/testing/src/lib/core/pages/form/formPage.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*!
|
||||
* @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 } from 'protractor';
|
||||
import { BrowserVisibility } from '../../utils/browser-visibility';
|
||||
|
||||
export class FormPage {
|
||||
|
||||
errorLog = element(by.css('div[class*="console"]'));
|
||||
|
||||
checkErrorMessageForWidgetIsDisplayed(errorMessage) {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('.adf-error-text', errorMessage)));
|
||||
}
|
||||
|
||||
checkErrorMessageForWidgetIsNotDisplayed(errorMessage) {
|
||||
return BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('.adf-error-text', errorMessage)));
|
||||
}
|
||||
|
||||
checkErrorLogMessage(errorMessage) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.errorLog);
|
||||
return BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage)));
|
||||
}
|
||||
|
||||
checkErrorMessageIsNotDisplayed(errorMessage) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.errorLog);
|
||||
return BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage)));
|
||||
}
|
||||
|
||||
}
|
21
lib/testing/src/lib/core/pages/form/public-api.ts
Normal file
21
lib/testing/src/lib/core/pages/form/public-api.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
export * from './widgets/public-api';
|
||||
|
||||
export * from './formFields';
|
||||
export * from './formPage';
|
69
lib/testing/src/lib/core/pages/form/widgets/amountWidget.ts
Normal file
69
lib/testing/src/lib/core/pages/form/widgets/amountWidget.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* @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, protractor } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||
import { FormFields } from '../formFields';
|
||||
|
||||
export class AmountWidget {
|
||||
|
||||
currency = by.css('span[class="adf-amount-widget__prefix-spacing"]');
|
||||
formFields = new FormFields();
|
||||
|
||||
getAmountFieldLabel(fieldId) {
|
||||
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
|
||||
return BrowserActions.getText(label);
|
||||
}
|
||||
|
||||
getAmountFieldCurrency(fieldId) {
|
||||
return BrowserActions.getText(this.formFields.getWidget(fieldId).element(this.currency));
|
||||
}
|
||||
|
||||
setFieldValue(fieldId, value) {
|
||||
return this.formFields.setValueInInputById(fieldId, value);
|
||||
}
|
||||
|
||||
removeFromAmountWidget(fieldId) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.formFields.getWidget(fieldId));
|
||||
|
||||
const amountWidgetInput = element(by.id(fieldId));
|
||||
amountWidgetInput.getAttribute('value').then((result) => {
|
||||
for (let i = result.length; i >= 0; i--) {
|
||||
amountWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
clearFieldValue(fieldId) {
|
||||
const numberField = element(by.id(fieldId));
|
||||
BrowserVisibility.waitUntilElementIsVisible(numberField);
|
||||
return numberField.clear();
|
||||
}
|
||||
|
||||
checkWidgetIsVisible(fieldId) {
|
||||
return this.formFields.checkWidgetIsVisible(fieldId);
|
||||
}
|
||||
|
||||
getErrorMessage(fieldId) {
|
||||
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
|
||||
return BrowserActions.getText(errorMessage);
|
||||
}
|
||||
|
||||
getPlaceholder(fieldId) {
|
||||
return this.formFields.getFieldPlaceHolder(fieldId);
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||
import * as remote from 'selenium-webdriver/remote';
|
||||
import { element, by, browser } from 'protractor';
|
||||
|
||||
export class AttachFileWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
uploadLocator = by.css('button[id="attachfile"]');
|
||||
localStorageButton = element(by.css('input[id="attachfile"]'));
|
||||
filesListLocator = by.css('div[id="adf-attach-widget-readonly-list"]');
|
||||
|
||||
attachFile(fieldId, fileLocation) {
|
||||
browser.setFileDetector(new remote.FileDetector());
|
||||
const widget = this.formFields.getWidget(fieldId);
|
||||
const uploadButton = widget.element(this.uploadLocator);
|
||||
BrowserActions.click(uploadButton);
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.localStorageButton);
|
||||
this.localStorageButton.sendKeys(fileLocation);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkFileIsAttached(fieldId, name) {
|
||||
const widget = this.formFields.getWidget(fieldId);
|
||||
const fileAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
|
||||
BrowserVisibility.waitUntilElementIsVisible(fileAttached);
|
||||
return this;
|
||||
}
|
||||
|
||||
viewFile(name) {
|
||||
const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
|
||||
BrowserActions.click(fileView);
|
||||
browser.actions().doubleClick(fileView).perform();
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { BrowserActions } from '../../../utils/public-api';
|
||||
import { by, element } from 'protractor';
|
||||
|
||||
export class CheckboxWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
checkboxLabel = element(by.css('span[class*="mat-checkbox-label"]'));
|
||||
|
||||
getCheckboxLabel() {
|
||||
return BrowserActions.getText(this.checkboxLabel);
|
||||
}
|
||||
|
||||
clickCheckboxInput(fieldId) {
|
||||
const checkboxInput = element.all(by.css(`mat-checkbox[id="${fieldId}"] div`)).first();
|
||||
BrowserActions.click(checkboxInput);
|
||||
}
|
||||
|
||||
isCheckboxDisplayed(fieldId) {
|
||||
return this.formFields.checkWidgetIsVisible(fieldId);
|
||||
}
|
||||
|
||||
isCheckboxHidden(fieldId) {
|
||||
return this.formFields.checkWidgetIsHidden(fieldId);
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by } from 'protractor';
|
||||
|
||||
export class ContainerWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
fileLocator = by.css("div [class*='upload-widget__content-text']");
|
||||
|
||||
getFieldText(fieldId) {
|
||||
return this.formFields.getFieldText(fieldId, this.fileLocator);
|
||||
}
|
||||
}
|
@@ -0,0 +1,96 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { element, by, protractor } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||
|
||||
export class DateTimeWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
outsideLayer = element(by.css('div[class*="cdk-overlay-container"]'));
|
||||
|
||||
checkWidgetIsVisible(fieldId) {
|
||||
return this.formFields.checkWidgetIsVisible(fieldId);
|
||||
}
|
||||
|
||||
getDateTimeLabel(fieldId) {
|
||||
const label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
|
||||
return BrowserActions.getText(label);
|
||||
}
|
||||
|
||||
setDateTimeInput(fieldId, value) {
|
||||
return this.formFields.setValueInInputById(fieldId, value);
|
||||
}
|
||||
|
||||
clearDateTimeInput(fieldId) {
|
||||
const dateInput = element(by.id(fieldId));
|
||||
BrowserVisibility.waitUntilElementIsVisible(dateInput);
|
||||
return dateInput.clear();
|
||||
}
|
||||
|
||||
clickOutsideWidget(fieldId) {
|
||||
const form = this.formFields.getWidget(fieldId);
|
||||
BrowserActions.click(form);
|
||||
}
|
||||
|
||||
closeDataTimeWidget() {
|
||||
BrowserActions.click(this.outsideLayer);
|
||||
}
|
||||
|
||||
getErrorMessage(fieldId) {
|
||||
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
|
||||
return BrowserActions.getText(errorMessage);
|
||||
}
|
||||
|
||||
selectDay(day) {
|
||||
const selectedDay = element(by.cssContainingText('div[class*="mat-datetimepicker-calendar-body-cell-content"]', day));
|
||||
BrowserActions.click(selectedDay);
|
||||
}
|
||||
|
||||
openDatepicker(fieldId) {
|
||||
return element(by.id(fieldId)).click();
|
||||
}
|
||||
|
||||
private selectTime(time) {
|
||||
const selectedTime = element(by.cssContainingText('div[class*="mat-datetimepicker-clock-cell"]', time));
|
||||
BrowserActions.click(selectedTime);
|
||||
}
|
||||
|
||||
selectHour(hour) {
|
||||
return this.selectTime(hour);
|
||||
}
|
||||
|
||||
selectMinute(minute) {
|
||||
return this.selectTime(minute);
|
||||
}
|
||||
|
||||
getPlaceholder(fieldId) {
|
||||
return this.formFields.getFieldPlaceHolder(fieldId);
|
||||
}
|
||||
|
||||
removeFromDatetimeWidget(fieldId) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.formFields.getWidget(fieldId));
|
||||
|
||||
const amountWidgetInput = element(by.id(fieldId));
|
||||
amountWidgetInput.getAttribute('value').then((result) => {
|
||||
for (let i = result.length; i >= 0; i--) {
|
||||
amountWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
70
lib/testing/src/lib/core/pages/form/widgets/dateWidget.ts
Normal file
70
lib/testing/src/lib/core/pages/form/widgets/dateWidget.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { element, by, protractor } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||
|
||||
export class DateWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
checkWidgetIsVisible(fieldId) {
|
||||
return this.formFields.checkWidgetIsVisible(fieldId);
|
||||
}
|
||||
|
||||
checkLabelIsVisible(fieldId) {
|
||||
return this.formFields.checkWidgetIsVisible(fieldId);
|
||||
}
|
||||
|
||||
getDateLabel(fieldId) {
|
||||
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
|
||||
return BrowserActions.getText(label);
|
||||
}
|
||||
|
||||
setDateInput(fieldId, value) {
|
||||
this.removeFromDatetimeWidget(fieldId);
|
||||
return this.formFields.setValueInInputById(fieldId, value);
|
||||
}
|
||||
|
||||
clearDateInput(fieldId) {
|
||||
const dateInput = element(by.id(fieldId));
|
||||
BrowserVisibility.waitUntilElementIsVisible(dateInput);
|
||||
return dateInput.clear();
|
||||
}
|
||||
|
||||
clickOutsideWidget(fieldId) {
|
||||
const form = this.formFields.getWidget(fieldId);
|
||||
BrowserActions.click(form);
|
||||
}
|
||||
|
||||
getErrorMessage(fieldId) {
|
||||
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
|
||||
return BrowserActions.getText(errorMessage);
|
||||
}
|
||||
|
||||
removeFromDatetimeWidget(fieldId) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.formFields.getWidget(fieldId));
|
||||
|
||||
const dateWidgetInput = element(by.id(fieldId));
|
||||
dateWidgetInput.getAttribute('value').then((result) => {
|
||||
for (let i = result.length; i >= 0; i--) {
|
||||
dateWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by } from 'protractor';
|
||||
|
||||
export class DisplayTextWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
labelLocator = by.css('div[class*="adf-display-text-widget"]');
|
||||
inputLocator = by.css('input');
|
||||
|
||||
getFieldLabel(fieldId) {
|
||||
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
||||
}
|
||||
|
||||
getFieldValue(fieldId) {
|
||||
return this.formFields.getFieldValue(fieldId, this.inputLocator);
|
||||
}
|
||||
|
||||
getFieldText(fieldId) {
|
||||
return this.formFields.getFieldText(fieldId, this.labelLocator);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by } from 'protractor';
|
||||
|
||||
export class DisplayValueWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
labelLocator = by.css('span[class*="unknown-text"]');
|
||||
inputLocator = by.css('input');
|
||||
|
||||
getFieldLabel(fieldId) {
|
||||
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
||||
}
|
||||
|
||||
getFieldValue(fieldId) {
|
||||
return this.formFields.getFieldValue(fieldId, this.inputLocator);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by } from 'protractor';
|
||||
|
||||
export class DocumentWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
fileLocator = by.css("div [class*='upload-widget__content-text']");
|
||||
|
||||
getFieldText(fieldId) {
|
||||
return this.formFields.getFieldText(fieldId, this.fileLocator);
|
||||
}
|
||||
|
||||
getFileName(fieldId) {
|
||||
return this.formFields.getFieldText(fieldId, this.fileLocator);
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by, element } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||
|
||||
export class DropdownWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
selectedOptionLocator = by.css('mat-select[id="dropdown"] span span');
|
||||
dropdown = element(by.id('dropdown'));
|
||||
|
||||
getSelectedOptionText(fieldId) {
|
||||
return this.formFields.getFieldText(fieldId, this.selectedOptionLocator);
|
||||
}
|
||||
|
||||
selectOption(option) {
|
||||
this.openDropdown();
|
||||
const row = element(by.cssContainingText('mat-option span', option));
|
||||
BrowserActions.click(row);
|
||||
}
|
||||
|
||||
openDropdown() {
|
||||
this.checkDropdownIsDisplayed();
|
||||
BrowserVisibility.waitUntilElementIsClickable(this.dropdown);
|
||||
return this.dropdown.click();
|
||||
}
|
||||
|
||||
checkDropdownIsDisplayed() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.dropdown);
|
||||
return this.dropdown;
|
||||
}
|
||||
}
|
@@ -0,0 +1,128 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by, element, protractor } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||
|
||||
export class DynamicTableWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
labelLocator = by.css('dynamic-table-widget div div');
|
||||
columnNameLocator = by.css('table[id*="dynamic-table"] th');
|
||||
addButton = element(by.id('label-add-row'));
|
||||
cancelButton = element(by.cssContainingText('button span', 'Cancel'));
|
||||
editButton = element(by.cssContainingText('button span', 'edit'));
|
||||
addRow = element(by.id('dynamictable-add-row'));
|
||||
columnDateTime = element(by.id('columnDateTime'));
|
||||
columnDate = element(by.id('columnDate'));
|
||||
calendarHeader = element(by.css('div[class="mat-datetimepicker-calendar-header-date-time"]'));
|
||||
calendarContent = element(by.css('div[class="mat-datetimepicker-calendar-content"]'));
|
||||
saveButton = element(by.cssContainingText('button span', 'Save'));
|
||||
errorMessage = element(by.css('div[class="adf-error-text"]'));
|
||||
dateWidget = element.all(by.css('mat-datepicker-toggle button')).first();
|
||||
tableRow = element.all(by.css('tbody tr'));
|
||||
dataTableInput = element(by.id('id'));
|
||||
|
||||
getFieldLabel(fieldId) {
|
||||
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
||||
}
|
||||
|
||||
getColumnName(fieldId) {
|
||||
return this.formFields.getFieldText(fieldId, this.columnNameLocator);
|
||||
}
|
||||
|
||||
clickAddButton() {
|
||||
BrowserActions.click(this.addButton);
|
||||
}
|
||||
|
||||
clickAddRow() {
|
||||
BrowserActions.click(this.addRow);
|
||||
}
|
||||
|
||||
clickTableRow(rowNumber) {
|
||||
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
|
||||
BrowserActions.click(tableRowByIndex);
|
||||
}
|
||||
|
||||
clickEditButton() {
|
||||
BrowserActions.click(this.editButton);
|
||||
}
|
||||
|
||||
clickCancelButton() {
|
||||
BrowserActions.click(this.cancelButton);
|
||||
}
|
||||
|
||||
setDatatableInput(text) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.dataTableInput);
|
||||
this.dataTableInput.clear();
|
||||
return this.dataTableInput.sendKeys(text);
|
||||
}
|
||||
|
||||
getTableRowText(rowNumber) {
|
||||
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
|
||||
return BrowserActions.getText(tableRowByIndex);
|
||||
}
|
||||
|
||||
checkTableRowIsNotVisible(rowNumber) {
|
||||
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
|
||||
return BrowserVisibility.waitUntilElementIsNotVisible(tableRowByIndex);
|
||||
}
|
||||
|
||||
clickColumnDateTime() {
|
||||
BrowserActions.click(this.columnDateTime);
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.calendarHeader);
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.calendarContent);
|
||||
BrowserActions.closeMenuAndDialogs();
|
||||
}
|
||||
|
||||
addRandomStringOnDateTime(randomText) {
|
||||
BrowserActions.click(this.columnDateTime);
|
||||
BrowserActions.closeMenuAndDialogs();
|
||||
this.columnDateTime.sendKeys(randomText);
|
||||
this.columnDateTime.sendKeys(protractor.Key.ENTER);
|
||||
return this.columnDateTime.getAttribute('value');
|
||||
}
|
||||
|
||||
addRandomStringOnDate(randomText) {
|
||||
BrowserActions.click(this.columnDate);
|
||||
return this.columnDate.sendKeys(randomText);
|
||||
}
|
||||
|
||||
clickSaveButton() {
|
||||
BrowserActions.click(this.saveButton);
|
||||
}
|
||||
|
||||
checkErrorMessage() {
|
||||
return BrowserActions.getText(this.errorMessage);
|
||||
}
|
||||
|
||||
clickDateWidget() {
|
||||
BrowserActions.click(this.dateWidget);
|
||||
}
|
||||
|
||||
getTableRow(rowNumber) {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.tableRow.get(rowNumber));
|
||||
}
|
||||
|
||||
checkItemIsPresent(item) {
|
||||
const row = element(by.cssContainingText('table tbody tr td span', item));
|
||||
const present = BrowserVisibility.waitUntilElementIsVisible(row);
|
||||
expect(present).toBe(true);
|
||||
}
|
||||
}
|
31
lib/testing/src/lib/core/pages/form/widgets/headerWidget.ts
Normal file
31
lib/testing/src/lib/core/pages/form/widgets/headerWidget.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by } from 'protractor';
|
||||
|
||||
export class HeaderWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
labelLocator = by.css('span[id="container-header-label"]');
|
||||
|
||||
getFieldLabel(fieldId) {
|
||||
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by, element } from 'protractor';
|
||||
import { BrowserActions } from '../../../utils/public-api';
|
||||
|
||||
export class HyperlinkWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
fieldLocator = by.css('div[class="adf-hyperlink-widget "] a');
|
||||
|
||||
getFieldText(fieldId) {
|
||||
return this.formFields.getFieldText(fieldId, this.fieldLocator);
|
||||
}
|
||||
|
||||
getFieldLabel(fieldId) {
|
||||
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
|
||||
return BrowserActions.getText(label);
|
||||
}
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by } from 'protractor';
|
||||
|
||||
export class MultilineTextWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
valueLocator = by.css('textarea');
|
||||
labelLocator = by.css("label[class*='adf-label']");
|
||||
|
||||
getFieldValue(fieldId) {
|
||||
return this.formFields.getFieldValue(fieldId, this.valueLocator);
|
||||
}
|
||||
|
||||
getFieldLabel(fieldId) {
|
||||
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
||||
}
|
||||
|
||||
getFieldPlaceHolder(fieldId) {
|
||||
return this.formFields.getFieldPlaceHolder(fieldId, 'textarea');
|
||||
}
|
||||
|
||||
setValue(fieldId, value) {
|
||||
return this.formFields.setFieldValue(by.id, fieldId, value);
|
||||
}
|
||||
|
||||
getErrorMessage(fieldId) {
|
||||
return this.formFields.getFieldErrorMessage(fieldId);
|
||||
}
|
||||
|
||||
}
|
53
lib/testing/src/lib/core/pages/form/widgets/numberWidget.ts
Normal file
53
lib/testing/src/lib/core/pages/form/widgets/numberWidget.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
/*!
|
||||
* @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 } from 'protractor';
|
||||
import { FormFields } from '../formFields';
|
||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||
|
||||
export class NumberWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
getNumberFieldLabel(fieldId) {
|
||||
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
|
||||
return BrowserActions.getText(label);
|
||||
}
|
||||
|
||||
setFieldValue(fieldId, value) {
|
||||
return this.formFields.setValueInInputById(fieldId, value);
|
||||
}
|
||||
|
||||
clearFieldValue(fieldId) {
|
||||
const numberField = element(by.id(fieldId));
|
||||
BrowserVisibility.waitUntilElementIsVisible(numberField);
|
||||
return numberField.clear();
|
||||
}
|
||||
|
||||
checkWidgetIsVisible(fieldId) {
|
||||
return this.formFields.checkWidgetIsVisible(fieldId);
|
||||
}
|
||||
|
||||
getErrorMessage(fieldId) {
|
||||
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
|
||||
return BrowserActions.getText(errorMessage);
|
||||
}
|
||||
|
||||
getPlaceholder(fieldId) {
|
||||
return this.formFields.getFieldPlaceHolder(fieldId);
|
||||
}
|
||||
}
|
76
lib/testing/src/lib/core/pages/form/widgets/peopleWidget.ts
Normal file
76
lib/testing/src/lib/core/pages/form/widgets/peopleWidget.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by, element } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||
|
||||
export class PeopleWidget {
|
||||
|
||||
peopleField = element(by.css('input[data-automation-id="adf-people-search-input"]'));
|
||||
firstResult = element(by.id('adf-people-widget-user-0'));
|
||||
|
||||
formFields = new FormFields();
|
||||
labelLocator = by.css('div[class*="display-text-widget"]');
|
||||
inputLocator = by.id('involvepeople');
|
||||
peopleDropDownList = by.css('div[class*="adf-people-widget-list"]');
|
||||
|
||||
getFieldLabel(fieldId) {
|
||||
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
||||
}
|
||||
|
||||
getFieldValue(fieldId) {
|
||||
return this.formFields.getFieldValue(fieldId, this.inputLocator);
|
||||
}
|
||||
|
||||
getFieldText(fieldId) {
|
||||
return this.formFields.getFieldText(fieldId, this.labelLocator);
|
||||
}
|
||||
|
||||
insertUser(fieldId, value) {
|
||||
return this.formFields.setValueInInputById(fieldId, value);
|
||||
}
|
||||
|
||||
checkDropDownListIsDisplayed() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(element(this.peopleDropDownList));
|
||||
}
|
||||
|
||||
checkUserIsListed(userName) {
|
||||
const user = element(by.cssContainingText('.adf-people-label-name', userName));
|
||||
return BrowserVisibility.waitUntilElementIsVisible(user);
|
||||
}
|
||||
|
||||
selectUserFromDropDown(userName) {
|
||||
const user = element(by.cssContainingText('.adf-people-label-name', userName));
|
||||
BrowserActions.click(user);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkPeopleFieldIsDisplayed() {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(this.peopleField);
|
||||
}
|
||||
|
||||
fillPeopleField(value) {
|
||||
BrowserVisibility.waitUntilElementIsClickable(this.peopleField);
|
||||
return this.peopleField.sendKeys(value);
|
||||
}
|
||||
|
||||
selectUserFromDropdown() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.firstResult);
|
||||
return this.firstResult.click();
|
||||
}
|
||||
}
|
18
lib/testing/src/lib/core/pages/form/widgets/public-api.ts
Normal file
18
lib/testing/src/lib/core/pages/form/widgets/public-api.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
export * from './widget';
|
@@ -0,0 +1,53 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by, element } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||
|
||||
export class RadioButtonsWidget {
|
||||
|
||||
selectedOption = by.css('mat-radio-button[ng-pristine]');
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
getSpecificOptionLabel(fieldId, optionNumber) {
|
||||
const optionLocator = by.css('label[for*="radiobuttons-option_' + optionNumber + '"]');
|
||||
|
||||
const option = this.formFields.getWidget(fieldId).element(optionLocator);
|
||||
return BrowserActions.getText(option);
|
||||
}
|
||||
|
||||
selectOption(fieldId, optionNumber) {
|
||||
const optionLocator = by.css(`label[for*="${fieldId}-option_${optionNumber}"]`);
|
||||
|
||||
const option = this.formFields.getWidget(fieldId).element(optionLocator);
|
||||
return BrowserActions.click(option);
|
||||
|
||||
}
|
||||
|
||||
isSelectionClean(fieldId) {
|
||||
const option = this.formFields.getWidget(fieldId).element(this.selectedOption);
|
||||
return BrowserVisibility.waitUntilElementIsNotVisible(option);
|
||||
}
|
||||
|
||||
getRadioWidgetLabel(fieldId) {
|
||||
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
|
||||
return BrowserActions.getText(label);
|
||||
}
|
||||
|
||||
}
|
54
lib/testing/src/lib/core/pages/form/widgets/textWidget.ts
Normal file
54
lib/testing/src/lib/core/pages/form/widgets/textWidget.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
/*!
|
||||
* @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 { FormFields } from '../formFields';
|
||||
import { by } from 'protractor';
|
||||
|
||||
export class TextWidget {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
labelLocator = by.css("label[class*='adf-label']");
|
||||
|
||||
getFieldLabel(fieldId) {
|
||||
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
||||
}
|
||||
|
||||
getFieldPlaceHolder(fieldId) {
|
||||
return this.formFields.getFieldPlaceHolder(fieldId);
|
||||
}
|
||||
|
||||
setValue(fieldId, value) {
|
||||
return this.formFields.setFieldValue(by.id, fieldId, value);
|
||||
}
|
||||
|
||||
getFieldValue(fieldId) {
|
||||
return this.formFields.getFieldValue(fieldId);
|
||||
}
|
||||
|
||||
getErrorMessage(fieldId) {
|
||||
return this.formFields.getFieldErrorMessage(fieldId);
|
||||
}
|
||||
|
||||
isWidgetVisible(fieldId) {
|
||||
return this.formFields.checkWidgetIsVisible(fieldId);
|
||||
}
|
||||
|
||||
isWidgetNotVisible(fieldId) {
|
||||
return this.formFields.checkWidgetIsHidden(fieldId);
|
||||
}
|
||||
}
|
110
lib/testing/src/lib/core/pages/form/widgets/widget.ts
Normal file
110
lib/testing/src/lib/core/pages/form/widgets/widget.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
/*!
|
||||
* @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 { MultilineTextWidget } from './multilineTextWidget';
|
||||
import { HeaderWidget } from './headerWidget';
|
||||
import { DisplayTextWidget } from './displayTextWidget';
|
||||
import { AttachFileWidget } from './attachFileWidget';
|
||||
import { DisplayValueWidget } from './displayValueWidget';
|
||||
import { RadioButtonsWidget } from './radioButtonsWidget';
|
||||
import { HyperlinkWidget } from './hyperlinkWidget';
|
||||
import { DropdownWidget } from './dropdownWidget';
|
||||
import { DynamicTableWidget } from './dynamicTableWidget';
|
||||
import { TextWidget } from './textWidget';
|
||||
import { CheckboxWidget } from './checkboxWidget';
|
||||
import { DateWidget } from './dateWidget';
|
||||
import { DateTimeWidget } from './dateTimeWidget';
|
||||
import { NumberWidget } from './numberWidget';
|
||||
import { AmountWidget } from './amountWidget';
|
||||
import { ContainerWidget } from './containerWidget';
|
||||
import { PeopleWidget } from './peopleWidget';
|
||||
import { DocumentWidget } from './documentWidget';
|
||||
|
||||
export class Widget {
|
||||
|
||||
multilineTextWidget() {
|
||||
return new MultilineTextWidget();
|
||||
}
|
||||
|
||||
headerWidget() {
|
||||
return new HeaderWidget();
|
||||
}
|
||||
|
||||
displayTextWidget() {
|
||||
return new DisplayTextWidget();
|
||||
}
|
||||
|
||||
attachFileWidget() {
|
||||
return new AttachFileWidget();
|
||||
}
|
||||
|
||||
displayValueWidget() {
|
||||
return new DisplayValueWidget();
|
||||
}
|
||||
|
||||
radioWidget() {
|
||||
return new RadioButtonsWidget();
|
||||
}
|
||||
|
||||
hyperlink() {
|
||||
return new HyperlinkWidget();
|
||||
}
|
||||
|
||||
dropdown() {
|
||||
return new DropdownWidget();
|
||||
}
|
||||
|
||||
dynamicTable() {
|
||||
return new DynamicTableWidget();
|
||||
}
|
||||
|
||||
textWidget() {
|
||||
return new TextWidget();
|
||||
}
|
||||
|
||||
documentWidget() {
|
||||
return new DocumentWidget();
|
||||
}
|
||||
|
||||
checkboxWidget() {
|
||||
return new CheckboxWidget();
|
||||
}
|
||||
|
||||
dateWidget() {
|
||||
return new DateWidget();
|
||||
}
|
||||
|
||||
dateTimeWidget() {
|
||||
return new DateTimeWidget();
|
||||
}
|
||||
|
||||
numberWidget() {
|
||||
return new NumberWidget();
|
||||
}
|
||||
|
||||
amountWidget() {
|
||||
return new AmountWidget();
|
||||
}
|
||||
|
||||
containerWidget() {
|
||||
return new ContainerWidget();
|
||||
}
|
||||
|
||||
peopleWidget() {
|
||||
return new PeopleWidget();
|
||||
}
|
||||
}
|
@@ -25,3 +25,5 @@ export * from './data-table-component.page';
|
||||
export * from './pagination.page';
|
||||
export * from './error.page';
|
||||
export * from './login.page';
|
||||
|
||||
export * from './form/public-api';
|
||||
|
Reference in New Issue
Block a user