mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-1764] Fix testing methods checking visibility of widgets (#5457)
* [AAE-1764] Fix testing methods checking visibility of widgets * [AAE-1764] Fix e2e failing because of method refactoring * [AAE-1764] Fix widget visibility e2e
This commit is contained in:
@@ -21,7 +21,7 @@ import { browser } from 'protractor';
|
|||||||
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||||
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
|
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
|
||||||
import { checkboxVisibilityFormJson, multipleCheckboxVisibilityFormJson } from '../../resources/forms/checkbox-visibility-condition';
|
import { checkboxVisibilityFormJson, multipleCheckboxVisibilityFormJson } from '../../resources/forms/checkbox-visibility-condition';
|
||||||
import { multipleVisibilityFormJson } from '../../resources/forms/multiple-visibility-conditions';
|
import { multipleTextVisibilityFormJson, multipleVisibilityFormJson } from '../../resources/forms/multiple-visibility-conditions';
|
||||||
import { displayValueTextJson } from '../../resources/forms/displayValue-visibilityConditions';
|
import { displayValueTextJson } from '../../resources/forms/displayValue-visibilityConditions';
|
||||||
|
|
||||||
describe('Visibility conditions - cloud', () => {
|
describe('Visibility conditions - cloud', () => {
|
||||||
@@ -203,7 +203,7 @@ describe('Visibility conditions - cloud', () => {
|
|||||||
|
|
||||||
await expect(text1).toEqual('aaa');
|
await expect(text1).toEqual('aaa');
|
||||||
await expect(text2).toEqual('');
|
await expect(text2).toEqual('');
|
||||||
await widget.textWidget().isWidgetVisible(widgets.checkboxBasicVariable);
|
await widget.checkboxWidget().isCheckboxDisplayed(widgets.checkboxBasicVariable);
|
||||||
|
|
||||||
await widget.textWidget().setValue(widgets.textOneId, 'bbb');
|
await widget.textWidget().setValue(widgets.textOneId, 'bbb');
|
||||||
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
|
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
|
||||||
@@ -211,7 +211,7 @@ describe('Visibility conditions - cloud', () => {
|
|||||||
|
|
||||||
await expect(text1).toEqual('bbb');
|
await expect(text1).toEqual('bbb');
|
||||||
await expect(text2).toEqual('');
|
await expect(text2).toEqual('');
|
||||||
await widget.textWidget().isWidgetVisible(widgets.checkboxBasicField);
|
await widget.checkboxWidget().isCheckboxHidden(widgets.checkboxBasicField);
|
||||||
|
|
||||||
await widget.textWidget().setValue(widgets.textTwoId, 'aaa');
|
await widget.textWidget().setValue(widgets.textTwoId, 'aaa');
|
||||||
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
|
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
|
||||||
@@ -219,7 +219,7 @@ describe('Visibility conditions - cloud', () => {
|
|||||||
|
|
||||||
await expect(text1).toEqual('bbb');
|
await expect(text1).toEqual('bbb');
|
||||||
await expect(text2).toEqual('aaa');
|
await expect(text2).toEqual('aaa');
|
||||||
await widget.textWidget().isWidgetNotVisible(widgets.checkboxBasicField);
|
await widget.checkboxWidget().isCheckboxHidden(widgets.checkboxBasicField);
|
||||||
|
|
||||||
await widget.textWidget().setValue(widgets.textOneId, 'aaa');
|
await widget.textWidget().setValue(widgets.textOneId, 'aaa');
|
||||||
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
|
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
|
||||||
@@ -227,11 +227,20 @@ describe('Visibility conditions - cloud', () => {
|
|||||||
|
|
||||||
await expect(text1).toEqual('aaa');
|
await expect(text1).toEqual('aaa');
|
||||||
await expect(text2).toEqual('aaa');
|
await expect(text2).toEqual('aaa');
|
||||||
await widget.textWidget().isWidgetNotVisible(widgets.checkboxBasicField);
|
await widget.checkboxWidget().isCheckboxHidden(widgets.checkboxBasicField);
|
||||||
|
|
||||||
|
await widget.textWidget().setValue(widgets.textTwoId, 'bbb');
|
||||||
|
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
|
||||||
|
text2 = await widget.textWidget().getFieldValue(widgets.textTwoId);
|
||||||
|
|
||||||
|
await expect(text1).toEqual('aaa');
|
||||||
|
await expect(text2).toEqual('bbb');
|
||||||
|
|
||||||
|
await widget.checkboxWidget().isCheckboxDisplayed(widgets.checkboxBasicField);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C312443] Should be able to see Checkbox widget when has multiple visibility conditions and OR NOT next condition operators', async () => {
|
it('[C312443] Should be able to see text widget when has multiple visibility conditions and OR NOT next condition operators', async () => {
|
||||||
await formCloudDemoPage.setConfigToEditor(multipleVisibilityFormJson);
|
await formCloudDemoPage.setConfigToEditor(multipleTextVisibilityFormJson);
|
||||||
|
|
||||||
await widget.textWidget().setValue(widgets.textTwoId, 'test');
|
await widget.textWidget().setValue(widgets.textTwoId, 'test');
|
||||||
await widget.textWidget().setValue(widgets.textThreeId, 'test');
|
await widget.textWidget().setValue(widgets.textThreeId, 'test');
|
||||||
|
@@ -128,7 +128,7 @@ describe('Process-Services - Visibility conditions', () => {
|
|||||||
it('[C311425] Should be able to see Checkbox widget when visibility condition refers to a field and another field', async () => {
|
it('[C311425] Should be able to see Checkbox widget when visibility condition refers to a field and another field', async () => {
|
||||||
|
|
||||||
await widget.textWidget().isWidgetVisible(widgets.textOneId);
|
await widget.textWidget().isWidgetVisible(widgets.textOneId);
|
||||||
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldField);
|
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxFieldField);
|
||||||
await widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
|
await widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
|
||||||
|
|
||||||
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldField);
|
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldField);
|
||||||
|
@@ -74,7 +74,23 @@
|
|||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
required: false,
|
required: false,
|
||||||
colspan: 1,
|
colspan: 1,
|
||||||
visibilityCondition: null,
|
visibilityCondition: {
|
||||||
|
leftType: 'field',
|
||||||
|
leftValue: 'textone',
|
||||||
|
operator: '==',
|
||||||
|
rightValue: 'aaa',
|
||||||
|
rightType: 'value',
|
||||||
|
nextConditionOperator: 'and-not',
|
||||||
|
nextCondition: {
|
||||||
|
leftType: 'field',
|
||||||
|
leftValue: 'texttwo',
|
||||||
|
operator: '==',
|
||||||
|
rightValue: 'aaa',
|
||||||
|
rightType: 'value',
|
||||||
|
nextConditionOperator: '',
|
||||||
|
nextCondition: null
|
||||||
|
}
|
||||||
|
},
|
||||||
params: {
|
params: {
|
||||||
existingColspan: 1,
|
existingColspan: 1,
|
||||||
maxColspan: 2
|
maxColspan: 2
|
||||||
@@ -467,3 +483,110 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const multipleTextVisibilityFormJson = {
|
||||||
|
formRepresentation: {
|
||||||
|
id: 'form-1fc64874-5fa9-4eb0-be06-61abd51abef7',
|
||||||
|
name: 'form2',
|
||||||
|
description: '',
|
||||||
|
version: 0,
|
||||||
|
standAlone: true,
|
||||||
|
formDefinition: {
|
||||||
|
tabs: [],
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
id: 'e6071f44-50cf-4b51-8b69-651df3ca4509',
|
||||||
|
name: 'Label',
|
||||||
|
type: 'container',
|
||||||
|
tab: null,
|
||||||
|
numberOfColumns: 2,
|
||||||
|
fields: {
|
||||||
|
1: [
|
||||||
|
{
|
||||||
|
id: 'textOne',
|
||||||
|
name: 'Text1',
|
||||||
|
type: 'text',
|
||||||
|
required: false,
|
||||||
|
colspan: 1,
|
||||||
|
placeholder: null,
|
||||||
|
minLength: 0,
|
||||||
|
maxLength: 0,
|
||||||
|
regexPattern: null,
|
||||||
|
visibilityCondition: {
|
||||||
|
leftType: 'field',
|
||||||
|
leftValue: 'textTwo',
|
||||||
|
operator: '!=',
|
||||||
|
rightValue: 'test',
|
||||||
|
rightType: 'value',
|
||||||
|
nextConditionOperator: 'or-not',
|
||||||
|
nextCondition: {
|
||||||
|
leftType: 'field',
|
||||||
|
leftValue: 'textThree',
|
||||||
|
operator: '==',
|
||||||
|
rightValue: 'test',
|
||||||
|
rightType: 'value',
|
||||||
|
nextConditionOperator: '',
|
||||||
|
nextCondition: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
existingColspan: 1,
|
||||||
|
maxColspan: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
2: [
|
||||||
|
{
|
||||||
|
id: 'textTwo',
|
||||||
|
name: 'Text2',
|
||||||
|
type: 'text',
|
||||||
|
required: false,
|
||||||
|
colspan: 1,
|
||||||
|
placeholder: null,
|
||||||
|
minLength: 0,
|
||||||
|
maxLength: 0,
|
||||||
|
regexPattern: null,
|
||||||
|
visibilityCondition: null,
|
||||||
|
params: {
|
||||||
|
existingColspan: 1,
|
||||||
|
maxColspan: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '4f086395-6f63-47c7-aeda-f315ae5b3891',
|
||||||
|
name: 'Label',
|
||||||
|
type: 'container',
|
||||||
|
tab: null,
|
||||||
|
numberOfColumns: 2,
|
||||||
|
fields: {
|
||||||
|
1: [
|
||||||
|
{
|
||||||
|
id: 'textThree',
|
||||||
|
name: 'Text3',
|
||||||
|
type: 'text',
|
||||||
|
required: false,
|
||||||
|
colspan: 1,
|
||||||
|
placeholder: null,
|
||||||
|
minLength: 0,
|
||||||
|
maxLength: 0,
|
||||||
|
regexPattern: null,
|
||||||
|
visibilityCondition: null,
|
||||||
|
params: {
|
||||||
|
existingColspan: 1,
|
||||||
|
maxColspan: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
2: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
outcomes: [],
|
||||||
|
metadata: {},
|
||||||
|
variables: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@@ -54,13 +54,7 @@ export class FormFields {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async checkWidgetIsHidden(fieldId): Promise<void> {
|
async checkWidgetIsHidden(fieldId): Promise<void> {
|
||||||
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
|
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
|
||||||
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkWidgetIsNotHidden(fieldId): Promise<void> {
|
|
||||||
await this.checkWidgetIsVisible(fieldId);
|
|
||||||
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
|
|
||||||
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement, 6000);
|
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement, 6000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ export class CheckboxWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isCheckboxDisplayed(fieldId): Promise<void> {
|
async isCheckboxDisplayed(fieldId): Promise<void> {
|
||||||
await this.formFields.checkWidgetIsNotHidden(fieldId);
|
await this.formFields.checkWidgetIsVisible(fieldId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCheckboxHidden(fieldId): Promise<void> {
|
async isCheckboxHidden(fieldId): Promise<void> {
|
||||||
|
Reference in New Issue
Block a user