[ADF-3671] Add automation tests for Form Widgets (#3911)

* [ADF-3617] Fix bugs in Task Details Page controller

* [ADF-3617] Fix bugs in Task Page controller

* [ADF-3617] Separate in different describes automation tests

* [ADF-3671] start working on e2e form tests

* [ADF-3671] improved checks for form widgets

* [ADF-3671] start adding multiline text widget tsts

* [ADF-3671] added test for multiline and some improvements

* [ADF-3671] Add e2e tests for Dropdown, Date, Checkbox widgets

* [ADF-3671] Add e2e test for radio, number, hyperlink widgets

* [ADF-3671] Add automation tests for Form Widgets

* [ADF-3671] Update usage of Dropdown Widget

* [ADF-3671] Fix fileModel file and rename widget controles

* [ADF-3671] Rename Widget Controllers

* [ADF-3671] Remove unused imports and fix dynamic table e2e test

* [ADF-3671] Fix spell errors

* [ADF-3671] Fix people, date time, attach widget

* [ADF-3671] Fix Form People widget tests

* [ADF-3671] Rebase and remove unused variables
This commit is contained in:
davidcanonieto
2018-10-26 14:03:13 +01:00
committed by Eugenio Romano
parent 9599b84a84
commit ee7af9d797
51 changed files with 2790 additions and 414 deletions

View File

@@ -1,46 +0,0 @@
/*!
* @license
* Copyright 2016 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 Util = require('../../../../util/util');
export class Amount {
amountWidgetLabel11 = element(by.id('field-label11-container'));
amountWidgetInput = element(by.css('div[id="field-label11-container"] input[id="label11"]'));
checkLabel11IsDisplayed() {
return Util.waitUntilElementIsVisible(this.amountWidgetLabel11);
}
addIntoAmountWidget(input) {
Util.waitUntilElementIsVisible(this.amountWidgetLabel11);
this.amountWidgetInput.click();
this.amountWidgetInput.sendKeys(input);
return this.amountWidgetInput.sendKeys(protractor.Key.ENTER);
}
removeFromAmountWidget() {
Util.waitUntilElementIsVisible(this.amountWidgetLabel11);
this.amountWidgetInput.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
this.amountWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
}
}

View File

@@ -1,46 +0,0 @@
/*!
* @license
* Copyright 2016 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 Util = require('../../../../util/util');
export class Date {
dateWidgetLabel7 = element(by.id('field-label7-container'));
dateWidgetInput = element(by.css('div[id="field-label7-container"] input[id="label7"]'));
checkLabel7IsDisplayed() {
return Util.waitUntilElementIsVisible(this.dateWidgetLabel7);
}
addIntoDateWidget(input) {
Util.waitUntilElementIsVisible(this.dateWidgetLabel7);
this.dateWidgetInput.click();
this.dateWidgetInput.sendKeys(input);
return this.dateWidgetInput.sendKeys(protractor.Key.ENTER);
}
removeFromDateWidget() {
Util.waitUntilElementIsVisible(this.dateWidgetLabel7);
this.dateWidgetInput.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
this.dateWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
}
}

View File

@@ -1,46 +0,0 @@
/*!
* @license
* Copyright 2016 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 Util = require('../../../../util/util');
export class NumberWidget {
numberWidgetLabel4 = element(by.id('field-label4-container'));
numberWidgetInput = element(by.css('div[id="field-label4-container"] input[id="label4"]'));
checkLabel4IsDisplayed() {
return Util.waitUntilElementIsVisible(this.numberWidgetLabel4);
}
addIntoNumberWidget(input) {
Util.waitUntilElementIsVisible(this.numberWidgetLabel4);
this.numberWidgetInput.click();
this.numberWidgetInput.sendKeys(input);
return this.numberWidgetInput.sendKeys(protractor.Key.ENTER);
}
removeFromNumberWidget() {
Util.waitUntilElementIsVisible(this.numberWidgetLabel4);
this.numberWidgetInput.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
this.numberWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
}
}

View File

@@ -0,0 +1,71 @@
/*!
* @license
* Copyright 2016 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 Util = require('../../../../util/util');
import FormFields = require('../formFields');
export class AmountWidget {
currency = by.css('span[class="adf-amount-widget__prefix-spacing"]');
formFields = new FormFields();
getAmountFieldLabel(fieldId) {
let label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
Util.waitUntilElementIsVisible(label);
return label.getText();
}
getAmountFieldCurrency(fieldId) {
return this.formFields.getWidget(fieldId).element(this.currency).getText();
}
setFieldValue(fieldId, value) {
return this.formFields.setValueInInputById(fieldId, value);
}
removeFromAmountWidget(fieldId) {
Util.waitUntilElementIsVisible(this.formFields.getWidget(fieldId));
let 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) {
let numberField = element(by.id(fieldId));
Util.waitUntilElementIsVisible(numberField);
return numberField.clear();
}
checkWidgetIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
}
getErrorMessage(fieldId) {
let errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
Util.waitUntilElementIsVisible(errorMessage);
return errorMessage.getText();
}
getPlaceholder(fieldId) {
return this.formFields.getFieldPlaceHolder(fieldId);
}
}

View File

@@ -22,7 +22,7 @@ import Util = require('../../../../util/util');
import remote = require('selenium-webdriver/remote');
import { element, by, browser } from 'protractor';
export class AttachFile {
export class AttachFileWidget {
formFields = new FormFields();
uploadLocator = by.css('button[id="attachfile"]');

View File

@@ -0,0 +1,46 @@
/*!
* @license
* Copyright 2016 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 = require('../formFields');
import Util = require('../../../../util/util');
import { by, element } from 'protractor';
export class CheckboxWidget {
formFields = new FormFields();
checkboxField = element(by.css('span[class*="mat-checkbox-label"]'));
checkboxLabel = element(by.css('span[class*="mat-checkbox-label"]'));
getCheckboxLabel() {
Util.waitUntilElementIsVisible(this.checkboxLabel);
return this.checkboxLabel.getText();
}
clickCheckboxInput(fieldId) {
let checkboxInput = element.all(by.css(`mat-checkbox[id="${fieldId}"] div`)).first();
Util.waitUntilElementIsVisible(checkboxInput);
return checkboxInput.click();
}
isCheckboxDisplayed(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
}
isCheckboxHidden(fieldId) {
return this.formFields.checkWidgetIsHidden(fieldId);
}
}

View File

@@ -18,14 +18,13 @@
import FormFields = require('../formFields');
import { by } from 'protractor';
export class Hyperlink {
export class ContainerWidget {
formFields = new FormFields();
fieldLocator = by.css('div[class="adf-hyperlink-widget "] a');
fileLocator = by.css("div [class*='upload-widget__content-text']");
getFieldText(fieldId) {
return this.formFields.getFieldText(fieldId, this.fieldLocator);
return this.formFields.getFieldText(fieldId, this.fileLocator);
}
}

View File

@@ -0,0 +1,106 @@
/*!
* @license
* Copyright 2016 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 = require('../formFields');
import { element, by, protractor } from 'protractor';
import Util = require('../../../../util/util');
export class DateTimeWidget {
formFields = new FormFields();
outsideLayer = element(by.css('div[class*="cdk-overlay-container"]'));
checkWidgetIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
}
checkLabelIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
}
getDateTimeLabel(fieldId) {
let label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
Util.waitUntilElementIsVisible(label);
return label.getText();
}
setDateTimeInput(fieldId, value) {
return this.formFields.setValueInInputById(fieldId, value);
}
clearDateTimeInput(fieldId) {
let dateInput = element(by.id(fieldId));
Util.waitUntilElementIsVisible(dateInput);
return dateInput.clear();
}
clickOutsideWidget(fieldId) {
let form = this.formFields.getWidget(fieldId);
Util.waitUntilElementIsVisible(form);
return form.click();
}
closeDataTimeWidget() {
Util.waitUntilElementIsVisible(this.outsideLayer);
return this.outsideLayer.click();
}
getErrorMessage(fieldId) {
let errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
Util.waitUntilElementIsVisible(errorMessage);
return errorMessage.getText();
}
selectDay(day) {
let selectedDay = element(by.cssContainingText('div[class*="mat-datetimepicker-calendar-body-cell-content"]', day));
Util.waitUntilElementIsVisible(selectedDay);
return selectedDay.click();
}
openDatepicker(fieldId) {
return element(by.id(fieldId)).click();
}
private selectTime(time) {
let selectedTime = element(by.cssContainingText('div[class*="mat-datetimepicker-clock-cell"]', time));
Util.waitUntilElementIsClickable(selectedTime);
return selectedTime.click();
}
selectHour(hour) {
return this.selectTime(hour);
}
selectMinute(minute) {
return this.selectTime(minute);
}
getPlaceholder(fieldId) {
return this.formFields.getFieldPlaceHolder(fieldId);
}
removeFromDatetimeWidget(fieldId) {
Util.waitUntilElementIsVisible(this.formFields.getWidget(fieldId));
let amountWidgetInput = element(by.id(fieldId));
amountWidgetInput.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
amountWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
}
}

View File

@@ -0,0 +1,61 @@
/*!
* @license
* Copyright 2016 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 = require('../formFields');
import { element, by } from 'protractor';
import Util = require('../../../../util/util');
export class DateWidget {
formFields = new FormFields();
checkWidgetIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
}
checkLabelIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
}
getDateLabel(fieldId) {
let label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
Util.waitUntilElementIsVisible(label);
return label.getText();
}
setDateInput(fieldId, value) {
return this.formFields.setValueInInputById(fieldId, value);
}
clearDateInput(fieldId) {
let dateInput = element(by.id(fieldId));
Util.waitUntilElementIsVisible(dateInput);
return dateInput.clear();
}
clickOutsideWidget(fieldId) {
let form = this.formFields.getWidget(fieldId);
Util.waitUntilElementIsVisible(form);
return form.click();
}
getErrorMessage(fieldId) {
let errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
Util.waitUntilElementIsVisible(errorMessage);
return errorMessage.getText();
}
}

View File

@@ -18,14 +18,22 @@
import FormFields = require('../formFields');
import { by } from 'protractor';
export class MultilineText {
export class DisplayTextWidget {
formFields = new FormFields();
labelLocator = by.css('div[class*="adf-display-text-widget"]');
inputLocator = by.css('input');
valueLocator = by.css('textarea');
getFieldLabel(fieldId) {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}
getFieldValue(fieldId) {
return this.formFields.getFieldValue(fieldId, this.valueLocator);
return this.formFields.getFieldValue(fieldId, this.inputLocator);
}
getFieldText(fieldId) {
return this.formFields.getFieldText(fieldId, this.labelLocator);
}
}

View File

@@ -18,14 +18,18 @@
import FormFields = require('../formFields');
import { by } from 'protractor';
export class DisplayValue {
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);
}
}

View File

@@ -18,14 +18,16 @@
import FormFields = require('../formFields');
import { by } from 'protractor';
export class DisplayText {
export class DocumentWidget {
formFields = new FormFields();
fileLocator = by.css("div [class*='upload-widget__content-text']");
labelLocator = by.css('div[class*="display-text-widget"]');
getFieldLabel(fieldId) {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
getFieldText(fieldId) {
return this.formFields.getFieldText(fieldId, this.fileLocator);
}
getFileName(fieldId) {
return this.formFields.getFieldText(fieldId, this.fileLocator);
}
}

View File

@@ -16,10 +16,10 @@
*/
import FormFields = require('../formFields');
import Util = require('../../../../util/util');
import { by, element } from 'protractor';
import Util = require('../../../../util/util');
export class Dropdown {
export class DropdownWidget {
formFields = new FormFields();

View File

@@ -17,14 +17,18 @@
import FormFields = require('../formFields');
import Util = require('../../../../util/util');
import { element, by, browser, protractor } from 'protractor';
import { by, element, browser, protractor } from 'protractor';
export class DynamicTableWidget {
export class DynamicTable {
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"]'));
@@ -34,6 +38,7 @@ export class DynamicTable {
dateWidget = element.all(by.css('button[aria-label="Open calendar"]')).first();
calendarNumber = element.all(by.css('td div'));
tableRow = element.all(by.css('tbody tr'));
dataTableInput = element(by.id('id'));
getFieldLabel(fieldId) {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
@@ -48,6 +53,49 @@ export class DynamicTable {
return this.addButton.click();
}
clickAddRow() {
Util.waitUntilElementIsVisible(this.addRow);
return this.addRow.click();
}
clickTableRow(rowNumber) {
let tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
Util.waitUntilElementIsVisible(tableRowByIndex);
return tableRowByIndex.click();
}
clickEditButton() {
Util.waitUntilElementIsVisible(this.editButton);
return this.editButton.click();
}
clickCancelButton() {
Util.waitUntilElementIsVisible(this.cancelButton);
return this.cancelButton.click();
}
setDatatableInput(text) {
Util.waitUntilElementIsVisible(this.dataTableInput);
this.dataTableInput.clear();
return this.dataTableInput.sendKeys(text);
}
getTableRowText(rowNumber) {
let tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
Util.waitUntilElementIsVisible(tableRowByIndex);
return tableRowByIndex.getText();
}
checkTableRowIsVisible(rowNumber) {
let tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
return Util.waitUntilElementIsVisible(tableRowByIndex);
}
checkTableRowIsNotVisible(rowNumber) {
let tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
return Util.waitUntilElementIsNotVisible(tableRowByIndex);
}
clickColumnDateTime() {
Util.waitUntilElementIsVisible(this.columnDateTime);
this.columnDateTime.click();

View File

@@ -18,7 +18,7 @@
import FormFields = require('../formFields');
import { by } from 'protractor';
export class Header {
export class HeaderWidget {
formFields = new FormFields();

View File

@@ -16,19 +16,22 @@
*/
import FormFields = require('../formFields');
import { by, element } from 'protractor';
import Util = require('../../../../util/util');
import { by } from 'protractor';
export class RadioButtons {
export class HyperlinkWidget {
formFields = new FormFields();
getSpecificOptionLabel(fieldId, optionNumber) {
let optionLocator = by.css('label[for*="radiobuttons-option_' + optionNumber + '"] div[class*="content"]');
fieldLocator = by.css('div[class="adf-hyperlink-widget "] a');
let option = this.formFields.getWidget(fieldId).element(optionLocator);
Util.waitUntilElementIsVisible(option);
return option.getText();
getFieldText(fieldId) {
return this.formFields.getFieldText(fieldId, this.fieldLocator);
}
getFieldLabel(fieldId) {
let label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
Util.waitUntilElementIsVisible(label);
return label.getText();
}
}

View File

@@ -0,0 +1,48 @@
/*!
* @license
* Copyright 2016 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 = require('../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);
}
}

View File

@@ -0,0 +1,55 @@
/*!
* @license
* Copyright 2016 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 Util = require('../../../../util/util');
import FormFields = require('../formFields');
export class NumberWidget {
formFields = new FormFields();
getNumberFieldLabel(fieldId) {
let label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
Util.waitUntilElementIsVisible(label);
return label.getText();
}
setFieldValue(fieldId, value) {
return this.formFields.setValueInInputById(fieldId, value);
}
clearFieldValue(fieldId) {
let numberField = element(by.id(fieldId));
Util.waitUntilElementIsVisible(numberField);
return numberField.clear();
}
checkWidgetIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
}
getErrorMessage(fieldId) {
let errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
Util.waitUntilElementIsVisible(errorMessage);
return errorMessage.getText();
}
getPlaceholder(fieldId) {
return this.formFields.getFieldPlaceHolder(fieldId);
}
}

View File

@@ -1,40 +0,0 @@
/*!
* @license
* Copyright 2016 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 Util = require('../../../../util/util');
export class People {
peopleField = element(by.css('input[data-automation-id="adf-people-search-input"]'));
firstResult = element(by.id('adf-people-widget-user-0'));
checkPeopleFieldIsDisplayed() {
return Util.waitUntilElementIsVisible(this.peopleField);
}
fillPeopleField(value) {
Util.waitUntilElementIsClickable(this.peopleField);
return this.peopleField.sendKeys(value);
}
selectUserFromDropdown() {
Util.waitUntilElementIsVisible(this.firstResult);
return this.firstResult.click();
}
}

View File

@@ -0,0 +1,83 @@
/*!
* @license
* Copyright 2016 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 = require('../formFields');
import Util = require('../../../../util/util');
import { by, element } from 'protractor';
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"]');
userProfileImage = by.css('div[class*="adf-people-widget-pic"');
userProfileName = by.css('div[class*="adf-people-label-name"');
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 Util.waitUntilElementIsVisible(element(this.peopleDropDownList));
}
checkUserIsListed(userName) {
let user = element(by.cssContainingText('.adf-people-label-name', userName));
return Util.waitUntilElementIsVisible(user);
}
checkUserNotListed(userName) {
let user = element(by.xpath('div[text()="' + userName + '"]'));
return Util.waitUntilElementIsNotVisible(user);
}
selectUserFromDropDown(userName) {
let user = element(by.cssContainingText('.adf-people-label-name', userName));
user.click();
return this;
}
checkPeopleFieldIsDisplayed() {
return Util.waitUntilElementIsVisible(this.peopleField);
}
fillPeopleField(value) {
Util.waitUntilElementIsClickable(this.peopleField);
return this.peopleField.sendKeys(value);
}
selectUserFromDropdown() {
Util.waitUntilElementIsVisible(this.firstResult);
return this.firstResult.click();
}
}

View File

@@ -0,0 +1,55 @@
/*!
* @license
* Copyright 2016 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 = require('../formFields');
import Util = require('../../../../util/util');
import { by, element } from 'protractor';
export class RadioButtonsWidget {
selectedOption = by.css('mat-radio-button[ng-reflect-checked="false"]');
formFields = new FormFields();
getSpecificOptionLabel(fieldId, optionNumber) {
let optionLocator = by.css('label[for*="radiobuttons-option_' + optionNumber + '"] div[class*="content"]');
let option = this.formFields.getWidget(fieldId).element(optionLocator);
Util.waitUntilElementIsVisible(option);
return option.getText();
}
selectOption(fieldId, optionNumber) {
let optionLocator = by.css(`label[for*="${fieldId}-option_${optionNumber}"] div[class*="content"]`);
let option = this.formFields.getWidget(fieldId).element(optionLocator);
Util.waitUntilElementIsVisible(option);
return option.click();
}
isSelectionClean(fieldId) {
let option = this.formFields.getWidget(fieldId).element(this.selectedOption);
return Util.waitUntilElementIsNotVisible(option);
}
getRadioWidgetLabel(fieldId) {
let label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
Util.waitUntilElementIsVisible(label);
return label.getText();
}
}

View File

@@ -0,0 +1,54 @@
/*!
* @license
* Copyright 2016 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 = require('../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);
}
}

View File

@@ -15,57 +15,96 @@
* limitations under the License.
*/
import { MultilineText } from './multilineText';
import { Header } from './header';
import { DisplayText } from './displayText';
import { AttachFile } from './attachFile';
import { DisplayValue } from './displayValue';
import { RadioButtons } from './radioButtons';
import { Hyperlink } from './hyperlink';
import { Dropdown } from './dropdown';
import { DynamicTable } from './dynamicTable';
import { People } from './people';
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 MultilineText();
return new MultilineTextWidget();
}
headerWidget() {
return new Header();
return new HeaderWidget();
}
displayTextWidget() {
return new DisplayText();
return new DisplayTextWidget();
}
attachFileWidget() {
return new AttachFile();
return new AttachFileWidget();
}
displayValueWidget() {
return new DisplayValue();
return new DisplayValueWidget();
}
radioWidget() {
return new RadioButtons();
return new RadioButtonsWidget();
}
hyperlink() {
return new Hyperlink();
return new HyperlinkWidget();
}
dropdown() {
return new Dropdown();
return new DropdownWidget();
}
dynamicTable() {
return new 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 People();
return new PeopleWidget();
}
}