From f2f08a5bf852410f9a7ea2ab444032e6f826999c Mon Sep 17 00:00:00 2001 From: davidcanonieto Date: Tue, 28 May 2019 15:27:26 +0100 Subject: [PATCH] [ADF-4529] Enable form configuration from e2e tests (#4738) * [ADF-4529] Enable form configuration from e2e tests * Improve linting * Move form methods to new file --- .../form-demo/cloud-form-demo.component.ts | 8 +- .../app-layout/cloud/form-demo/demo-form.ts | 96 - .../components/form/form-loading.component.ts | 8 +- .../src/app/components/form/form.component.ts | 8 +- lib/core/mock/form/demo-form.mock.ts | 1827 +++++++++++++++++ lib/core/services/automation.service.ts | 11 + lib/core/services/public-api.ts | 1 + lib/testing/src/lib/core/utils/form.util.ts | 33 + lib/testing/src/lib/core/utils/public-api.ts | 1 + package.json | 11 +- 10 files changed, 1894 insertions(+), 110 deletions(-) delete mode 100644 demo-shell/src/app/components/app-layout/cloud/form-demo/demo-form.ts create mode 100644 lib/core/mock/form/demo-form.mock.ts create mode 100644 lib/testing/src/lib/core/utils/form.util.ts diff --git a/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.ts b/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.ts index 162ca97369a..e68a054b2e4 100644 --- a/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.ts +++ b/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.ts @@ -16,10 +16,9 @@ */ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { FormFieldModel, NotificationService, FormRenderingService } from '@alfresco/adf-core'; +import { FormFieldModel, NotificationService, FormRenderingService, CoreAutomationService } from '@alfresco/adf-core'; import { FormCloud, FormCloudService, UploadCloudWidgetComponent } from '@alfresco/adf-process-services-cloud'; import { Subscription } from 'rxjs'; -import { formDefinition } from './demo-form'; @Component({ templateUrl: 'cloud-form-demo.component.html', @@ -45,7 +44,8 @@ export class FormCloudDemoComponent implements OnInit, OnDestroy { constructor( private notificationService: NotificationService, private formRenderingService: FormRenderingService, - private formService: FormCloudService) { + private formService: FormCloudService, + private automationService: CoreAutomationService) { this.formRenderingService.setComponentTypeResolver('upload', () => UploadCloudWidgetComponent, true); } @@ -54,7 +54,7 @@ export class FormCloudDemoComponent implements OnInit, OnDestroy { } ngOnInit() { - this.formConfig = formDefinition; + this.formConfig = this.automationService.forms.getFormCloudDefinition(); this.parseForm(); } diff --git a/demo-shell/src/app/components/app-layout/cloud/form-demo/demo-form.ts b/demo-shell/src/app/components/app-layout/cloud/form-demo/demo-form.ts deleted file mode 100644 index 0262f0bc7de..00000000000 --- a/demo-shell/src/app/components/app-layout/cloud/form-demo/demo-form.ts +++ /dev/null @@ -1,96 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const formDefinition = `{ - "formRepresentation": { - "id": "text-form", - "name": "test-start-form", - "version": 0, - "description": "", - "formDefinition": { - "tabs": [], - "fields": [ - { - "id": "1511517333638", - "type": "container", - "fieldType": "ContainerRepresentation", - "name": "Label", - "tab": null, - "numberOfColumns": 2, - "fields": { - "1": [ - { - "fieldType": "FormFieldRepresentation", - "id": "texttest", - "name": "texttest", - "type": "text", - "value": null, - "required": false, - "placeholder": "text", - "params": { - "existingColspan": 2, - "maxColspan": 6, - "inputMaskReversed": true, - "inputMask": "0#", - "inputMaskPlaceholder": "(0-9)" - } - } - ], - "2": [{ - "fieldType": "AttachFileFieldRepresentation", - "id": "attachfiletest", - "name": "attachfiletest", - "type": "upload", - "required": true, - "colspan": 2, - "placeholder": "attachfile", - "params": { - "existingColspan": 2, - "maxColspan": 2, - "fileSource": { - "serviceId": "local-file", - "name": "Local File" - }, - "multiple": true, - "link": false - }, - "visibilityCondition": { - } - }] - } - } - ], - "outcomes": [], - "metadata": { - "property1": "value1", - "property2": "value2" - }, - "variables": [ - { - "name": "variable1", - "type": "string", - "value": "value1" - }, - { - "name": "variable2", - "type": "string", - "value": "value2" - } - ] - } - }} - `; diff --git a/demo-shell/src/app/components/form/form-loading.component.ts b/demo-shell/src/app/components/form/form-loading.component.ts index d14a2ac6ea1..ff9e71ecce8 100644 --- a/demo-shell/src/app/components/form/form-loading.component.ts +++ b/demo-shell/src/app/components/form/form-loading.component.ts @@ -16,9 +16,8 @@ */ import { Component, Inject, OnInit } from '@angular/core'; -import { FormModel, FormService, FormOutcomeEvent } from '@alfresco/adf-core'; +import { FormModel, FormService, FormOutcomeEvent, CoreAutomationService } from '@alfresco/adf-core'; import { InMemoryFormService } from '../../services/in-memory-form.service'; -import { DemoForm } from './demo-form'; import { FakeFormService } from './fake-form.service'; @Component({ @@ -37,7 +36,8 @@ export class FormLoadingComponent implements OnInit { radioButtonFieldValue = ''; formattedData = {}; - constructor(@Inject(FormService) private formService: InMemoryFormService) { + constructor(@Inject(FormService) private formService: InMemoryFormService, + private automationService: CoreAutomationService) { formService.executeOutcome.subscribe((formOutcomeEvent: FormOutcomeEvent) => { formOutcomeEvent.preventDefault(); }); @@ -45,7 +45,7 @@ export class FormLoadingComponent implements OnInit { ngOnInit() { this.formattedData = {}; - const formDefinitionJSON: any = DemoForm.getSimpleFormDefinition(); + const formDefinitionJSON: any = this.automationService.forms.getSimpleFormDefinition(); this.form = this.formService.parseForm(formDefinitionJSON); } diff --git a/demo-shell/src/app/components/form/form.component.ts b/demo-shell/src/app/components/form/form.component.ts index 91335db20b9..e8a459aedc0 100644 --- a/demo-shell/src/app/components/form/form.component.ts +++ b/demo-shell/src/app/components/form/form.component.ts @@ -16,9 +16,8 @@ */ import { Component, Inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; -import { FormModel, FormFieldModel, FormService, FormOutcomeEvent, NotificationService } from '@alfresco/adf-core'; +import { FormModel, FormFieldModel, FormService, FormOutcomeEvent, NotificationService, CoreAutomationService } from '@alfresco/adf-core'; import { InMemoryFormService } from '../../services/in-memory-form.service'; -import { DemoForm } from './demo-form'; import { Subscription } from 'rxjs'; @Component({ @@ -48,7 +47,8 @@ export class FormComponent implements OnInit, OnDestroy { }; constructor(@Inject(FormService) private formService: InMemoryFormService, - private notificationService: NotificationService) { + private notificationService: NotificationService, + private automationService: CoreAutomationService) { this.subscriptions.push( formService.executeOutcome.subscribe((formOutcomeEvent: FormOutcomeEvent) => { @@ -62,7 +62,7 @@ export class FormComponent implements OnInit, OnDestroy { } ngOnInit() { - const formDefinitionJSON: any = DemoForm.getDefinition(); + const formDefinitionJSON: any = this.automationService.forms.getFormDefinition(); this.formConfig = JSON.stringify(formDefinitionJSON); this.parseForm(); } diff --git a/lib/core/mock/form/demo-form.mock.ts b/lib/core/mock/form/demo-form.mock.ts new file mode 100644 index 00000000000..e5ec2ae5797 --- /dev/null +++ b/lib/core/mock/form/demo-form.mock.ts @@ -0,0 +1,1827 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! +* @license +* Copyright 2019 Alfresco Software, Ltd. +* +* Licensed under the Apache License, Version 2.0 (the 'License'); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an 'AS IS' BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +export class DemoForms { + + easyForm = { + 'id': 1001, + 'name': 'ISSUE_FORM', + 'tabs': [], + 'fields': [ + { + 'fieldType': 'ContainerRepresentation', + 'id': '1498212398417', + 'name': 'Label', + 'type': 'container', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': false, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'dateDisplayFormat': null, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'label', + 'name': 'Label', + 'type': 'dropdown', + 'value': 'Choose one...', + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': true, + 'options': [ + { + 'id': 'empty', + 'name': 'Choose one...' + }, + { + 'id': 'option_1', + 'name': 'test1' + }, + { + 'id': 'option_2', + 'name': 'test2' + }, + { + 'id': 'option_3', + 'name': 'test3' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'Date', + 'name': 'Date', + 'type': 'date', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label5', + 'name': 'Label5', + 'type': 'boolean', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label6', + 'name': 'Label6', + 'type': 'boolean', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label4', + 'name': 'Label4', + 'type': 'integer', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'label12', + 'name': 'Label12', + 'type': 'radio-buttons', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': [ + { + 'id': 'option_1', + 'name': 'Option 1' + }, + { + 'id': 'option_2', + 'name': 'Option 2' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ] + } + } + ], + 'outcomes': [], + 'javascriptEvents': [], + 'className': '', + 'style': '', + 'customFieldTemplates': {}, + 'metadata': {}, + 'variables': [], + 'customFieldsValueInfo': {}, + 'gridsterForm': false, + 'globalDateFormat': 'D-M-YYYY' + }; + + formDefinition = { + 'id': 3003, + 'name': 'demo-01', + 'taskId': '7501', + 'taskName': 'Demo Form 01', + 'tabs': [ + { + 'id': 'tab1', + 'title': 'Text', + 'visibilityCondition': null + }, + { + 'id': 'tab2', + 'title': 'Misc', + 'visibilityCondition': null + } + ], + 'fields': [ + { + 'fieldType': 'ContainerRepresentation', + 'id': '1488274019966', + 'name': 'Label', + 'type': 'container', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'dateDisplayFormat': null, + 'layout': null, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [], + '2': [] + } + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': 'section4', + 'name': 'Section 4', + 'type': 'group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label8', + 'name': 'Label8', + 'type': 'people', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label13', + 'name': 'Label13', + 'type': 'functional-group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label18', + 'name': 'Label18', + 'type': 'readonly', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label19', + 'name': 'Label19', + 'type': 'readonly-text', + 'value': 'Display text as part of the form', + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ], + '2': [ + { + 'fieldType': 'HyperlinkRepresentation', + 'id': 'label15', + 'name': 'Label15', + 'type': 'hyperlink', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'hyperlinkUrl': 'www.google.com', + 'displayText': null + }, + { + 'fieldType': 'AttachFileFieldRepresentation', + 'id': 'label16', + 'name': 'Label16', + 'type': 'upload', + 'value': [], + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1, + 'fileSource': { + 'serviceId': 'all-file-sources', + 'name': 'All file sources' + } + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'metaDataColumnDefinitions': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label17', + 'name': 'Label17', + 'type': 'select-folder', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1, + 'folderSource': { + 'serviceId': 'alfresco-1', + 'name': 'Alfresco 5.2 Local', + 'metaDataAllowed': true + } + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ] + } + }, + { + 'fieldType': 'DynamicTableRepresentation', + 'id': 'label14', + 'name': 'Label14', + 'type': 'dynamic-table', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 2, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'columnDefinitions': [ + { + 'id': 'id', + 'name': 'id', + 'type': 'String', + 'value': null, + 'optionType': null, + 'options': null, + 'restResponsePath': null, + 'restUrl': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'amountCurrency': null, + 'amountEnableFractions': false, + 'required': true, + 'editable': true, + 'sortable': true, + 'visible': true, + 'endpoint': null, + 'requestHeaders': null + }, + { + 'id': 'name', + 'name': 'name', + 'type': 'String', + 'value': null, + 'optionType': null, + 'options': null, + 'restResponsePath': null, + 'restUrl': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'amountCurrency': null, + 'amountEnableFractions': false, + 'required': true, + 'editable': true, + 'sortable': true, + 'visible': true, + 'endpoint': null, + 'requestHeaders': null + } + ] + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': 'section1', + 'name': 'Section 1', + 'type': 'group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label1', + 'name': 'Label1', + 'type': 'text', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label3', + 'name': 'Label3', + 'type': 'text', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ], + '2': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label2', + 'name': 'Label2', + 'type': 'multi-line-text', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 2, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ] + } + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': 'section2', + 'name': 'Section 2', + 'type': 'group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label4', + 'name': 'Label4', + 'type': 'integer', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label7', + 'name': 'Label7', + 'type': 'date', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ], + '2': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label5', + 'name': 'Label5', + 'type': 'boolean', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label6', + 'name': 'Label6', + 'type': 'boolean', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'AmountFieldRepresentation', + 'id': 'label11', + 'name': 'Label11', + 'type': 'amount', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': '10', + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'enableFractions': false, + 'currency': null + } + ] + } + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': 'section3', + 'name': 'Section 3', + 'type': 'group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'label9', + 'name': 'Label9', + 'type': 'dropdown', + 'value': 'Choose one...', + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': true, + 'options': [ + { + 'id': 'empty', + 'name': 'Choose one...' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + }, + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'label12', + 'name': 'Label12', + 'type': 'radio-buttons', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': [ + { + 'id': 'option_1', + 'name': 'Option 1' + }, + { + 'id': 'option_2', + 'name': 'Option 2' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ], + '2': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'label10', + 'name': 'Label10', + 'type': 'typeahead', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ] + } + } + ], + 'outcomes': [], + 'javascriptEvents': [], + 'className': '', + 'style': '', + 'customFieldTemplates': {}, + 'metadata': {}, + 'variables': [], + 'gridsterForm': false, + 'globalDateFormat': 'D-M-YYYY' + }; + + simpleFormDefinition = { + 'id': 1001, + 'name': 'SIMPLE_FORM_EXAMPLE', + 'description': '', + 'version': 1, + 'lastUpdatedBy': 2, + 'lastUpdatedByFullName': 'Test01 01Test', + 'lastUpdated': '2018-02-26T17:44:04.543+0000', + 'stencilSetId': 0, + 'referenceId': null, + 'taskId': '9999', + 'formDefinition': { + 'tabs': [], + 'fields': [ + { + 'fieldType': 'ContainerRepresentation', + 'id': '1519666726245', + 'name': 'Label', + 'type': 'container', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'dateDisplayFormat': null, + 'layout': null, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'typeaheadField', + 'name': 'TypeaheadField', + 'type': 'typeahead', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': 'https://jsonplaceholder.typicode.com/users', + 'restResponsePath': null, + 'restIdProperty': 'id', + 'restLabelProperty': 'name', + 'tab': null, + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ], + '2': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'radioButton', + 'name': 'RadioButtons', + 'type': 'radio-buttons', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': [ + { + 'id': 'option_1', + 'name': 'Option 1' + }, + { + 'id': 'option_2', + 'name': 'Option 2' + }, + { + 'id': 'option_3', + 'name': 'Option 3' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 2, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ] + } + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': '1519666735185', + 'name': 'Label', + 'type': 'container', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'dateDisplayFormat': null, + 'layout': null, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'selectBox', + 'name': 'SelectBox', + 'type': 'dropdown', + 'value': 'Choose one...', + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': 'manual', + 'hasEmptyValue': true, + 'options': [ + { + 'id': 'empty', + 'name': 'Choose one...' + }, + { + 'id': 'option_1', + 'name': '1' + }, + { + 'id': 'option_2', + 'name': '2' + }, + { + 'id': 'option_3', + 'name': '3' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ], + '2': [] + } + } + ], + 'outcomes': [], + 'javascriptEvents': [], + 'className': '', + 'style': '', + 'customFieldTemplates': {}, + 'metadata': {}, + 'variables': [], + 'customFieldsValueInfo': {}, + 'gridsterForm': false + } + }; + + cloudFormDefinition = { + 'formRepresentation': { + 'id': 'text-form', + 'name': 'test-start-form', + 'version': 0, + 'description': '', + 'formDefinition': { + 'tabs': [], + 'fields': [ + { + 'id': '1511517333638', + 'type': 'container', + 'fieldType': 'ContainerRepresentation', + 'name': 'Label', + 'tab': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'texttest', + 'name': 'texttest', + 'type': 'text', + 'value': null, + 'required': false, + 'placeholder': 'text', + 'params': { + 'existingColspan': 2, + 'maxColspan': 6, + 'inputMaskReversed': true, + 'inputMask': '0#', + 'inputMaskPlaceholder': '(0-9)' + } + } + ], + '2': [{ + 'fieldType': 'AttachFileFieldRepresentation', + 'id': 'attachfiletest', + 'name': 'attachfiletest', + 'type': 'upload', + 'required': true, + 'colspan': 2, + 'placeholder': 'attachfile', + 'params': { + 'existingColspan': 2, + 'maxColspan': 2, + 'fileSource': { + 'serviceId': 'local-file', + 'name': 'Local File' + }, + 'multiple': true, + 'link': false + }, + 'visibilityCondition': { + } + }] + } + } + ], + 'outcomes': [], + 'metadata': { + 'property1': 'value1', + 'property2': 'value2' + }, + 'variables': [ + { + 'name': 'variable1', + 'type': 'string', + 'value': 'value1' + }, + { + 'name': 'variable2', + 'type': 'string', + 'value': 'value2' + } + ] + } + } + }; + + getEasyForm(): any { + return this.easyForm; + } + + getFormDefinition(): any { + return this.formDefinition; + } + + getSimpleFormDefinition(): any { + return this.simpleFormDefinition; + } + + getFormCloudDefinition(): any { + return this.cloudFormDefinition; + } + +} diff --git a/lib/core/services/automation.service.ts b/lib/core/services/automation.service.ts index e5dbe8bf476..ca9b51ccdb2 100644 --- a/lib/core/services/automation.service.ts +++ b/lib/core/services/automation.service.ts @@ -20,11 +20,14 @@ import { AppConfigService } from '../app-config/app-config.service'; import { AlfrescoApiService } from '../services/alfresco-api.service'; import { StorageService } from './storage.service'; import { UserPreferencesService } from './user-preferences.service'; +import { DemoForms } from '../mock/form/demo-form.mock'; @Injectable({ providedIn: 'root' }) export class CoreAutomationService { + forms = new DemoForms(); + constructor(private appConfigService: AppConfigService, private alfrescoApiService: AlfrescoApiService, private userPreferencesService: UserPreferencesService, @@ -46,6 +49,14 @@ export class CoreAutomationService { this.userPreferencesService.set(key, data); }; + adfProxy.setFormInEditor = (json: string) => { + this.forms.formDefinition = JSON.parse(json); + }; + + adfProxy.setCloudFormInEditor = (json: string) => { + this.forms.cloudFormDefinition = JSON.parse(json); + }; + adfProxy.clearStorage = () => { this.storageService.clear(); }; diff --git a/lib/core/services/public-api.ts b/lib/core/services/public-api.ts index f9bf8160794..462642fb8fb 100644 --- a/lib/core/services/public-api.ts +++ b/lib/core/services/public-api.ts @@ -56,3 +56,4 @@ export * from './download-zip.service'; export * from './lock.service'; export * from './automation.service'; export * from './previous-route.service'; +export * from './automation.service'; diff --git a/lib/testing/src/lib/core/utils/form.util.ts b/lib/testing/src/lib/core/utils/form.util.ts new file mode 100644 index 00000000000..cea4f5df0c6 --- /dev/null +++ b/lib/testing/src/lib/core/utils/form.util.ts @@ -0,0 +1,33 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { browser } from 'protractor'; + +export class FormUtil { + + static async setForm(value: string) { + await browser.executeScript( + 'window.adf.setFormInEditor(`' + value + '`);' + ); + } + + static async setCloudForm(value: string) { + await browser.executeScript( + 'window.adf.setCloudFormInEditor(`' + value + '`);' + ); + } +} diff --git a/lib/testing/src/lib/core/utils/public-api.ts b/lib/testing/src/lib/core/utils/public-api.ts index 05c6d30159a..e1c6934afa8 100644 --- a/lib/testing/src/lib/core/utils/public-api.ts +++ b/lib/testing/src/lib/core/utils/public-api.ts @@ -21,3 +21,4 @@ export * from './string.util'; export * from './protractor.util'; export * from './local-storage.util'; export * from './file-browser.util'; +export * from './form.util'; diff --git a/package.json b/package.json index 7f295a0292d..dad186e3c89 100644 --- a/package.json +++ b/package.json @@ -46,10 +46,12 @@ "e2e": "./scripts/test-e2e-lib.sh -host 'localhost:4200' -dev --folder demo-shell", "e2e-lib": "ng e2e lib-e2e-test --port=4200", "lite-server-e2e": "lite-server --baseDir='demo-shell/dist/' -c ./e2e/lite-server-proxy.js", + "replace-cloud-config": "node appConfigReplace.cloud.js", "06": "echo -------------------------------------------- Clean -----------------------------------------------", "06s": "", "clean": "rimraf dist ./node_modules typings", - "clean-lock": "rimraf package-lock.json" + "clean-lock": "rimraf package-lock.json", + "lint:staged": "lint-staged" }, "repository": { "type": "git", @@ -100,6 +102,7 @@ "core-js": "^2.5.4", "custom-event-polyfill": "0.3.0", "hammerjs": "2.0.8", + "lint-staged": "^8.1.7", "minimatch-browser": "1.0.0", "moment": "2.22.2", "moment-es6": "^1.0.0", @@ -230,9 +233,13 @@ }, "module": "./index.js", "typings": "./index.d.ts", + "lint-staged": { + "*.ts": "npm run lint-lib -- --fix", + "*.scss": "npm run stylelint --syntax scss" + }, "husky": { "hooks": { - "pre-commit": "npm run lint-lib -- --fix && npm run stylelint -- --fix" + "pre-commit": "npm run lint:staged" } } }