diff --git a/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.html b/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.html
index dfbfe67660..23e7bea30c 100644
--- a/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.html
+++ b/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.html
@@ -1,7 +1,7 @@
-
+
-
+
{
+
+ const loginPage = new LoginPage();
+ const navigationBarPage = new NavigationBarPage();
+ const formCloudDemoPage = new FormCloudDemoPage();
+ const checkboxVisibilityFormJson = JSON.parse(checkboxVisibilityForm);
+ const widget = new Widget();
+
+ let tenantId, user;
+ let visibleCheckbox;
+
+ const widgets = {
+ textOneId: 'textOne',
+ textTwoId: 'textTwo'
+ };
+
+ const value = {
+ displayCheckbox: 'showCheckbox',
+ notDisplayCheckbox: 'anythingElse'
+ };
+
+ const checkbox = {
+ checkboxFieldValue : 'CheckboxFieldValue',
+ checkboxVariableField: 'CheckboxVariableField',
+ checkboxFieldVariable: 'CheckboxFieldVariable',
+ checkboxFieldField: 'CheckboxFieldField',
+ checkboxVariableValue: 'CheckboxVariableValue',
+ checkboxVariableVariable: 'CheckboxVariableVariable'
+ };
+
+ beforeAll(async (done) => {
+ this.alfrescoJsApi = new AlfrescoApi({
+ provider: 'BPM',
+ hostBpm: browser.params.testConfig.adf.url
+ });
+
+ const users = new UsersActions();
+
+ await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
+
+ user = await users.createTenantAndUser(this.alfrescoJsApi);
+
+ tenantId = user.tenantId;
+
+ await this.alfrescoJsApi.login(user.email, user.password);
+
+ await loginPage.loginToProcessServicesUsingUserModel(user);
+
+ navigationBarPage.clickFormCloudButton();
+
+ formCloudDemoPage.setConfigToEditor(checkboxVisibilityFormJson);
+
+ done();
+ });
+
+ afterAll(async (done) => {
+ await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
+ await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
+ done();
+ });
+
+ it('[C309647] Should be able to see Checkbox widget when visibility condition refers to another field with specific value', () => {
+
+ widget.textWidget().isWidgetVisible(widgets.textOneId);
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldValue);
+ widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
+ widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxFieldValue);
+
+ widget.textWidget().setValue(widgets.textOneId, value.notDisplayCheckbox);
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldValue);
+ });
+
+ it('[C309648] Should be able to see Checkbox widget when visibility condition refers to a form variable and a field', () => {
+
+ widget.textWidget().isWidgetVisible(widgets.textOneId);
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxVariableField);
+
+ widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
+ widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxVariableField);
+
+ widget.textWidget().setValue(widgets.textOneId, value.notDisplayCheckbox);
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxVariableField);
+ });
+
+ it('[C309649] Should be able to see Checkbox widget when visibility condition refers to a field and a form variable', () => {
+
+ widget.textWidget().isWidgetVisible(widgets.textOneId);
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldVariable);
+
+ widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
+ expect(widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxFieldVariable)).toBe(true);
+
+ widget.textWidget().setValue(widgets.textOneId, value.notDisplayCheckbox);
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldVariable);
+ });
+
+ it('[C311425] Should be able to see Checkbox widget when visibility condition refers to a field and another field', () => {
+
+ widget.textWidget().isWidgetVisible(widgets.textOneId);
+ widget.textWidget().isWidgetVisible(widgets.textTwoId);
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldField);
+
+ widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldField);
+
+ widget.textWidget().setValue(widgets.textTwoId, value.displayCheckbox);
+ widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxFieldField);
+
+ widget.textWidget().setValue(widgets.textOneId, value.notDisplayCheckbox);
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldField);
+ });
+
+ it('[C311424] Should be able to see Checkbox widget when visibility condition refers to a variable with specific value', () => {
+ formCloudDemoPage.setConfigToEditor(checkboxVisibilityFormJson);
+
+ widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxVariableValue);
+
+ visibleCheckbox = checkboxVisibilityFormJson;
+ visibleCheckbox.formRepresentation.formDefinition.variables[0].value = value.notDisplayCheckbox;
+ formCloudDemoPage.setConfigToEditor(visibleCheckbox);
+
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxVariableValue);
+
+ visibleCheckbox = checkboxVisibilityFormJson;
+ visibleCheckbox.formRepresentation.formDefinition.variables[0].value = value.displayCheckbox;
+ formCloudDemoPage.setConfigToEditor(visibleCheckbox);
+ });
+
+ it('[C311426] Should be able to see Checkbox widget when visibility condition refers to form variable and another form variable', () => {
+ formCloudDemoPage.setConfigToEditor(checkboxVisibilityFormJson);
+
+ widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxVariableVariable);
+
+ visibleCheckbox = checkboxVisibilityFormJson;
+ visibleCheckbox.formRepresentation.formDefinition.variables[0].value = value.notDisplayCheckbox;
+ formCloudDemoPage.setConfigToEditor(visibleCheckbox);
+
+ widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxVariableVariable);
+
+ visibleCheckbox = checkboxVisibilityFormJson;
+ visibleCheckbox.formRepresentation.formDefinition.variables[1].value = value.notDisplayCheckbox;
+ formCloudDemoPage.setConfigToEditor(visibleCheckbox);
+
+ widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxVariableVariable);
+
+ visibleCheckbox = checkboxVisibilityFormJson;
+ visibleCheckbox.formRepresentation.formDefinition.variables[0].value = value.displayCheckbox;
+ visibleCheckbox.formRepresentation.formDefinition.variables[1].value = value.displayCheckbox;
+ formCloudDemoPage.setConfigToEditor(visibleCheckbox);
+ });
+});
diff --git a/e2e/pages/adf/configEditorPage.ts b/e2e/pages/adf/configEditorPage.ts
index 7e4f8c7277..f6738fd142 100644
--- a/e2e/pages/adf/configEditorPage.ts
+++ b/e2e/pages/adf/configEditorPage.ts
@@ -15,25 +15,35 @@
* limitations under the License.
*/
-import { element, by } from 'protractor';
+import { element, by, browser } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class ConfigEditorPage {
+ textField = element(by.css('#adf-form-config-editor div.overflow-guard > textarea'));
+
enterConfiguration(text) {
- const textField = element(by.css('#adf-code-configuration-editor div.overflow-guard > textarea'));
- BrowserVisibility.waitUntilElementIsVisible(textField);
- textField.sendKeys(text);
+
+ BrowserVisibility.waitUntilElementIsVisible(this.textField);
+ this.textField.sendKeys(text);
return this;
}
clickSaveButton() {
- const saveButton = element(by.id('adf-configuration-save'));
+ const saveButton = element(by.id('adf-form-config-save'));
BrowserActions.click(saveButton);
}
clickClearButton() {
- const clearButton = element(by.id('adf-configuration-clear'));
+ BrowserVisibility.waitUntilElementIsVisible(this.textField);
+ const clearButton = element(by.id('adf-form-config-clear'));
BrowserActions.click(clearButton);
}
+
+ enterBulkConfiguration(text) {
+ this.clickClearButton();
+ BrowserVisibility.waitUntilElementIsVisible(this.textField);
+ browser.executeScript('this.monaco.editor.getModels()[0].setValue(`' + JSON.stringify(text) + '`)');
+ this.clickSaveButton();
+ }
}
diff --git a/e2e/pages/adf/demo-shell/process-services-cloud/cloudFormDemoPage.ts b/e2e/pages/adf/demo-shell/process-services-cloud/cloudFormDemoPage.ts
new file mode 100644
index 0000000000..4ea9a77c2f
--- /dev/null
+++ b/e2e/pages/adf/demo-shell/process-services-cloud/cloudFormDemoPage.ts
@@ -0,0 +1,46 @@
+/*!
+ * @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 { ConfigEditorPage } from '../../configEditorPage';
+import { BrowserVisibility } from '@alfresco/adf-testing';
+import { by, element, browser } from 'protractor';
+
+export class FormCloudDemoPage {
+
+ formCloudEditor = element.all(by.css('.mat-tab-list .mat-tab-label')).get(1);
+ formCloudRender = element.all(by.css('.mat-tab-list .mat-tab-label')).get(0);
+
+ configEditorPage = new ConfigEditorPage();
+
+ goToEditor() {
+ BrowserVisibility.waitUntilElementIsVisible(this.formCloudEditor);
+ this.formCloudEditor.click();
+ }
+
+ goToRenderedForm() {
+ BrowserVisibility.waitUntilElementIsVisible(this.formCloudRender);
+ this.formCloudRender.click();
+ }
+
+ setConfigToEditor(text) {
+ this.goToEditor();
+ browser.sleep(2000);
+ this.configEditorPage.enterBulkConfiguration(text);
+ this.goToRenderedForm();
+ browser.sleep(2000);
+ }
+}
diff --git a/e2e/pages/adf/navigationBarPage.ts b/e2e/pages/adf/navigationBarPage.ts
index c6450de776..bd345afea7 100644
--- a/e2e/pages/adf/navigationBarPage.ts
+++ b/e2e/pages/adf/navigationBarPage.ts
@@ -205,6 +205,11 @@ export class NavigationBarPage {
BrowserActions.click(this.formButton);
}
+ clickFormCloudButton() {
+ this.clickMenuButton('Process Cloud');
+ BrowserActions.click(this.formButton);
+ }
+
checkLogoTooltip(logoTooltipTitle) {
const logoTooltip = element(by.css('a[title="' + logoTooltipTitle + '"]'));
BrowserVisibility.waitUntilElementIsVisible(logoTooltip);
diff --git a/e2e/resources/forms/checkbox-visibility-condition.ts b/e2e/resources/forms/checkbox-visibility-condition.ts
new file mode 100644
index 0000000000..91c8cc2f16
--- /dev/null
+++ b/e2e/resources/forms/checkbox-visibility-condition.ts
@@ -0,0 +1,222 @@
+/*!
+ * @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.
+ */
+
+ /* tslint:disable */
+export const checkboxVisibilityForm = `{
+ "formRepresentation": {
+ "id": "form-412cdeab-de90-4099-875f-676366e48fc9",
+ "name": "test",
+ "description": "",
+ "version": 0,
+ "formDefinition": {
+ "tabs": [],
+ "fields": [
+ {
+ "id": "85a4f564-2c70-438a-ae0f-b9c8af4887c2",
+ "name": "Label",
+ "type": "container",
+ "tab": null,
+ "numberOfColumns": 2,
+ "fields": {
+ "1": [
+ {
+ "id": "CheckboxFieldField",
+ "name": "CheckboxFieldField",
+ "type": "boolean",
+ "required": false,
+ "colspan": 1,
+ "visibilityCondition": {
+ "leftFormFieldId": "textOne",
+ "leftRestResponseId": "",
+ "operator": "==",
+ "rightValue": "",
+ "rightType": null,
+ "rightFormFieldId": "textTwo",
+ "rightRestResponseId": "",
+ "nextConditionOperator": ""
+ },
+ "params": {
+ "existingColspan": 1,
+ "maxColspan": 2
+ }
+ },
+ {
+ "id": "CheckboxFieldVariable",
+ "name": "CheckboxFieldVariable",
+ "type": "boolean",
+ "required": false,
+ "colspan": 1,
+ "visibilityCondition": {
+ "leftFormFieldId": "textOne",
+ "leftRestResponseId": "",
+ "operator": "==",
+ "rightValue": "",
+ "rightType": null,
+ "rightFormFieldId": "",
+ "rightRestResponseId": "cbc51284-04c4-462f-ab72-2b9f8b14907b",
+ "nextConditionOperator": ""
+ },
+ "params": {
+ "existingColspan": 1,
+ "maxColspan": 2
+ }
+ },
+ {
+ "id": "CheckboxFieldValue",
+ "name": "CheckboxFieldValue",
+ "type": "boolean",
+ "required": false,
+ "colspan": 1,
+ "visibilityCondition": {
+ "leftFormFieldId": "textOne",
+ "leftRestResponseId": "",
+ "operator": "==",
+ "rightValue": "showCheckbox",
+ "rightType": null,
+ "rightFormFieldId": "",
+ "rightRestResponseId": "",
+ "nextConditionOperator": "",
+ "nextCondition": null
+ },
+ "params": {
+ "existingColspan": 1,
+ "maxColspan": 2
+ }
+ },
+ {
+ "id": "CheckboxVariableValue",
+ "name": "CheckboxVariableValue",
+ "type": "boolean",
+ "required": false,
+ "colspan": 1,
+ "visibilityCondition": {
+ "leftFormFieldId": "",
+ "leftRestResponseId": "cbc51284-04c4-462f-ab72-2b9f8b14907b",
+ "operator": "==",
+ "rightValue": "showCheckbox",
+ "rightType": null,
+ "rightFormFieldId": "",
+ "rightRestResponseId": "",
+ "nextConditionOperator": "",
+ "nextCondition": null
+ },
+ "params": {
+ "existingColspan": 1,
+ "maxColspan": 2
+ }
+ },
+ {
+ "id": "CheckboxVariableVariable",
+ "name": "CheckboxVariableVariable",
+ "type": "boolean",
+ "required": false,
+ "colspan": 1,
+ "visibilityCondition": {
+ "leftFormFieldId": "",
+ "leftRestResponseId": "cbc51284-04c4-462f-ab72-2b9f8b14907b",
+ "operator": "==",
+ "rightValue": "",
+ "rightType": null,
+ "rightFormFieldId": "",
+ "rightRestResponseId": "87df371a-4238-43f8-92e5-ef3f6a19f379",
+ "nextConditionOperator": "",
+ "nextCondition": null
+ },
+ "params": {
+ "existingColspan": 1,
+ "maxColspan": 2
+ }
+ },
+ {
+ "id": "CheckboxVariableField",
+ "name": "CheckboxVariableField",
+ "type": "boolean",
+ "required": false,
+ "colspan": 1,
+ "visibilityCondition": {
+ "leftFormFieldId": "",
+ "leftRestResponseId": "cbc51284-04c4-462f-ab72-2b9f8b14907b",
+ "operator": "==",
+ "rightValue": "",
+ "rightType": null,
+ "rightFormFieldId": "textOne",
+ "rightRestResponseId": "",
+ "nextConditionOperator": "",
+ "nextCondition": null
+ },
+ "params": {
+ "existingColspan": 1,
+ "maxColspan": 2
+ }
+ }
+ ],
+ "2": [
+ {
+ "id": "textOne",
+ "name": "textOne",
+ "type": "text",
+ "required": false,
+ "colspan": 1,
+ "placeholder": null,
+ "minLength": 0,
+ "maxLength": 0,
+ "regexPattern": null,
+ "visibilityCondition": null,
+ "params": {
+ "existingColspan": 1,
+ "maxColspan": 2
+ }
+ },
+ {
+ "id": "textTwo",
+ "name": "textTwo",
+ "type": "text",
+ "required": false,
+ "colspan": 1,
+ "placeholder": null,
+ "minLength": 0,
+ "maxLength": 0,
+ "regexPattern": null,
+ "visibilityCondition": null,
+ "params": {
+ "existingColspan": 1,
+ "maxColspan": 2
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "outcomes": [],
+ "metadata": {},
+ "variables": [
+ {
+ "id": "cbc51284-04c4-462f-ab72-2b9f8b14907b",
+ "name": "varString1",
+ "type": "string",
+ "value": "showCheckbox"
+ },
+ {
+ "id": "87df371a-4238-43f8-92e5-ef3f6a19f379",
+ "name": "varString2",
+ "type": "string",
+ "value": "showCheckbox"
+ }
+ ]
+ }
+ }
+}`;
diff --git a/lib/testing/src/lib/core/pages/form/formFields.ts b/lib/testing/src/lib/core/pages/form/formFields.ts
index c9f70f907a..006b1b78d7 100644
--- a/lib/testing/src/lib/core/pages/form/formFields.ts
+++ b/lib/testing/src/lib/core/pages/form/formFields.ts
@@ -42,7 +42,7 @@ export class FormFields {
checkWidgetIsVisible(fieldId) {
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
- BrowserVisibility.waitUntilElementIsVisible(fieldElement);
+ BrowserVisibility.waitUntilElementIsOnPage(fieldElement);
}
checkWidgetIsHidden(fieldId) {
@@ -50,6 +50,12 @@ export class FormFields {
BrowserVisibility.waitUntilElementIsVisible(hiddenElement);
}
+ checkWidgetIsNotHidden(fieldId) {
+ this.checkWidgetIsVisible(fieldId);
+ const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
+ return BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement, 6000);
+ }
+
getWidget(fieldId) {
const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
BrowserVisibility.waitUntilElementIsVisible(widget);
diff --git a/lib/testing/src/lib/core/pages/form/widgets/checkboxWidget.ts b/lib/testing/src/lib/core/pages/form/widgets/checkboxWidget.ts
index 72260387a1..582412ba9f 100644
--- a/lib/testing/src/lib/core/pages/form/widgets/checkboxWidget.ts
+++ b/lib/testing/src/lib/core/pages/form/widgets/checkboxWidget.ts
@@ -34,7 +34,7 @@ export class CheckboxWidget {
}
isCheckboxDisplayed(fieldId) {
- return this.formFields.checkWidgetIsVisible(fieldId);
+ return this.formFields.checkWidgetIsNotHidden(fieldId);
}
isCheckboxHidden(fieldId) {