diff --git a/e2e/actions/APS/apps.actions.ts b/e2e/actions/APS/apps.actions.ts index d08921460f..c822106df4 100644 --- a/e2e/actions/APS/apps.actions.ts +++ b/e2e/actions/APS/apps.actions.ts @@ -74,7 +74,13 @@ export class AppsActions { let processDefinitionList = await alfrescoJsApi.activiti.processApi.getProcessDefinitions({ deploymentId: appDefinition.deploymentId }); - let startProcessOptions: any = { processDefinitionId: processDefinitionList.data[0].id }; + let chosenProcess = processDefinitionList.data.find( (processDefinition) => { + return processDefinition.name === processName; + }); + + let processDefinitionIdToStart = chosenProcess ? chosenProcess.id : processDefinitionList.data[0].id; + + let startProcessOptions: any = { processDefinitionId: processDefinitionIdToStart }; if (typeof processName !== 'undefined') { startProcessOptions.name = processName; diff --git a/e2e/pages/adf/process_services/formFields.js b/e2e/pages/adf/process_services/formFields.js index a6a2d666cc..e3d52a1a96 100644 --- a/e2e/pages/adf/process_services/formFields.js +++ b/e2e/pages/adf/process_services/formFields.js @@ -30,6 +30,7 @@ var FormFields = function () { var selectFormDropDownArrow = element.all(by.css("adf-attach-form div[class*='mat-select-arrow']")).first(); var selectFormContent = element(by.css("div[class*='mat-select-content']")); var completeButton = element(by.id('adf-form-complete')); + var errorMessage = by.css('.adf-error-text-container .adf-error-text'); this.setFieldValue = function (By, field, value) { var fieldElement = element(By(field)); @@ -38,6 +39,16 @@ var FormFields = function () { return this; }; + this.checkWidgetIsVisible = function (fieldId) { + var fieldElement = element(by.css("adf-form-field div[id='field-"+fieldId+"-container']")); + Util.waitUntilElementIsVisible(fieldElement); + } + + this.checkWidgetIsHidden = function (fieldId) { + var hiddenElement = element(by.css("adf-form-field div[id='field-"+fieldId+"-container'][hidden]")); + Util.waitUntilElementIsVisible(hiddenElement); + } + this.getWidget = function (fieldId) { var widget = element(by.css("adf-form-field div[id='field-" + fieldId + "-container']")); Util.waitUntilElementIsVisible(widget); @@ -51,15 +62,28 @@ var FormFields = function () { }; this.getFieldLabel = function (fieldId, labelLocatorParam) { - return this.getFieldText(fieldId, labelLocatorParam); - }; - - this.getFieldText = function (fieldId, labelLocatorParam) { - var label = this.getWidget(fieldId).all(labelLocatorParam || labelLocator).first(); + var label = this.getWidget(fieldId).element(labelLocatorParam || labelLocator); Util.waitUntilElementIsVisible(label); return label.getText(); }; + this.getFieldErrorMessage = function (fieldId) { + var error = this.getWidget(fieldId).element(errorMessage); + return error.getText(); + } + + this.getFieldText = function (fieldId, labelLocatorParam) { + var label = this.getWidget(fieldId).element(labelLocatorParam || labelLocator); + Util.waitUntilElementIsVisible(label); + return label.getText(); + }; + + this.getFieldPlaceHolder = function (fieldId, locator='input') { + let placeHolderLocator = element(by.css(`${locator}#${fieldId}`)).getAttribute('placeholder'); + Util.waitUntilElementIsVisible(placeHolderLocator); + return placeHolderLocator; + }; + this.checkFieldValue = function (By, field, val) { Util.waitUntilElementHasValue(element(By(field)), val); return this; @@ -129,6 +153,18 @@ var FormFields = function () { Util.waitUntilElementIsVisible(completeButton); return completeButton.click(); }; + + this.setValueInInputById = function(fieldId, value) { + let input = element(by.id(fieldId)); + Util.waitUntilElementIsVisible(input); + input.clear().sendKeys(value); + return this; + } + + this.isCompleteFormButtonDisabled = function() { + Util.waitUntilElementIsVisible(completeButton); + return completeButton.getAttribute('disabled'); + } }; module.exports = FormFields; diff --git a/e2e/pages/adf/process_services/taskDetailsPage.ts b/e2e/pages/adf/process_services/taskDetailsPage.ts index 6ba1128422..ba0f61d889 100644 --- a/e2e/pages/adf/process_services/taskDetailsPage.ts +++ b/e2e/pages/adf/process_services/taskDetailsPage.ts @@ -16,11 +16,13 @@ */ import { AppSettingsToggles } from './dialog/appSettingsToggles'; -import { TabsPage } from '../material/tabsPage'; -import { element, by, browser, protractor } from 'protractor'; import Util = require('../../../util/util'); +import { element, by, protractor, browser } from 'protractor'; +import { TabsPage } from '../material/tabsPage'; export class TaskDetailsPage { + + appSettingsTogglesClass = new AppSettingsToggles(); formContent = element(by.css('adf-form')); formNameField = element(by.css('span[data-automation-id*="formName"] span')); assigneeField = element(by.css('span[data-automation-id*="assignee"] span')); @@ -42,6 +44,7 @@ export class TaskDetailsPage { addInvolvedUserButton = element(by.css('button[id="add-people"] span')); emailInvolvedUser = by.xpath('following-sibling::div[@class="people-email ng-star-inserted"]'); editActionInvolvedUser = by.xpath('following-sibling::div[@class="people-edit-label ng-star-inserted"]'); + involvedUserPic = by.xpath('ancestor::div/ancestor::div/preceding-sibling::div//div[@class="adf-people-search-people-pic ng-star-inserted"]'); taskDetailsInfoDrawer = element(by.tagName('adf-info-drawer')); taskDetailsSection = element(by.css('div[data-automation-id="adf-tasks-details"]')); taskDetailsEmptySection = element(by.css('div[data-automation-id="adf-tasks-details--empty"]')); @@ -307,7 +310,7 @@ export class TaskDetailsPage { } appSettingsToggles() { - return new AppSettingsToggles(); + return this.appSettingsTogglesClass; } taskInfoDrawerIsDisplayed() { @@ -361,6 +364,12 @@ export class TaskDetailsPage { return this.peopleTitle.getText(); } + getInvolvedPeopleInitialImage(user) { + let pic = this.getRowsUser(user).element(this.involvedUserPic); + Util.waitUntilElementIsVisible(pic); + return pic.getText(); + } + checkTaskDetails() { Util.waitUntilElementIsVisible(this.taskDetailsSection); return this.taskDetailsSection.getText(); diff --git a/e2e/pages/adf/process_services/tasksPage.ts b/e2e/pages/adf/process_services/tasksPage.ts index 0cc4c8aa2c..cd46558f9f 100644 --- a/e2e/pages/adf/process_services/tasksPage.ts +++ b/e2e/pages/adf/process_services/tasksPage.ts @@ -23,7 +23,6 @@ import { TaskDetailsPage } from './taskDetailsPage'; import FiltersPage = require('./filtersPage'); import ChecklistDialog = require('./dialog/createChecklistDialog'); import TasksListPage = require('./tasksListPage'); - import { element, by } from 'protractor'; export class TasksPage { diff --git a/e2e/pages/adf/process_services/widgets/Amount.ts b/e2e/pages/adf/process_services/widgets/Amount.ts deleted file mode 100644 index 0ede82684b..0000000000 --- a/e2e/pages/adf/process_services/widgets/Amount.ts +++ /dev/null @@ -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); - } - }); - } -} diff --git a/e2e/pages/adf/process_services/widgets/Date.ts b/e2e/pages/adf/process_services/widgets/Date.ts deleted file mode 100644 index 9afc42c046..0000000000 --- a/e2e/pages/adf/process_services/widgets/Date.ts +++ /dev/null @@ -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); - } - }); - } -} diff --git a/e2e/pages/adf/process_services/widgets/Number.ts b/e2e/pages/adf/process_services/widgets/Number.ts deleted file mode 100644 index 84fe041052..0000000000 --- a/e2e/pages/adf/process_services/widgets/Number.ts +++ /dev/null @@ -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); - } - }); - } -} diff --git a/e2e/pages/adf/process_services/widgets/amountWidget.ts b/e2e/pages/adf/process_services/widgets/amountWidget.ts new file mode 100644 index 0000000000..5c4b3ed748 --- /dev/null +++ b/e2e/pages/adf/process_services/widgets/amountWidget.ts @@ -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); + } +} diff --git a/e2e/pages/adf/process_services/widgets/attachFile.ts b/e2e/pages/adf/process_services/widgets/attachFileWidget.ts similarity index 98% rename from e2e/pages/adf/process_services/widgets/attachFile.ts rename to e2e/pages/adf/process_services/widgets/attachFileWidget.ts index e49da3f53f..704a858842 100644 --- a/e2e/pages/adf/process_services/widgets/attachFile.ts +++ b/e2e/pages/adf/process_services/widgets/attachFileWidget.ts @@ -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"]'); diff --git a/e2e/pages/adf/process_services/widgets/checkboxWidget.ts b/e2e/pages/adf/process_services/widgets/checkboxWidget.ts new file mode 100644 index 0000000000..0e9dab12ff --- /dev/null +++ b/e2e/pages/adf/process_services/widgets/checkboxWidget.ts @@ -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); + } +} diff --git a/e2e/pages/adf/process_services/widgets/hyperlink.ts b/e2e/pages/adf/process_services/widgets/containerWidget.ts similarity index 81% rename from e2e/pages/adf/process_services/widgets/hyperlink.ts rename to e2e/pages/adf/process_services/widgets/containerWidget.ts index f2b73e3f54..be0cd412f7 100644 --- a/e2e/pages/adf/process_services/widgets/hyperlink.ts +++ b/e2e/pages/adf/process_services/widgets/containerWidget.ts @@ -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); } - } diff --git a/e2e/pages/adf/process_services/widgets/dateTimeWidget.ts b/e2e/pages/adf/process_services/widgets/dateTimeWidget.ts new file mode 100644 index 0000000000..060926b6e1 --- /dev/null +++ b/e2e/pages/adf/process_services/widgets/dateTimeWidget.ts @@ -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); + } + }); + } +} diff --git a/e2e/pages/adf/process_services/widgets/dateWidget.ts b/e2e/pages/adf/process_services/widgets/dateWidget.ts new file mode 100644 index 0000000000..421aaab8ce --- /dev/null +++ b/e2e/pages/adf/process_services/widgets/dateWidget.ts @@ -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(); + } +} diff --git a/e2e/pages/adf/process_services/widgets/multilineText.ts b/e2e/pages/adf/process_services/widgets/displayTextWidget.ts similarity index 65% rename from e2e/pages/adf/process_services/widgets/multilineText.ts rename to e2e/pages/adf/process_services/widgets/displayTextWidget.ts index 1a7a21a9ac..76d00cbb97 100644 --- a/e2e/pages/adf/process_services/widgets/multilineText.ts +++ b/e2e/pages/adf/process_services/widgets/displayTextWidget.ts @@ -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); } } diff --git a/e2e/pages/adf/process_services/widgets/displayValue.ts b/e2e/pages/adf/process_services/widgets/displayValueWidget.ts similarity index 83% rename from e2e/pages/adf/process_services/widgets/displayValue.ts rename to e2e/pages/adf/process_services/widgets/displayValueWidget.ts index 833eff2ac6..34416ec98a 100644 --- a/e2e/pages/adf/process_services/widgets/displayValue.ts +++ b/e2e/pages/adf/process_services/widgets/displayValueWidget.ts @@ -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); + } + } diff --git a/e2e/pages/adf/process_services/widgets/displayText.ts b/e2e/pages/adf/process_services/widgets/documentWidget.ts similarity index 70% rename from e2e/pages/adf/process_services/widgets/displayText.ts rename to e2e/pages/adf/process_services/widgets/documentWidget.ts index 2a691050a4..1ebbd57fcc 100644 --- a/e2e/pages/adf/process_services/widgets/displayText.ts +++ b/e2e/pages/adf/process_services/widgets/documentWidget.ts @@ -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); + } } diff --git a/e2e/pages/adf/process_services/widgets/dropdown.ts b/e2e/pages/adf/process_services/widgets/dropdownWidget.ts similarity index 98% rename from e2e/pages/adf/process_services/widgets/dropdown.ts rename to e2e/pages/adf/process_services/widgets/dropdownWidget.ts index 5ca906402a..075d5e28a4 100644 --- a/e2e/pages/adf/process_services/widgets/dropdown.ts +++ b/e2e/pages/adf/process_services/widgets/dropdownWidget.ts @@ -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(); diff --git a/e2e/pages/adf/process_services/widgets/dynamicTable.ts b/e2e/pages/adf/process_services/widgets/dynamicTableWidget.ts similarity index 68% rename from e2e/pages/adf/process_services/widgets/dynamicTable.ts rename to e2e/pages/adf/process_services/widgets/dynamicTableWidget.ts index 0fcb62af00..278964d54d 100644 --- a/e2e/pages/adf/process_services/widgets/dynamicTable.ts +++ b/e2e/pages/adf/process_services/widgets/dynamicTableWidget.ts @@ -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(); diff --git a/e2e/pages/adf/process_services/widgets/header.ts b/e2e/pages/adf/process_services/widgets/headerWidget.ts similarity index 97% rename from e2e/pages/adf/process_services/widgets/header.ts rename to e2e/pages/adf/process_services/widgets/headerWidget.ts index 102092a38d..399f95e1ff 100644 --- a/e2e/pages/adf/process_services/widgets/header.ts +++ b/e2e/pages/adf/process_services/widgets/headerWidget.ts @@ -18,7 +18,7 @@ import FormFields = require('../formFields'); import { by } from 'protractor'; -export class Header { +export class HeaderWidget { formFields = new FormFields(); diff --git a/e2e/pages/adf/process_services/widgets/radioButtons.ts b/e2e/pages/adf/process_services/widgets/hyperlinkWidget.ts similarity index 62% rename from e2e/pages/adf/process_services/widgets/radioButtons.ts rename to e2e/pages/adf/process_services/widgets/hyperlinkWidget.ts index 809a48c134..01c8dbcaf7 100644 --- a/e2e/pages/adf/process_services/widgets/radioButtons.ts +++ b/e2e/pages/adf/process_services/widgets/hyperlinkWidget.ts @@ -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(); + } } diff --git a/e2e/pages/adf/process_services/widgets/multilineTextWidget.ts b/e2e/pages/adf/process_services/widgets/multilineTextWidget.ts new file mode 100644 index 0000000000..dce3386484 --- /dev/null +++ b/e2e/pages/adf/process_services/widgets/multilineTextWidget.ts @@ -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); + } + +} diff --git a/e2e/pages/adf/process_services/widgets/numberWidget.ts b/e2e/pages/adf/process_services/widgets/numberWidget.ts new file mode 100644 index 0000000000..45f68e3122 --- /dev/null +++ b/e2e/pages/adf/process_services/widgets/numberWidget.ts @@ -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); + } +} diff --git a/e2e/pages/adf/process_services/widgets/people.ts b/e2e/pages/adf/process_services/widgets/people.ts deleted file mode 100644 index ff0cd67c03..0000000000 --- a/e2e/pages/adf/process_services/widgets/people.ts +++ /dev/null @@ -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(); - } - -} diff --git a/e2e/pages/adf/process_services/widgets/peopleWidget.ts b/e2e/pages/adf/process_services/widgets/peopleWidget.ts new file mode 100644 index 0000000000..63690d164f --- /dev/null +++ b/e2e/pages/adf/process_services/widgets/peopleWidget.ts @@ -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(); + } +} diff --git a/e2e/pages/adf/process_services/widgets/radioButtonsWidget.ts b/e2e/pages/adf/process_services/widgets/radioButtonsWidget.ts new file mode 100644 index 0000000000..9bc02f7e5c --- /dev/null +++ b/e2e/pages/adf/process_services/widgets/radioButtonsWidget.ts @@ -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(); + } + +} diff --git a/e2e/pages/adf/process_services/widgets/textWidget.ts b/e2e/pages/adf/process_services/widgets/textWidget.ts new file mode 100644 index 0000000000..6bd5c35bb6 --- /dev/null +++ b/e2e/pages/adf/process_services/widgets/textWidget.ts @@ -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); + } +} diff --git a/e2e/pages/adf/process_services/widgets/widget.ts b/e2e/pages/adf/process_services/widgets/widget.ts index 353d4c8bb9..94b85025a4 100644 --- a/e2e/pages/adf/process_services/widgets/widget.ts +++ b/e2e/pages/adf/process_services/widgets/widget.ts @@ -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(); } - } diff --git a/e2e/process-services/dynamic_table_date_picker.e2e.ts b/e2e/process-services/dynamic_table_date_picker.e2e.ts index 7a5d0b2609..0728b57581 100644 --- a/e2e/process-services/dynamic_table_date_picker.e2e.ts +++ b/e2e/process-services/dynamic_table_date_picker.e2e.ts @@ -19,8 +19,8 @@ import { LoginPage } from '../pages/adf/loginPage'; import { ProcessServicesPage } from '../pages/adf/process_services/processServicesPage'; import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage'); import { AppNavigationBarPage } from '../pages/adf/process_services/appNavigationBarPage'; -import { DynamicTable } from '../pages/adf/process_services/widgets/dynamicTable'; -import { Dropdown } from '../pages/adf/process_services/widgets/dropdown'; +import { DynamicTableWidget } from '../pages/adf/process_services/widgets/dynamicTableWidget'; +import { DropdownWidget } from '../pages/adf/process_services/widgets/dropdownWidget'; import TestConfig = require('../test.config'); import resources = require('../util/resources'); @@ -35,7 +35,7 @@ describe('Dynamic Table', () => { let processServicesPage = new ProcessServicesPage(); let processFiltersPage = new ProcessFiltersPage(); let appNavigationBarPage = new AppNavigationBarPage(); - let dynamicTable = new DynamicTable(); + let dynamicTable = new DynamicTableWidget(); let user, tenantId, appId, apps, users; beforeAll(async(done) => { @@ -128,7 +128,7 @@ describe('Dynamic Table', () => { describe('Required Dropdown', () => { let app = resources.Files.APP_DYNAMIC_TABLE_DROPDOWN; - let dropdown = new Dropdown(); + let dropdown = new DropdownWidget(); beforeAll(async(done) => { diff --git a/e2e/process-services/form_component.e2e.ts b/e2e/process-services/form_component.e2e.ts index 24a9452b73..5ca47a861a 100644 --- a/e2e/process-services/form_component.e2e.ts +++ b/e2e/process-services/form_component.e2e.ts @@ -18,9 +18,9 @@ import { LoginPage } from '../pages/adf/loginPage'; import { NavigationBarPage } from '../pages/adf/navigationBarPage'; import { FormPage } from '../pages/adf/process_services/formPage'; -import { Date } from '../pages/adf/process_services/widgets/Date'; -import { Amount } from '../pages/adf/process_services/widgets/Amount'; -import { NumberWidget } from '../pages/adf/process_services/widgets/Number'; +import { DateWidget } from '../pages/adf/process_services/widgets/dateWidget'; +import { AmountWidget } from '../pages/adf/process_services/widgets/amountWidget'; +import { NumberWidget } from '../pages/adf/process_services/widgets/numberWidget'; import TestConfig = require('../test.config'); import AlfrescoApi = require('alfresco-js-api-node'); @@ -31,12 +31,18 @@ describe('Form Component', () => { const loginPage = new LoginPage(); const navigationBarPage = new NavigationBarPage(); const formPage = new FormPage(); - const dateWidget = new Date(); - const amountWidget = new Amount(); + const dateWidget = new DateWidget(); + const amountWidget = new AmountWidget(); const numberWidget = new NumberWidget(); let tenantId, user; + let fields = { + dateWidgetId: 'label7', + numberWidgetId: 'label4', + amountWidgetId: 'label11' + }; + let message = { test: 'Text Test', warningNumberAndAmount: 'Use a different number format', @@ -79,26 +85,27 @@ describe('Form Component', () => { }); it('[C286505] Should be able to display errors under the Error Log section', () => { - numberWidget.checkLabel4IsDisplayed(); - numberWidget.addIntoNumberWidget(message.test); + numberWidget.getNumberFieldLabel(fields.numberWidgetId); + numberWidget.setFieldValue(fields.numberWidgetId, message.test); formPage.checkErrorMessageForWidgetIsDisplayed(message.warningNumberAndAmount); formPage.checkErrorLogMessage(message.errorLogNumber); - dateWidget.checkLabel7IsDisplayed(); - dateWidget.addIntoDateWidget(message.test); + dateWidget.checkLabelIsVisible(fields.dateWidgetId); + dateWidget.setDateInput(fields.dateWidgetId, message.test); + dateWidget.clickOutsideWidget(fields.dateWidgetId); formPage.checkErrorMessageForWidgetIsDisplayed(message.warningDate); formPage.checkErrorLogMessage(message.errorLogDate); - amountWidget.checkLabel11IsDisplayed(); - amountWidget.addIntoAmountWidget(message.test); + amountWidget.getAmountFieldLabel(fields.amountWidgetId); + amountWidget.setFieldValue(fields.amountWidgetId, message.test); formPage.checkErrorMessageForWidgetIsDisplayed(message.warningNumberAndAmount); formPage.checkErrorLogMessage(message.errorLogAmount); - amountWidget.removeFromAmountWidget(); + amountWidget.removeFromAmountWidget(fields.amountWidgetId); formPage.checkErrorMessageIsNotDisplayed(message.errorLogAmount); - dateWidget.removeFromDateWidget(); - numberWidget.removeFromNumberWidget(); + dateWidget.clearDateInput(fields.dateWidgetId); + numberWidget.clearFieldValue(fields.numberWidgetId); formPage.checkErrorMessageForWidgetIsNotDisplayed(message.warningDate); formPage.checkErrorMessageIsNotDisplayed(message.errorLogDate); formPage.checkErrorLogMessage(message.errorLabel); diff --git a/e2e/process-services/form_widgets_component.e2e.ts b/e2e/process-services/form_widgets_component.e2e.ts index 845d435ff9..75b1f5c940 100644 --- a/e2e/process-services/form_widgets_component.e2e.ts +++ b/e2e/process-services/form_widgets_component.e2e.ts @@ -31,181 +31,244 @@ import resources = require('../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); import { AppsActions } from '../actions/APS/apps.actions'; import { UsersActions } from '../actions/users.actions'; +import { browser } from 'protractor'; let formInstance = new FormDefinitionModel(); describe('Form widgets', () => { - + let alfrescoJsApi; + let taskPage = new TasksPage(); + let newTask = 'First task'; let loginPage = new LoginPage(); let processServicesPage = new ProcessServicesPage(); let processUserModel; - let app = resources.Files.WIDGETS_SMOKE_TEST; - let appFields = app.form_fields; - let taskPage = new TasksPage(); let appModel; - let newTask = 'First task'; let widget = new Widget(); - let alfrescoJsApi; - beforeAll(async (done) => { - let users = new UsersActions(); - let appsActions = new AppsActions(); + describe('Form widgets', () => { + let app = resources.Files.WIDGETS_SMOKE_TEST; + let appFields = app.form_fields; - alfrescoJsApi = new AlfrescoApi({ - provider: 'BPM', - hostBpm: TestConfig.adf.url - }); + beforeAll(async (done) => { + let users = new UsersActions(); + let appsActions = new AppsActions(); - await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); - - processUserModel = await users.createTenantAndUser(alfrescoJsApi); - - await alfrescoJsApi.login(processUserModel.email, processUserModel.password); - - appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, app.file_location); - - done(); - }); - - afterAll(async (done) => { - - await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); - - await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); - - done(); - }); - - it('[C272778] Should display text and multi-line in form', () => { - loginPage.loginToProcessServicesUsingUserModel(processUserModel); - processServicesPage.goToProcessServices().goToApp(appModel.name) - .clickTasksButton(); - taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); - taskPage.createNewTask().addName(newTask).addDescription('Description').addForm(app.formName).clickStartButton() - .then(() => { - taskPage.tasksListPage().checkTaskIsDisplayedInTasksList(newTask); - taskPage.formFields().checkFormIsDisplayed(); - expect(taskPage.taskDetails().getTitle()).toEqual('Activities'); - }) - .then(() => { - return alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' })); - }) - .then( (response) => { - return alfrescoJsApi.activiti.taskFormsApi.getTaskForm(response.data[0].id); - }) - .then((formDefinition) => { - formInstance.setFields(formDefinition.fields); - formInstance.setAllWidgets(formDefinition.fields); - return formInstance; - }) - .then(() => { - expect(taskPage.formFields().getFieldLabel(appFields.text_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.text_id).name); - expect(taskPage.formFields().getFieldValue(appFields.text_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.text_id).value || ''); - - expect(widget.multilineTextWidget().getFieldValue(appFields.multiline_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.multiline_id).value || ''); - expect(taskPage.formFields().getFieldLabel(appFields.multiline_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.multiline_id).name); + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url }); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, app.file_location); + + done(); + }); + + afterAll(async (done) => { + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + + done(); + }); + + it('[C272778] Should display text and multi-line in form', () => { + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + processServicesPage.goToProcessServices().goToApp(appModel.name) + .clickTasksButton(); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.createNewTask().addName(newTask).addDescription('Description').addForm(app.formName).clickStartButton() + .then(() => { + taskPage.tasksListPage().checkTaskIsDisplayedInTasksList(newTask); + taskPage.formFields().checkFormIsDisplayed(); + expect(taskPage.taskDetails().getTitle()).toEqual('Activities'); + }) + .then(() => { + return alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' })); + }) + .then((response) => { + return alfrescoJsApi.activiti.taskFormsApi.getTaskForm(response.data[0].id); + }) + .then((formDefinition) => { + formInstance.setFields(formDefinition.fields); + formInstance.setAllWidgets(formDefinition.fields); + return formInstance; + }) + .then(() => { + expect(taskPage.formFields().getFieldLabel(appFields.text_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.text_id).name); + expect(taskPage.formFields().getFieldValue(appFields.text_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.text_id).value || ''); + + expect(widget.multilineTextWidget().getFieldValue(appFields.multiline_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.multiline_id).value || ''); + expect(taskPage.formFields().getFieldLabel(appFields.multiline_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.multiline_id).name); + }); + + }); + + it('[C272779] Should display number and amount in form', () => { + + expect(taskPage.formFields().getFieldValue(appFields.number_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.number_id).value || ''); + expect(taskPage.formFields().getFieldLabel(appFields.number_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.number_id).name); + + expect(taskPage.formFields().getFieldValue(appFields.amount_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.amount_id).value || ''); + expect(taskPage.formFields().getFieldLabel(appFields.amount_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.amount_id).name); + }); + + it('[C272780] Should display attach file and attach folder in form', () => { + + expect(taskPage.formFields().getFieldLabel(appFields.attachFolder_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.attachFolder_id).name); + expect(taskPage.formFields().getFieldLabel(appFields.attachFile_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.attachFile_id).name); + }); + + it('[C272781] Should display date and date & time in form', () => { + + expect(taskPage.formFields().getFieldLabel(appFields.date_id)) + .toContain(formInstance.getWidgetBy('id', appFields.date_id).name); + expect(taskPage.formFields().getFieldValue(appFields.date_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.date_id).value || ''); + + expect(taskPage.formFields().getFieldLabel(appFields.dateTime_id)) + .toContain(formInstance.getWidgetBy('id', appFields.dateTime_id).name); + expect(taskPage.formFields().getFieldValue(appFields.dateTime_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.dateTime_id).value || ''); + }); + + it('[C272782] Should display people and group in form', () => { + + expect(taskPage.formFields().getFieldValue(appFields.people_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.people_id).value || ''); + expect(taskPage.formFields().getFieldLabel(appFields.people_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.people_id).name); + + expect(taskPage.formFields().getFieldValue(appFields.group_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.group_id).value || ''); + expect(taskPage.formFields().getFieldLabel(appFields.group_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.group_id).name); + }); + + it('[C272783] Should display displayText and displayValue in form', () => { + + expect(widget.displayTextWidget().getFieldLabel(appFields.displayText_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.displayText_id).value); + expect(widget.displayValueWidget().getFieldLabel(appFields.displayValue_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.displayValue_id).value || 'Unknown type: readonly'); + }); + + it('[C272784] Should display typeahead and header in form', () => { + expect(widget.headerWidget().getFieldLabel(appFields.header_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.header_id).name); + expect(taskPage.formFields().getFieldValue(appFields.typeAhead_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.typeAhead_id).value || ''); + expect(taskPage.formFields().getFieldLabel(appFields.typeAhead_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.typeAhead_id).name); + }); + + it('[C272785] Should display checkbox and radio button in form', () => { + let radioOption = 1; + + expect(taskPage.formFields().getFieldLabel(appFields.checkbox_id)) + .toContain(formInstance.getWidgetBy('id', appFields.checkbox_id).name); + + expect(taskPage.formFields().getFieldLabel(appFields.radioButtons_id)) + .toContain(formInstance.getWidgetBy('id', appFields.radioButtons_id).name); + expect(widget.radioWidget().getSpecificOptionLabel(appFields.radioButtons_id, radioOption)) + .toContain(formInstance.getWidgetBy('id', appFields.radioButtons_id).options[radioOption - 1].name); + }); + + it('[C268149] Should display hyperlink, dropdown and dynamic table in form', () => { + + expect(widget.hyperlink().getFieldText(appFields.hyperlink_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.hyperlink_id).hyperlinkUrl || ''); + expect(taskPage.formFields().getFieldLabel(appFields.hyperlink_id)) + .toEqual(formInstance.getWidgetBy('id', appFields.hyperlink_id).name); + + expect(taskPage.formFields().getFieldLabel(appFields.dropdown_id)) + .toContain(formInstance.getWidgetBy('id', appFields.dropdown_id).name); + expect(widget.dropdown().getSelectedOptionText(appFields.dropdown_id)) + .toContain(formInstance.getWidgetBy('id', appFields.dropdown_id).value); + + expect(widget.dynamicTable().getFieldLabel(appFields.dynamicTable_id)) + .toContain(formInstance.getWidgetBy('id', appFields.dynamicTable_id).name); + expect(widget.dynamicTable().getColumnName(appFields.dynamicTable_id)) + .toContain(formInstance.getWidgetBy('id', appFields.dynamicTable_id).columnDefinitions[0].name); + }); + }); - it('[C272779] Should display number and amount in form', () => { + describe('with fields involving other people', () => { - expect(taskPage.formFields().getFieldValue(appFields.number_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.number_id).value || ''); - expect(taskPage.formFields().getFieldLabel(appFields.number_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.number_id).name); + let appsActions = new AppsActions(); + let app = resources.Files.FORM_ADF; + let deployedApp, process; + let appFields = app.form_fields; - expect(taskPage.formFields().getFieldValue(appFields.amount_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.amount_id).value || ''); - expect(taskPage.formFields().getFieldLabel(appFields.amount_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.amount_id).name); + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, app.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C260405] Value fields configured with process variables', () => { + taskPage.formFields().checkFormIsDisplayed(); + expect(taskPage.taskDetails().getTitle()).toEqual('Activities'); + + taskPage.formFields().setValueInInputById('label', 'value 1').completeForm(); + /* cspell:disable-next-line */ + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS); + + expect(widget.displayTextWidget().getFieldText(appFields.displayText_id)) + .toContain('value 1'); + expect(widget.textWidget().getFieldValue(appFields.text_id)) + .toEqual('value 1'); + expect(widget.displayValueWidget().getFieldValue(appFields.displayValue_id)) + .toEqual('value 1'); + }); }); - - it('[C272780] Should display attach file and attach folder in form', () => { - - expect(taskPage.formFields().getFieldLabel(appFields.attachFolder_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.attachFolder_id).name); - expect(taskPage.formFields().getFieldLabel(appFields.attachFile_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.attachFile_id).name); - }); - - it('[C272781] Should display date and date & time in form', () => { - - expect(taskPage.formFields().getFieldLabel(appFields.date_id)) - .toContain(formInstance.getWidgetBy('id', appFields.date_id).name); - expect(taskPage.formFields().getFieldValue(appFields.date_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.date_id).value || ''); - - expect(taskPage.formFields().getFieldLabel(appFields.dateTime_id)) - .toContain(formInstance.getWidgetBy('id', appFields.dateTime_id).name); - expect(taskPage.formFields().getFieldValue(appFields.dateTime_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.dateTime_id).value || ''); - }); - - it('[C272782] Should display people and group in form', () => { - - expect(taskPage.formFields().getFieldValue(appFields.people_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.people_id).value || ''); - expect(taskPage.formFields().getFieldLabel(appFields.people_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.people_id).name); - - expect(taskPage.formFields().getFieldValue(appFields.group_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.group_id).value || ''); - expect(taskPage.formFields().getFieldLabel(appFields.group_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.group_id).name); - }); - - it('[C272783] Should display displayText and displayValue in form', () => { - - expect(widget.displayTextWidget().getFieldLabel(appFields.displayText_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.displayText_id).value); - expect(widget.displayValueWidget().getFieldLabel(appFields.displayValue_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.displayValue_id).value || 'Unknown type: readonly'); - }); - - it('[C272784] Should display typeahead and header in form', () => { - - expect(widget.headerWidget().getFieldLabel(appFields.header_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.header_id).name); - - expect(taskPage.formFields().getFieldValue(appFields.typeAhead_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.typeAhead_id).value || ''); - expect(taskPage.formFields().getFieldLabel(appFields.typeAhead_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.typeAhead_id).name); - }); - - it('[C272785] Should display checkbox and radio button in form', () => { - let radioOption = 1; - - expect(taskPage.formFields().getFieldLabel(appFields.checkbox_id)) - .toContain(formInstance.getWidgetBy('id', appFields.checkbox_id).name); - - expect(taskPage.formFields().getFieldLabel(appFields.radioButtons_id)) - .toContain(formInstance.getWidgetBy('id', appFields.radioButtons_id).name); - expect(widget.radioWidget().getSpecificOptionLabel(appFields.radioButtons_id, radioOption)) - .toContain(formInstance.getWidgetBy('id', appFields.radioButtons_id).options[radioOption - 1].name); - }); - - it('[C268149] Should display hyperlink, dropdown and dynamic table in form', () => { - - expect(widget.hyperlink().getFieldText(appFields.hyperlink_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.hyperlink_id).hyperlinkUrl || ''); - expect(taskPage.formFields().getFieldLabel(appFields.hyperlink_id)) - .toEqual(formInstance.getWidgetBy('id', appFields.hyperlink_id).name); - - expect(taskPage.formFields().getFieldLabel(appFields.dropdown_id)) - .toContain(formInstance.getWidgetBy('id', appFields.dropdown_id).name); - expect(widget.dropdown().getSelectedOptionText(appFields.dropdown_id)) - .toContain(formInstance.getWidgetBy('id', appFields.dropdown_id).value); - - expect(widget.dynamicTable().getFieldLabel(appFields.dynamicTable_id)) - .toContain(formInstance.getWidgetBy('id', appFields.dynamicTable_id).name); - expect(widget.dynamicTable().getColumnName(appFields.dynamicTable_id)) - .toContain(formInstance.getWidgetBy('id', appFields.dynamicTable_id).columnDefinitions[0].name); - }); - }); diff --git a/e2e/process-services/widgets/amount_widget.e2e.ts b/e2e/process-services/widgets/amount_widget.e2e.ts new file mode 100644 index 0000000000..add7728588 --- /dev/null +++ b/e2e/process-services/widgets/amount_widget.e2e.ts @@ -0,0 +1,104 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; + +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Amount Widget', () => { + + let loginPage = new LoginPage(); + + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.AMOUNT; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C274703] General, advanced, Amount and Visibility properties', () => { + taskPage.formFields().checkWidgetIsHidden(app.FIELD.amount_input_id); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + taskPage.formFields().checkWidgetIsVisible(app.FIELD.amount_input_id); + + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + expect(widget.amountWidget().getAmountFieldLabel(app.FIELD.amount_input_id)).toContain('Amount'); + expect(widget.amountWidget().getPlaceholder(app.FIELD.amount_input_id)).toContain('Type amount'); + expect(widget.amountWidget().getAmountFieldCurrency(app.FIELD.amount_input_id)).toBe('$'); + + widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 4); + expect(widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe('Can\'t be less than 5'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + widget.amountWidget().clearFieldValue(app.FIELD.amount_input_id); + + widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 101); + expect(widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe('Can\'t be greater than 100'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + widget.amountWidget().clearFieldValue(app.FIELD.amount_input_id); + + widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 6); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); +}); diff --git a/e2e/process-services/widgets/attach_folder_widget.e2e.ts b/e2e/process-services/widgets/attach_folder_widget.e2e.ts new file mode 100644 index 0000000000..a6e2e7871f --- /dev/null +++ b/e2e/process-services/widgets/attach_folder_widget.e2e.ts @@ -0,0 +1,85 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Attach Folder widget', () => { + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.ATTACH_FOLDER; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C276745] Attach folder widget - Visibility', () => { + taskPage.formFields().checkWidgetIsHidden(app.FIELD.upload_button_id); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + taskPage.formFields().checkWidgetIsVisible(app.FIELD.upload_button_id); + + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + }); +}); diff --git a/e2e/process-services/widgets/checkbox_widget.e2e.ts b/e2e/process-services/widgets/checkbox_widget.e2e.ts new file mode 100644 index 0000000000..7583acc9c2 --- /dev/null +++ b/e2e/process-services/widgets/checkbox_widget.e2e.ts @@ -0,0 +1,92 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Checkbox Widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.CHECKBOX; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C268554] Checkbox widget - General settings', () => { + taskPage.formFields().setValueInInputById(app.FIELD.number_input_id, 2); + expect(widget.checkboxWidget().getCheckboxLabel()).toContain(app.FIELD.checkbox_label); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_input_id); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); + + it('[C272812] Checkbox widget - Visibility settings', () => { + widget.checkboxWidget().isCheckboxHidden(app.FIELD.checkbox_field_id); + taskPage.formFields().setValueInInputById(app.FIELD.number_input_id, 2); + widget.checkboxWidget().isCheckboxDisplayed(app.FIELD.checkbox_field_id); + }); +}); diff --git a/e2e/process-services/widgets/date_time_widget.e2e.ts b/e2e/process-services/widgets/date_time_widget.e2e.ts new file mode 100644 index 0000000000..3f20d58bea --- /dev/null +++ b/e2e/process-services/widgets/date_time_widget.e2e.ts @@ -0,0 +1,108 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Date and time widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.DATETIME; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('C268818] Date and time widget - General properties', () => { + expect(widget.dateTimeWidget().getDateTimeLabel(app.FIELD.date_time_input)).toContain('Date'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + + widget.dateTimeWidget().openDatepicker(app.FIELD.date_time_input); + widget.dateTimeWidget().selectDay('10'); + widget.dateTimeWidget().selectHour('8'); + widget.dateTimeWidget().selectMinute('30'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + + expect(widget.dateTimeWidget().getPlaceholder(app.FIELD.date_time_between_input)).toBe('Choose anything...'); + }); + + it('[C268819] Date and time widget - Advanced properties', () => { + widget.dateTimeWidget().openDatepicker(app.FIELD.date_time_between_input); + widget.dateTimeWidget().closeDataTimeWidget(); + widget.dateTimeWidget().setDateTimeInput(app.FIELD.date_time_between_input, '20-03-17 07:30 PM'); + widget.dateTimeWidget().clickOutsideWidget(app.FIELD.date_time_between_input); + expect(widget.dateTimeWidget().getErrorMessage(app.FIELD.date_time_between_input)).toContain('Can\'t be less than'); + + widget.dateTimeWidget().closeDataTimeWidget(); + + widget.dateTimeWidget().clickOutsideWidget(app.FIELD.date_time_between_input); + widget.dateTimeWidget().removeFromDatetimeWidget(app.FIELD.date_time_between_input); + widget.dateTimeWidget().closeDataTimeWidget(); + widget.dateTimeWidget().setDateTimeInput(app.FIELD.date_time_between_input, '20-03-19 07:30 PM'); + widget.dateTimeWidget().clickOutsideWidget(app.FIELD.date_time_between_input); + expect(widget.dateTimeWidget().getErrorMessage(app.FIELD.date_time_between_input)).toContain('Can\'t be greater than'); + }); +}); diff --git a/e2e/process-services/widgets/date_widget.e2e.ts b/e2e/process-services/widgets/date_widget.e2e.ts new file mode 100644 index 0000000000..de739dac58 --- /dev/null +++ b/e2e/process-services/widgets/date_widget.e2e.ts @@ -0,0 +1,96 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Date widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.DATE; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C268814] Date Widget - General Properties', () => { + expect(widget.dateWidget().getDateLabel(app.FIELD.date_input)).toContain('Date'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + widget.dateWidget().setDateInput(app.FIELD.date_input, '20-10-2018'); + widget.dateWidget().clickOutsideWidget(app.FIELD.date_input); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); + + it('[C277234] Date widget - Advanced properties', () => { + widget.dateWidget().setDateInput(app.FIELD.date_between_input, '20-10-2017'); + widget.dateWidget().clickOutsideWidget(app.FIELD.date_between_input); + expect(widget.dateWidget().getErrorMessage(app.FIELD.date_between_input)).toBe('Can\'t be less than 1-10-2018'); + widget.dateWidget().clearDateInput(app.FIELD.date_between_input); + widget.dateWidget().setDateInput(app.FIELD.date_between_input, '20-10-2019'); + widget.dateWidget().clickOutsideWidget(app.FIELD.date_between_input); + expect(widget.dateWidget().getErrorMessage(app.FIELD.date_between_input)).toBe('Can\'t be greater than 31-10-2018'); + }); +}); diff --git a/e2e/process-services/widgets/document_template_widget.e2e.ts b/e2e/process-services/widgets/document_template_widget.e2e.ts new file mode 100644 index 0000000000..50361a77e7 --- /dev/null +++ b/e2e/process-services/widgets/document_template_widget.e2e.ts @@ -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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Document Template widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.FILE_FORM_ADF; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, app.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C260406] should check that the template contains assigned file ', () => { + expect(widget.containerWidget().getFieldText(app.form_fields.container_id)) + .toEqual(app.attached_file); + }); +}); diff --git a/e2e/process-services/widgets/dropdown_widget.e2e.ts b/e2e/process-services/widgets/dropdown_widget.e2e.ts new file mode 100644 index 0000000000..43632fa16b --- /dev/null +++ b/e2e/process-services/widgets/dropdown_widget.e2e.ts @@ -0,0 +1,100 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Dropdown widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.DROPDOWN; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C269051] General and Options properties', () => { + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + + widget.dropdown().selectOption('Happy'); + expect(widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Happy'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + + widget.dropdown().selectOption('Choose one'); + expect(widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Choose one'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + + widget.dropdown().selectOption('Sad'); + expect(widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Sad'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); + + it('[C269052] Dropdown menu - Visibility', () => { + taskPage.formFields().checkWidgetIsHidden(app.FIELD.dropdown_visible); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + taskPage.formFields().checkWidgetIsVisible(app.FIELD.dropdown_visible); + }); +}); diff --git a/e2e/process-services/widgets/dynamic_table_widget.e2e.ts b/e2e/process-services/widgets/dynamic_table_widget.e2e.ts new file mode 100644 index 0000000000..5d94d307f4 --- /dev/null +++ b/e2e/process-services/widgets/dynamic_table_widget.e2e.ts @@ -0,0 +1,167 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Dynamic Table widget ', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let deployedApp, process; + + describe('with date widget', () => { + let app = resources.Files.WIDGET_CHECK_APP.DYNAMIC_TABLE; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C276729] Dynamic table widget - Visiblity', () => { + taskPage.formFields().checkWidgetIsHidden(app.FIELD.dynamic_table_age_id); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + taskPage.formFields().checkWidgetIsVisible(app.FIELD.dynamic_table_age_id); + }); + + it('[C279349] Dynamic table with Datetime', () => { + widget.dynamicTable().clickAddButton(); + widget.dateTimeWidget().openDatepicker(app.FIELD.dataTime_input_id); + widget.dateTimeWidget().selectDay('10'); + widget.dateTimeWidget().selectHour('8'); + widget.dateTimeWidget().selectMinute('30'); + widget.dateTimeWidget().clearDateTimeInput(app.FIELD.dataTime_input_id); + + widget.dynamicTable().clickSaveButton(); + widget.dynamicTable().getTableRow(0); + }); + }); + + describe('with date widget', () => { + + let app = resources.Files.WIDGET_CHECK_APP.DYNAMIC_TABLE_USERS; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C260407] should check Dynamic Table widget', () => { + + widget.dynamicTable().clickAddRow(); + widget.dynamicTable().setDatatableInput('User1'); + widget.dynamicTable().clickSaveButton(); + expect(widget.dynamicTable().getTableRowText(0)).toEqual('User1'); + + widget.dynamicTable().clickTableRow(0); + widget.dynamicTable().clickEditButton(); + widget.dynamicTable().setDatatableInput('User2'); + widget.dynamicTable().clickCancelButton(); + expect(widget.dynamicTable().getTableRowText(0)).toEqual('User1'); + + widget.dynamicTable().clickEditButton(); + widget.dynamicTable().setDatatableInput('User2'); + widget.dynamicTable().clickSaveButton(); + expect(widget.dynamicTable().getTableRowText(0)).toEqual('User2'); + + widget.dynamicTable().clickAddRow(); + widget.dynamicTable().setDatatableInput('User3'); + widget.dynamicTable().clickCancelButton(); + widget.dynamicTable().checkTableRowIsNotVisible(1); + }); + }); + +}); diff --git a/e2e/process-services/widgets/header_widget.e2e.ts b/e2e/process-services/widgets/header_widget.e2e.ts new file mode 100644 index 0000000000..6b5eab7606 --- /dev/null +++ b/e2e/process-services/widgets/header_widget.e2e.ts @@ -0,0 +1,87 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Header widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.HEADER; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C276737] Header widget - general and visibility properties', () => { + taskPage.formFields().checkWidgetIsHidden(app.FIELD.header_id); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + taskPage.formFields().checkWidgetIsVisible(app.FIELD.header_id); + + expect(widget.headerWidget().getFieldLabel(app.FIELD.header_id)).toBe('Header'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); +}); diff --git a/e2e/process-services/widgets/hyperlink_widget.e2e.ts b/e2e/process-services/widgets/hyperlink_widget.e2e.ts new file mode 100644 index 0000000000..82cccb7b5c --- /dev/null +++ b/e2e/process-services/widgets/hyperlink_widget.e2e.ts @@ -0,0 +1,87 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Hyperlink widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.HYPERLINK; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C276728] Hyperlink widget - Visibility', () => { + taskPage.formFields().checkWidgetIsHidden(app.FIELD.hyperlink_id); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + taskPage.formFields().checkWidgetIsVisible(app.FIELD.hyperlink_id); + + expect(widget.hyperlink().getFieldLabel(app.FIELD.hyperlink_id)).toBe('Hyperlink'); + expect(widget.hyperlink().getFieldText(app.FIELD.hyperlink_id)).toBe('https://www.google.com/'); + }); +}); diff --git a/e2e/process-services/widgets/multi_line_widget.e2e.ts b/e2e/process-services/widgets/multi_line_widget.e2e.ts new file mode 100644 index 0000000000..6654973127 --- /dev/null +++ b/e2e/process-services/widgets/multi_line_widget.e2e.ts @@ -0,0 +1,112 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Multi-line Widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.MULTILINE_TEXT; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C268182] Multi-line Text Widget - General Properties', async () => { + let label = widget.multilineTextWidget().getFieldLabel(app.FIELD.multiSimple); + expect(label).toBe('multiSimple*'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + let placeHolder = widget.multilineTextWidget().getFieldPlaceHolder(app.FIELD.multiSimple); + expect(placeHolder).toBe('Type something...'); + widget.multilineTextWidget().setValue(app.FIELD.multiSimple, 'TEST'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); + + it('[C268184] Multi-line Text Widget - Advanced Properties - Min and Max', async () => { + widget.multilineTextWidget().setValue(app.FIELD.multiMinMax, 'A'); + expect(widget.multilineTextWidget().getErrorMessage(app.FIELD.multiMinMax)).toBe('Enter at least 4 characters'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + widget.multilineTextWidget().setValue(app.FIELD.multiMinMax, 'AAAAAAAAAAA'); + expect(widget.multilineTextWidget().getErrorMessage(app.FIELD.multiMinMax)).toBe('Enter no more than 10 characters'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + }); + + it('[C268184] Multi-line Text Widget - Advanced Properties - Regex Pattern property', async () => { + widget.multilineTextWidget().setValue(app.FIELD.multiSimple, 'TEST'); + widget.multilineTextWidget().setValue(app.FIELD.multiRegexp, '3'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + expect(widget.multilineTextWidget().getErrorMessage(app.FIELD.multiRegexp)).toBe('Enter a different value'); + widget.multilineTextWidget().setValue(app.FIELD.multiRegexp, 'TE'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); + + it('[C268232] Multi-line Text Widget - Visibility properties', async () => { + widget.textWidget().isWidgetNotVisible(app.FIELD.multiVisible); + widget.textWidget().setValue(app.FIELD.showMultiHidden, '1'); + widget.textWidget().isWidgetVisible(app.FIELD.multiVisible); + }); +}); diff --git a/e2e/process-services/widgets/number_widget.e2e.ts b/e2e/process-services/widgets/number_widget.e2e.ts new file mode 100644 index 0000000000..2f933da9ba --- /dev/null +++ b/e2e/process-services/widgets/number_widget.e2e.ts @@ -0,0 +1,109 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; + +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Number widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.NUMBER; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C269111] Number Widget - General Properties', () => { + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + expect(widget.numberWidget().getNumberFieldLabel(app.FIELD.number_general)).toContain('Number General'); + expect(widget.numberWidget().getPlaceholder(app.FIELD.number_general)).toContain('Type a number'); + + widget.numberWidget().setFieldValue(app.FIELD.number_general, 2); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); + + it('[C274702] Number Widget - Advanced and visibility properties', () => { + widget.numberWidget().setFieldValue(app.FIELD.number_general, 2); + + taskPage.formFields().checkWidgetIsHidden(app.FIELD.number_visible); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + taskPage.formFields().checkWidgetIsVisible(app.FIELD.number_visible); + + widget.numberWidget().setFieldValue(app.FIELD.number_visible, 2); + expect(widget.numberWidget().getErrorMessage(app.FIELD.number_visible)).toBe('Can\'t be less than 3'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + widget.numberWidget().clearFieldValue(app.FIELD.number_visible); + + widget.numberWidget().setFieldValue(app.FIELD.number_visible, 101); + expect(widget.numberWidget().getErrorMessage(app.FIELD.number_visible)).toBe('Can\'t be greater than 100'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + widget.numberWidget().clearFieldValue(app.FIELD.number_visible); + + widget.numberWidget().setFieldValue(app.FIELD.number_visible, 4); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); +}); diff --git a/e2e/process-services/widgets/people_widget.e2e.ts b/e2e/process-services/widgets/people_widget.e2e.ts new file mode 100644 index 0000000000..1b50acffcc --- /dev/null +++ b/e2e/process-services/widgets/people_widget.e2e.ts @@ -0,0 +1,102 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('People widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.ADD_PEOPLE; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C212870] should check People widget', () => { + taskPage.formFields().checkWidgetIsHidden(app.FIELD.widget_id); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + taskPage.formFields().checkWidgetIsVisible(app.FIELD.widget_id); + + let admin = processUserModel.firstName + ' ' + processUserModel.lastName; + widget.peopleWidget().insertUser(app.FIELD.widget_id, admin.charAt(0)); + widget.peopleWidget().checkDropDownListIsDisplayed(); + widget.peopleWidget().checkUserIsListed(admin); + widget.peopleWidget().selectUserFromDropDown(admin); + }); + + it('[C274707] Add people widget - Visibility', () => { + taskPage.formFields().checkWidgetIsHidden(app.FIELD.widget_id); + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + taskPage.formFields().checkWidgetIsVisible(app.FIELD.widget_id); + + let admin = processUserModel.firstName + ' ' + processUserModel.lastName; + widget.peopleWidget().insertUser(app.FIELD.widget_id, admin.charAt(0)); + widget.peopleWidget().checkDropDownListIsDisplayed(); + widget.peopleWidget().checkUserIsListed(admin); + widget.peopleWidget().selectUserFromDropDown(admin); + }); +}); diff --git a/e2e/process-services/widgets/radio_buttons_widget.e2e.ts b/e2e/process-services/widgets/radio_buttons_widget.e2e.ts new file mode 100644 index 0000000000..51f372b0ab --- /dev/null +++ b/e2e/process-services/widgets/radio_buttons_widget.e2e.ts @@ -0,0 +1,95 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Radio Buttons Widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.RADIO_BUTTONS; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C277316] Radio buttons widget - default behaviour', () => { + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + widget.radioWidget().isSelectionClean(app.FIELD.radio_buttons_id); + }); + + it('[C274704] Radio buttons widget - Visibility', () => { + taskPage.formFields().checkWidgetIsHidden(app.FIELD.radio_buttons_id); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + + widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id); + expect(widget.radioWidget().getRadioWidgetLabel(app.FIELD.radio_buttons_id)).toContain('Radio posts'); + widget.radioWidget().selectOption(app.FIELD.radio_buttons_id, 1); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); +}); diff --git a/e2e/process-services/widgets/text_widget.e2e.ts b/e2e/process-services/widgets/text_widget.e2e.ts new file mode 100644 index 0000000000..02181e44ed --- /dev/null +++ b/e2e/process-services/widgets/text_widget.e2e.ts @@ -0,0 +1,122 @@ +/*! + * @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 AlfrescoApi = require('alfresco-js-api-node'); +import { AppsActions } from '../../actions/APS/apps.actions'; +import { UsersActions } from '../../actions/users.actions'; +import { browser } from 'protractor'; +import { LoginPage } from '../../pages/adf/loginPage'; +import { TasksPage } from '../../pages/adf/process_services/tasksPage'; +import { Widget } from '../../pages/adf/process_services/widgets/widget'; +import CONSTANTS = require('../../util/constants'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); + +describe('Text widget', () => { + + let loginPage = new LoginPage(); + let processUserModel; + let taskPage = new TasksPage(); + let widget = new Widget(); + let alfrescoJsApi; + let appsActions = new AppsActions(); + let appModel; + let app = resources.Files.WIDGET_CHECK_APP.TEXT; + let deployedApp, process; + + beforeAll(async (done) => { + let users = new UsersActions(); + + alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + processUserModel = await users.createTenantAndUser(alfrescoJsApi); + + await alfrescoJsApi.login(processUserModel.email, processUserModel.password); + appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location); + + let appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions(); + deployedApp = appDefinitions.data.find((currentApp) => { + return currentApp.modelId === appModel.id; + }); + process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); + }); + + beforeEach(() => { + let urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`; + browser.get(urlToNavigateTo); + taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS); + taskPage.formFields().checkFormIsDisplayed(); + }); + + afterAll(async (done) => { + await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id); + await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId); + done(); + }); + + it('[C268157] General Properties', async () => { + let label = widget.textWidget().getFieldLabel(app.FIELD.simpleText); + expect(label).toBe('textSimple*'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + let placeHolder = widget.textWidget().getFieldPlaceHolder(app.FIELD.simpleText); + expect(placeHolder).toBe('Type something...'); + widget.textWidget().setValue(app.FIELD.simpleText, 'TEST'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); + + it('[C268170] Min-max length properties', async () => { + widget.textWidget().setValue(app.FIELD.textMinMax, 'A'); + expect(widget.textWidget().getErrorMessage(app.FIELD.textMinMax)).toBe('Enter at least 4 characters'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + widget.textWidget().setValue(app.FIELD.textMinMax, 'AAAAAAAAAAA'); + expect(widget.textWidget().getErrorMessage(app.FIELD.textMinMax)).toBe('Enter no more than 10 characters'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + }); + + it('[C268171] Input mask reversed checkbox properties', async () => { + widget.textWidget().setValue(app.FIELD.textMask, '18951523'); + expect(widget.textWidget().getFieldValue(app.FIELD.textMask)).toBe('1895-1523'); + }); + + it('[C268171] Input mask reversed checkbox properties', async () => { + widget.textWidget().setValue(app.FIELD.textMaskReversed, '1234567899'); + expect(widget.textWidget().getFieldValue(app.FIELD.textMaskReversed)).toBe('3456-7899'); + }); + + it('[C268177] Regex Pattern property', async () => { + widget.textWidget().setValue(app.FIELD.simpleText, 'TEST'); + widget.textWidget().setValue(app.FIELD.textRegexp, 'T'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy(); + expect(widget.textWidget().getErrorMessage(app.FIELD.textRegexp)).toBe('Enter a different value'); + widget.textWidget().setValue(app.FIELD.textRegexp, 'TE'); + expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy(); + }); + + it('[C274712] Visibility condition', async () => { + widget.textWidget().isWidgetNotVisible(app.FIELD.textHidden); + widget.textWidget().setValue(app.FIELD.showHiddenText, '1'); + widget.textWidget().isWidgetVisible(app.FIELD.textHidden); + }); +}); diff --git a/e2e/resources/apps/App_file_form.zip b/e2e/resources/apps/App_file_form.zip new file mode 100644 index 0000000000..a9198a6d52 Binary files /dev/null and b/e2e/resources/apps/App_file_form.zip differ diff --git a/e2e/resources/apps/Test-ADF.zip b/e2e/resources/apps/Test-ADF.zip new file mode 100644 index 0000000000..21750c57db Binary files /dev/null and b/e2e/resources/apps/Test-ADF.zip differ diff --git a/e2e/resources/apps/WidgetApps.zip b/e2e/resources/apps/WidgetApps.zip new file mode 100644 index 0000000000..c187bd2618 Binary files /dev/null and b/e2e/resources/apps/WidgetApps.zip differ diff --git a/e2e/util/resources.js b/e2e/util/resources.js index cc3c718c70..cd72c14763 100644 --- a/e2e/util/resources.js +++ b/e2e/util/resources.js @@ -31,7 +31,7 @@ exports.Files = { process_title: "TestDateField", id: -1, form_fields: { - testdate_field: "activiti-testdate", + testDate_field: "activiti-testdate", completed_task_date_field: "span[ng-if*='field.dateDisplayFormat']" } }, @@ -112,6 +112,207 @@ exports.Files = { } }, + FORM_ADF: { + file_location: "/resources/apps/Test-ADF.zip", + title: "Test App", + formName: "test-1", + form_fields: { + text_id: "label", + displayText_id: "label1", + displayValue_id: "labeldisplayusingvariable" + } + }, + + FILE_FORM_ADF: { + file_location: "/resources/apps/App_file_form.zip", + attached_file: "generatedDocument.docx", + title: "ADF-180-test", + formName: "ADF-180-test", + form_fields: { + container_id: "1504783671016" + } + }, + + WIDGET_CHECK_APP: { + + file_location: "/resources/apps/WidgetApps.zip", + + TEXT: { + formName: "TextWidgetForm", + title: "TextWidgetForm", + processName: "TextWidgetProcess", + FIELD: { + simpleText: "textsimple", + textMinMax: "textminmax", + textMask: "textmask", + textMaskReversed: "textmaskreversed", + textRegexp: "textregexp", + showHiddenText: "showhiddentext", + textHidden: "texthidden" + } + }, + + MULTILINE_TEXT: { + formName: "MultiWidgetProcess", + title: "MultiWidgetProcess", + processName: "MultiWidgetProcess", + FIELD: { + multiSimple: "multisimple", + multiMinMax: "multiminmax", + multiRegexp: "multiregexp", + showMultiHidden: "showmultihidden", + multiVisible: "multivisible" + } + }, + + CHECKBOX: { + formName: "CheckboxVisibilityProcess", + title: "CheckboxVisibilityProcess", + processName: "CheckboxVisibilityProcess", + FIELD: { + number_input_id: "label", + checkbox_field_id: "label1", + checkbox_id: "field-checkbox_input-container", + checkbox_input_id: "label1", + checkbox_label: "Label1" + } + }, + + DATE: { + formName: "DateWidgetProcess", + title: "DateWidgetProcess", + processName: "DateWidgetProcess", + FIELD: { + date_input: "date_standard", + date_between_input: "betweendate" + } + }, + + DATETIME: { + formName: "DateTimeProcess", + title: "DateTimeProcess", + processName: "DateTimeProcess", + FIELD: { + date_time_input: "datetimegeneral", + date_time_between_input: "dateandtimeadvance" + } + }, + + DROPDOWN: { + formName: "DropdownProcess", + title: "DropdownProcess", + processName: "DropdownProcess", + FIELD: { + general_dropdown: "dropdown", + dropdown_visible: "dropdownvisibility", + checkbox_id: "clickcheckbox", + option_0: "empty", + option_1: "option_1", + option_2: "option_2" + } + }, + + NUMBER: { + formName: "NumberProcess", + title: "NumberProcess", + processName: "NumberProcess", + FIELD: { + number_general: "numbergeneral", + number_visible: "number", + checkbox_id: "check" + } + }, + + AMOUNT: { + formName: "AmountProcess", + title: "AmountProcess", + processName: "AmountProcess", + FIELD: { + amount_input_id: "amunt_widget", + checkbox_id: "check" + } + }, + + RADIO_BUTTONS: { + formName: "RadioButtonsWidgetProcess", + title: "RadioButtonsWidgetProcess", + processName: "RadioButtonsWidgetProcess", + FIELD: { + radio_buttons_id: "RockFM", + checkbox_id: "Dollars" + } + }, + + HYPERLINK: { + formName: "HyperlinkProcess", + title: "HyperlinkProcess", + processName: "HyperlinkProcess", + FIELD: { + hyperlink_id: "hyperlink_automation", + checkbox_id: "check" + } + }, + + DYNAMIC_TABLE: { + formName: "DynamicTableProcess", + title: "DynamicTableProcess", + processName: "DynamicTableProcess", + FIELD: { + dynamic_table_age_id: "label2", + dynamic_table_date_id: "label", + checkbox_id: "viewtable", + dataTime_input_id: "datetime", + row: "label-row-0" + + } + }, + + DYNAMIC_TABLE_USERS: { + formName: "ALL_WIDGETS", + title: "ALL_WIDGETS", + processName: "ALL_WIDGETS", + FIELD: { + dynamic_table_age_id: "label2", + dynamic_table_date_id: "label", + checkbox_id: "viewtable", + dataTime_input_id: "datetime", + row: "label-row-0" + + } + }, + + HEADER: { + formName: "HeaderProcess", + title: "HeaderProcess", + processName: "HeaderProcess", + FIELD: { + header_id: "Happy", + checkbox_id: "check" + } + }, + + ATTACH_FOLDER: { + formName: "UploadFolderProcess", + title: "UploadFolderProcess", + processName: "UploadFolderProcess", + FIELD: { + checkbox_id: "check", + upload_button_id: "Upload" + } + }, + + ADD_PEOPLE: { + formName: "AddPeopleProcess", + title: "AddPeopleProcess", + processName: "AddPeopleProcess", + FIELD: { + widget_id: "Finally", + user_id: "adf-people-search-input", + checkbox_id: "check" + } + } + }, + DYNAMIC_TABLE_APP: { file_location: "/resources/apps/Dynamic Table App.zip", title: "Dynamic Table App", diff --git a/lib/core/form/components/widgets/core/form-field-types.ts b/lib/core/form/components/widgets/core/form-field-types.ts index 71e010bbb9..9bbac28a2a 100644 --- a/lib/core/form/components/widgets/core/form-field-types.ts +++ b/lib/core/form/components/widgets/core/form-field-types.ts @@ -38,6 +38,7 @@ export class FormFieldTypes { static AMOUNT: string = 'amount'; static DOCUMENT: string = 'document'; static DATETIME: string = 'datetime'; + static ATTACH_FOLDER: string = 'select-folder'; static READONLY_TYPES: string[] = [ FormFieldTypes.HYPERLINK, diff --git a/lib/core/form/components/widgets/core/form-field-validator.ts b/lib/core/form/components/widgets/core/form-field-validator.ts index ce74cde9b2..ea0db656ae 100644 --- a/lib/core/form/components/widgets/core/form-field-validator.ts +++ b/lib/core/form/components/widgets/core/form-field-validator.ts @@ -44,7 +44,8 @@ export class RequiredFieldValidator implements FormFieldValidator { FormFieldTypes.AMOUNT, FormFieldTypes.DYNAMIC_TABLE, FormFieldTypes.DATE, - FormFieldTypes.DATETIME + FormFieldTypes.DATETIME, + FormFieldTypes.ATTACH_FOLDER ]; isSupported(field: FormFieldModel): boolean {