This is an automated email from the ASF dual-hosted git repository.
yamer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new 4f1667db866 kie-issues#371: [DMN Editor] Enable modification of
constraints on DT columns (#2485)
4f1667db866 is described below
commit 4f1667db866da19c4bee505b9faca3024e760b63
Author: Luiz João Motta <[email protected]>
AuthorDate: Mon Jul 29 03:41:08 2024 -0300
kie-issues#371: [DMN Editor] Enable modification of constraints on DT
columns (#2485)
---
.../tests-e2e/__fixtures__/monaco.ts | 6 +-
.../tests-e2e/api/expressionContainer.ts | 5 +
.../tests-e2e/api/nameAndDataTypeCell.ts | 5 +
packages/dmn-editor/src/DmnEditor.tsx | 4 +-
.../dataTypes/ConstraintComponents/Constraint.ts | 3 +-
packages/dmn-editor/src/dataTypes/Constraints.tsx | 2 +-
.../dmn-editor/src/dataTypes/ConstraintsEnum.tsx | 6 +-
.../src/dataTypes/ConstraintsExpression.tsx | 6 +-
.../dmn-editor/src/dataTypes/ConstraintsRange.tsx | 4 +-
packages/dmn-editor/src/dataTypes/DataTypes.tsx | 7 +-
packages/dmn-editor/src/draggable/Draggable.tsx | 1 +
.../BoxedExpressionPropertiesPanel.tsx | 1 +
.../DecisionTableOutputHeaderCell.tsx | 73 +-
.../DecisionTableOutputRuleCell.tsx | 51 +-
packages/dmn-editor/tests-e2e/__fixtures__/base.ts | 31 +-
.../dmn-editor/tests-e2e/__fixtures__/dataTypes.ts | 168 ++++
.../dmn-editor/tests-e2e/__fixtures__/editor.ts | 10 +
.../dmn-editor/tests-e2e/__fixtures__/jsonModel.ts | 14 -
.../dmn-editor/tests-e2e/__fixtures__/nodes.ts | 5 +
.../bee/beePropertiesPanelBase.ts} | 16 +-
.../bee/decisionTableInputHeaderPropertiesPanel.ts | 86 ++
.../bee/decisionTableInputRulePropertiesPanel.ts | 72 ++
.../decisionTableOutputHeaderPropertiesPanel.ts | 125 +++
.../bee/decisionTableOutputRulePropertiesPanel.ts | 71 ++
.../propertiesPanel/beePropertiesPanel.ts | 47 +
.../propertiesPanel/bkmPropertiesPanel.ts | 2 +-
.../propertiesPanel/decisionPropertiesPanel.ts | 2 +-
.../decisionServicePropertiesPanel.ts | 2 +-
.../propertiesPanel/inputDataPropertiesPanel.ts | 2 +-
.../knowledgeSourcePropertiesPanel.ts | 2 +-
.../propertiesPanel/parts/dataTypeProperties.ts | 43 +-
.../checkDecisionTableCellsDataType.spec.ts | 1045 ++++++++++++++++++++
.../tests-e2e/drgElements/addBkm.spec.ts | 1 -
.../tests-e2e/drgElements/addDecision.spec.ts | 1 -
.../drgElements/addDecisionService.spec.ts | 1 -
.../tests-e2e/drgElements/addInputData.spec.ts | 1 -
.../drgElements/changeBkmProperties.spec.ts | 2 +-
.../drgElements/changeDecisionProperties.spec.ts | 2 +-
.../changeDecisionServiceProperties.spec.ts | 2 +-
.../drgElements/changeInputDataProperties.spec.ts | 2 +-
40 files changed, 1852 insertions(+), 77 deletions(-)
diff --git
a/packages/boxed-expression-component/tests-e2e/__fixtures__/monaco.ts
b/packages/boxed-expression-component/tests-e2e/__fixtures__/monaco.ts
index 53d705283f6..8ccabcba9f5 100644
--- a/packages/boxed-expression-component/tests-e2e/__fixtures__/monaco.ts
+++ b/packages/boxed-expression-component/tests-e2e/__fixtures__/monaco.ts
@@ -33,10 +33,12 @@ export class Monaco {
await
args.monacoParentLocator.getByTestId("monaco-container").dblclick();
}
- if (this.projectName === ProjectName.GOOGLE_CHROME) {
- // Google chromes fill function is not always erasing the input content
+ if (this.projectName !== ProjectName.WEBKIT) {
await this.page.getByLabel("Editor content;Press Alt+F1 for
Accessibility Options.").press("Control+A");
}
+ if (this.projectName === ProjectName.WEBKIT) {
+ await this.page.getByLabel("Editor content;Press Alt+F1 for
Accessibility Options.").press("Meta+A");
+ }
// FEEL text input selector when the monaco editor is selected.
await this.page.getByLabel("Editor content;Press Alt+F1 for Accessibility
Options.").fill(args.content);
await this.page.keyboard.press("Home");
diff --git
a/packages/boxed-expression-component/tests-e2e/api/expressionContainer.ts
b/packages/boxed-expression-component/tests-e2e/api/expressionContainer.ts
index cc94683b3bb..549e11a2e33 100644
--- a/packages/boxed-expression-component/tests-e2e/api/expressionContainer.ts
+++ b/packages/boxed-expression-component/tests-e2e/api/expressionContainer.ts
@@ -111,6 +111,11 @@ export class ExpressionCell {
return await this.monaco.fill({ monacoParentLocator: this.locator,
content: content });
}
+ public async select() {
+ // Uses the 1,1 to avoid problems by clicking on the element corner
+ await this.content.click({ position: { x: 1, y: 1 } });
+ }
+
public get content() {
return this.locator.nth(0);
}
diff --git
a/packages/boxed-expression-component/tests-e2e/api/nameAndDataTypeCell.ts
b/packages/boxed-expression-component/tests-e2e/api/nameAndDataTypeCell.ts
index f3a3d9fe9e3..fbae08acd35 100644
--- a/packages/boxed-expression-component/tests-e2e/api/nameAndDataTypeCell.ts
+++ b/packages/boxed-expression-component/tests-e2e/api/nameAndDataTypeCell.ts
@@ -51,6 +51,11 @@ export class NameAndDataTypeCell {
return await
this.locator.getByTestId("kie-tools--bee--expression-info-data-type").nth(0).innerText();
}
+ public async select() {
+ // Uses the 1,1 to avoid problems by clicking on the element corner
+ await this.content.click({ position: { x: 1, y: 1 } });
+ }
+
get content() {
return this.locator.nth(0);
}
diff --git a/packages/dmn-editor/src/DmnEditor.tsx
b/packages/dmn-editor/src/DmnEditor.tsx
index 3232ab0b562..c6f43aad146 100644
--- a/packages/dmn-editor/src/DmnEditor.tsx
+++ b/packages/dmn-editor/src/DmnEditor.tsx
@@ -386,7 +386,9 @@ export const DmnEditorInternal = ({
</Tab>
<Tab eventKey={DmnEditorTab.DATA_TYPES} title={tabTitle.dataTypes}>
- {navigationTab === DmnEditorTab.DATA_TYPES && <DataTypes />}
+ <div data-testid={"kie-tools--dmn-editor--data-types-container"}>
+ {navigationTab === DmnEditorTab.DATA_TYPES && <DataTypes />}
+ </div>
</Tab>
<Tab eventKey={DmnEditorTab.INCLUDED_MODELS}
title={tabTitle.includedModels}>
diff --git
a/packages/dmn-editor/src/dataTypes/ConstraintComponents/Constraint.ts
b/packages/dmn-editor/src/dataTypes/ConstraintComponents/Constraint.ts
index 7d2cbccf0f3..358c876f479 100644
--- a/packages/dmn-editor/src/dataTypes/ConstraintComponents/Constraint.ts
+++ b/packages/dmn-editor/src/dataTypes/ConstraintComponents/Constraint.ts
@@ -22,7 +22,6 @@ import React from "react";
export interface ConstraintProps {
id: string;
placeholder?: string;
- type: "text" | "number";
value: string;
onChange: (newValue: string) => void;
onBlur?: () => void;
@@ -32,5 +31,5 @@ export interface ConstraintProps {
setFocusOwner?: (id: string) => void;
style?: React.CSSProperties;
isValid: boolean;
- onKeyDown: (e: React.KeyboardEvent) => void;
+ onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
}
diff --git a/packages/dmn-editor/src/dataTypes/Constraints.tsx
b/packages/dmn-editor/src/dataTypes/Constraints.tsx
index cc871b56179..fe64fc9f95d 100644
--- a/packages/dmn-editor/src/dataTypes/Constraints.tsx
+++ b/packages/dmn-editor/src/dataTypes/Constraints.tsx
@@ -57,7 +57,7 @@ export type TypeHelper = {
parse: (value: string) => any;
transform: (value: string) => string;
recover: (value?: string) => string | undefined;
- component: (props: any) => React.ReactNode | undefined;
+ component: (props: ConstraintProps) => React.ReactNode | undefined;
};
export interface ConstraintComponentProps {
diff --git a/packages/dmn-editor/src/dataTypes/ConstraintsEnum.tsx
b/packages/dmn-editor/src/dataTypes/ConstraintsEnum.tsx
index d92758c9aa6..d7822f6cb92 100644
--- a/packages/dmn-editor/src/dataTypes/ConstraintsEnum.tsx
+++ b/packages/dmn-editor/src/dataTypes/ConstraintsEnum.tsx
@@ -155,7 +155,7 @@ export function ConstraintsEnum({
borderRadius: "4px",
}}
>
- <ul>
+ <ul
data-testid={"kie-tools--dmn-editor--enumeration-constraint-list"}>
<DragAndDrop
reorder={reorder}
onDragEnd={onDragEnd}
@@ -208,10 +208,10 @@ function EnumElement({
isValid: boolean;
typeHelper: TypeHelper;
focusOwner: string;
- setFocusOwner: React.SetStateAction<React.Dispatch<string>>;
+ setFocusOwner: (id: string) => void;
onChange: (newValue: string) => void;
onRemove: () => void;
- onKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;
+ onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
}) {
const value = useMemo<string>(() => initialValue, [initialValue]);
const removeButtonRef = useRef(null);
diff --git a/packages/dmn-editor/src/dataTypes/ConstraintsExpression.tsx
b/packages/dmn-editor/src/dataTypes/ConstraintsExpression.tsx
index 75d53af21b9..1a87017d20a 100644
--- a/packages/dmn-editor/src/dataTypes/ConstraintsExpression.tsx
+++ b/packages/dmn-editor/src/dataTypes/ConstraintsExpression.tsx
@@ -112,7 +112,11 @@ export function ConstraintsExpression({
>
{isReadonly &&
(value ? (
- <span className="editable-cell-value pf-u-text-break-word"
dangerouslySetInnerHTML={{ __html: preview }} />
+ <span
+
data-testid={"kie-tools--dmn-editor--readonly-expression-constraint-with-value"}
+ className="editable-cell-value pf-u-text-break-word"
+ dangerouslySetInnerHTML={{ __html: preview }}
+ />
) : (
<p style={{ fontStyle: "italic" }}>{`<None>`}</p>
))}
diff --git a/packages/dmn-editor/src/dataTypes/ConstraintsRange.tsx
b/packages/dmn-editor/src/dataTypes/ConstraintsRange.tsx
index b18aca1498e..3b7ea1e2b29 100644
--- a/packages/dmn-editor/src/dataTypes/ConstraintsRange.tsx
+++ b/packages/dmn-editor/src/dataTypes/ConstraintsRange.tsx
@@ -224,7 +224,7 @@ export function ConstraintsRange({
/>
</Tooltip>
</div>
- <div style={{ gridArea: "startField" }}>
+ <div style={{ gridArea: "startField" }}
data-testid={"kie-tools--dmn-editor--range-constraint-start-value"}>
{typeHelper.component({
autoFocus: start === "",
onBlur: () => onInternalChange(),
@@ -286,7 +286,7 @@ export function ConstraintsRange({
/>
</Tooltip>
</div>
- <div style={{ gridArea: "endField" }}>
+ <div style={{ gridArea: "endField" }}
data-testid={"kie-tools--dmn-editor--range-constraint-end-value"}>
{typeHelper.component({
autoFocus: start !== "",
onBlur: () => onInternalChange(),
diff --git a/packages/dmn-editor/src/dataTypes/DataTypes.tsx
b/packages/dmn-editor/src/dataTypes/DataTypes.tsx
index 95bf4a5eae5..58322e853cb 100644
--- a/packages/dmn-editor/src/dataTypes/DataTypes.tsx
+++ b/packages/dmn-editor/src/dataTypes/DataTypes.tsx
@@ -183,7 +183,12 @@ export function DataTypes() {
<Drawer isExpanded={true} isInline={true} position={"left"}
className={"kie-dmn-editor--data-types-container"}>
<DrawerContent
panelContent={
- <DrawerPanelContent isResizable={true} minSize={"300px"}
defaultSize={"400px"}>
+ <DrawerPanelContent
+ isResizable={true}
+ minSize={"300px"}
+ defaultSize={"400px"}
+ data-testid={"kie-tools--dmn-editor--data-types-list"}
+ >
<Flex
justifyContent={{ default: "justifyContentSpaceBetween" }}
alignItems={{ default: "alignItemsCenter" }}
diff --git a/packages/dmn-editor/src/draggable/Draggable.tsx
b/packages/dmn-editor/src/draggable/Draggable.tsx
index a5ffd33f0b8..59040cb0215 100644
--- a/packages/dmn-editor/src/draggable/Draggable.tsx
+++ b/packages/dmn-editor/src/draggable/Draggable.tsx
@@ -250,6 +250,7 @@ export function Draggable(props: {
onPointerEnter={() => setHoveredItem(props.index)}
onPointerLeave={() => setHoveredItem(-1)}
onPointerOver={() => setHoveredItem(props.index)}
+ data-testid={`kie-tools--dmn-editor--draggable-row-${props.index}`}
>
{!props.isDisabled ? (
<Icon
diff --git
a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanel.tsx
b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanel.tsx
index 2e12587303d..d95e86bc307 100644
--- a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanel.tsx
+++ b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanel.tsx
@@ -103,6 +103,7 @@ export function BoxedExpressionPropertiesPanel() {
<>
{node && (
<DrawerPanelContent
+ data-testid={"kie-tools--dmn-editor--bee-properties-panel-container"}
isResizable={true}
minSize={"300px"}
defaultSize={"500px"}
diff --git
a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx
b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx
index 026712b619e..5f7990388c2 100644
---
a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx
+++
b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx
@@ -22,9 +22,9 @@ import { useCallback, useMemo, useState } from "react";
import { BoxedExpressionIndex } from
"../../boxedExpressions/boxedExpressionIndex";
import { ContentField, DescriptionField, ExpressionLanguageField, NameField,
TypeRefField } from "./Fields";
import { FormGroup, FormSection } from
"@patternfly/react-core/dist/js/components/Form";
-import { DMN15__tOutputClause } from
"@kie-tools/dmn-marshaller/dist/schemas/dmn-1_5/ts-gen/types";
+import { DMN15__tDecision, DMN15__tOutputClause } from
"@kie-tools/dmn-marshaller/dist/schemas/dmn-1_5/ts-gen/types";
import { PropertiesPanelHeader } from "../PropertiesPanelHeader";
-import { BoxedDecisionTable, DmnBuiltInDataType, generateUuid } from
"@kie-tools/boxed-expression-component/dist/api";
+import { BoxedDecisionTable, generateUuid } from
"@kie-tools/boxed-expression-component/dist/api";
import { useDmnEditor } from "../../DmnEditorContext";
import { useBoxedExpressionUpdater } from "./useBoxedExpressionUpdater";
import { ClipboardCopy } from
"@patternfly/react-core/dist/js/components/ClipboardCopy";
@@ -33,6 +33,8 @@ import { useDmnEditorStore, useDmnEditorStoreApi } from
"../../store/StoreContex
import { useExternalModels } from
"../../includedModels/DmnEditorDependenciesContext";
import { State } from "../../store/Store";
import { Normalized } from "../../normalization/normalize";
+import { renameDrgElement } from "../../mutations/renameNode";
+import { buildXmlHref } from "../../xml/xmlHrefs";
export function DecisionTableOutputHeaderCell(props: {
boxedExpressionIndex?: BoxedExpressionIndex;
@@ -40,9 +42,17 @@ export function DecisionTableOutputHeaderCell(props: {
}) {
const dmnEditorStoreApi = useDmnEditorStoreApi();
const selectedObjectId = useDmnEditorStore((s) =>
s.boxedExpressionEditor.selectedObjectId);
+ const activeDrgElementId = useDmnEditorStore((s) =>
s.boxedExpressionEditor.activeDrgElementId);
const { dmnEditorRootElementRef } = useDmnEditor();
const { externalModelsByNamespace } = useExternalModels();
+ const node = useDmnEditorStore((s) =>
+ s
+ .computed(s)
+ .getDiagramData(externalModelsByNamespace)
+ .nodesById.get(buildXmlHref({ id: activeDrgElementId ?? "" }))
+ );
+
const selectedObjectInfos = useMemo(
() => props.boxedExpressionIndex?.get(selectedObjectId ?? ""),
[props.boxedExpressionIndex, selectedObjectId]
@@ -59,15 +69,6 @@ export function DecisionTableOutputHeaderCell(props: {
const defaultOutputEntry = useMemo(() => cell.defaultOutputEntry,
[cell.defaultOutputEntry]);
const outputValues = useMemo(() => cell.outputValues, [cell.outputValues]);
- const itemDefinition = useMemo(() => {
- const { allDataTypesById, allTopLevelItemDefinitionUniqueNames } =
dmnEditorStoreApi
- .getState()
- .computed(dmnEditorStoreApi.getState())
- .getDataTypes(externalModelsByNamespace);
- return
allDataTypesById.get(allTopLevelItemDefinitionUniqueNames.get(cell?.["@_typeRef"]
?? "") ?? "")
- ?.itemDefinition;
- }, [cell, dmnEditorStoreApi, externalModelsByNamespace]);
-
const root = useMemo(
() =>
props.boxedExpressionIndex?.get(
@@ -76,6 +77,27 @@ export function DecisionTableOutputHeaderCell(props: {
[props.boxedExpressionIndex, selectedObjectInfos?.expressionPath]
);
+ // In case the the output column is merged, the output column should have
the same type as the Decision Node
+ // It can happen to output column and Decision Node have different types,
e.g. broken model.
+ // For this case, the user will be able to fix it.
+ const cellMustHaveSameTypeAsRoot = useMemo(
+ () =>
+ root?.output.length === 1 && (root?.["@_typeRef"] ===
cell?.["@_typeRef"] || cell?.["@_typeRef"] === undefined),
+ [cell, root]
+ );
+
+ const itemDefinition = useMemo(() => {
+ const { allDataTypesById, allTopLevelItemDefinitionUniqueNames } =
dmnEditorStoreApi
+ .getState()
+ .computed(dmnEditorStoreApi.getState())
+ .getDataTypes(externalModelsByNamespace);
+ return allDataTypesById.get(
+ allTopLevelItemDefinitionUniqueNames.get(
+ cellMustHaveSameTypeAsRoot ? root?.["@_typeRef"] ?? "" :
cell?.["@_typeRef"] ?? ""
+ ) ?? ""
+ )?.itemDefinition;
+ }, [cell, cellMustHaveSameTypeAsRoot, dmnEditorStoreApi,
externalModelsByNamespace, root]);
+
const [isDefaultOutputEntryExpanded, setDefaultOutputEntryExpanded] =
useState(false);
const [isOutputValuesExpanded, setOutputValuesExpanded] = useState(false);
@@ -116,16 +138,37 @@ export function DecisionTableOutputHeaderCell(props: {
<>
<NameField
alternativeFieldName={`${alternativeFieldName} Name`}
- isReadonly={true}
+ isReadonly={false}
id={root["@_id"]!}
name={root?.["@_label"] ?? ""}
getAllUniqueNames={getAllUniqueNames}
+ onChange={(newName) => {
+ dmnEditorStoreApi.setState((state) => {
+ renameDrgElement({
+ definitions: state.dmn.model.definitions,
+ index: node?.data.index ?? 0,
+ newName,
+ });
+ });
+ }}
/>
<TypeRefField
alternativeFieldName={`${alternativeFieldName} Type`}
- isReadonly={true}
+ isReadonly={false}
dmnEditorRootElementRef={dmnEditorRootElementRef}
typeRef={root?.["@_typeRef"]}
+ onChange={(newTypeRef) => {
+ dmnEditorStoreApi.setState((state) => {
+ const drgElement = state.dmn.model.definitions.drgElement![
+ node?.data.index ?? 0
+ ] as Normalized<DMN15__tDecision>;
+ drgElement.variable ??= {
+ "@_id": generateUuid(),
+ "@_name": (node?.data.dmnObject as
Normalized<DMN15__tDecision> | undefined)?.["@_name"] ?? "",
+ };
+ drgElement.variable["@_typeRef"] = newTypeRef;
+ });
+ }}
/>
</>
)}
@@ -143,9 +186,9 @@ export function DecisionTableOutputHeaderCell(props: {
/>
<TypeRefField
alternativeFieldName={root?.output.length === 1 ? "Column Type" :
undefined}
- isReadonly={props.isReadonly}
+ isReadonly={cellMustHaveSameTypeAsRoot ? true : props.isReadonly}
dmnEditorRootElementRef={dmnEditorRootElementRef}
- typeRef={cell?.["@_typeRef"]}
+ typeRef={cellMustHaveSameTypeAsRoot ? root?.["@_typeRef"] :
cell?.["@_typeRef"]}
onChange={(newTypeRef) =>
updater((dmnObject) => {
dmnObject["@_typeRef"] = newTypeRef;
diff --git
a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputRuleCell.tsx
b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputRuleCell.tsx
index e062b8833bf..38de565549a 100644
---
a/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputRuleCell.tsx
+++
b/packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputRuleCell.tsx
@@ -29,7 +29,7 @@ import { useBoxedExpressionUpdater } from
"./useBoxedExpressionUpdater";
import { ClipboardCopy } from
"@patternfly/react-core/dist/js/components/ClipboardCopy";
import { FormGroup } from "@patternfly/react-core/dist/js/components/Form";
import { ConstraintsFromTypeConstraintAttribute } from
"../../dataTypes/Constraints";
-import { DmnBuiltInDataType } from
"@kie-tools/boxed-expression-component/dist/api";
+import { BoxedDecisionTable, DmnBuiltInDataType } from
"@kie-tools/boxed-expression-component/dist/api";
import { useDmnEditor } from "../../DmnEditorContext";
import { useDmnEditorStore, useDmnEditorStoreApi } from
"../../store/StoreContext";
import { useExternalModels } from
"../../includedModels/DmnEditorDependenciesContext";
@@ -48,10 +48,33 @@ export function DecisionTableOutputRuleCell(props: {
[props.boxedExpressionIndex, selectedObjectId]
);
+ const root = useMemo(
+ () =>
+ props.boxedExpressionIndex?.get(
+
selectedObjectInfos?.expressionPath[selectedObjectInfos?.expressionPath.length
- 1]?.root ?? ""
+ ),
+ [props.boxedExpressionIndex, selectedObjectInfos?.expressionPath]
+ );
+
+ const cell = useMemo(
+ () => selectedObjectInfos?.cell as Normalized<DMN15__tLiteralExpression>,
+ [selectedObjectInfos?.cell]
+ );
+
+ // In case the the output column is merged, the output column should have
the same type as the Decision Node
+ // It can happen to output column and Decision Node have different types,
e.g. broken model.
+ // For this case, the cell should have the column type.
+ const cellMustHaveSameTypeAsRoot = useMemo(
+ () =>
+ (root?.cell as Normalized<BoxedDecisionTable> |
undefined)?.output.length === 1 &&
+ ((root?.cell as Normalized<BoxedDecisionTable> |
undefined)?.["@_typeRef"] === cell?.["@_typeRef"] ||
+ cell?.["@_typeRef"] === undefined),
+ [cell, root?.cell]
+ );
+
const headerType = useMemo(() => {
const cellPath =
selectedObjectInfos?.expressionPath[selectedObjectInfos?.expressionPath.length
- 1];
if (cellPath && cellPath.root) {
- const root = props.boxedExpressionIndex?.get(cellPath.root);
const { allDataTypesById, allTopLevelItemDefinitionUniqueNames } =
dmnEditorStoreApi
.getState()
.computed(dmnEditorStoreApi.getState())
@@ -62,22 +85,26 @@ export function DecisionTableOutputRuleCell(props: {
) {
const typeRef =
allTopLevelItemDefinitionUniqueNames.get(
- (root?.cell as
Normalized<DMN15__tDecisionTable>)?.output?.[cellPath.column ?? 0]["@_typeRef"]
?? ""
+ cellMustHaveSameTypeAsRoot
+ ? (root?.cell as Normalized<DMN15__tDecisionTable> |
undefined)?.["@_typeRef"] ?? ""
+ : (root?.cell as
Normalized<DMN15__tDecisionTable>)?.output?.[cellPath.column ?? 0]["@_typeRef"]
?? ""
) ?? DmnBuiltInDataType.Undefined;
return { typeRef, itemDefinition:
allDataTypesById.get(typeRef)?.itemDefinition };
}
}
- }, [dmnEditorStoreApi, externalModelsByNamespace,
props.boxedExpressionIndex, selectedObjectInfos?.expressionPath]);
+ }, [
+ cellMustHaveSameTypeAsRoot,
+ dmnEditorStoreApi,
+ externalModelsByNamespace,
+ root?.cell,
+ root?.expressionPath,
+ selectedObjectInfos?.expressionPath,
+ ]);
const updater =
useBoxedExpressionUpdater<Normalized<DMN15__tLiteralExpression>>(
selectedObjectInfos?.expressionPath ?? []
);
- const cell = useMemo(
- () => selectedObjectInfos?.cell as Normalized<DMN15__tLiteralExpression>,
- [selectedObjectInfos?.cell]
- );
-
return (
<>
<FormGroup label="ID">
@@ -91,7 +118,11 @@ export function DecisionTableOutputRuleCell(props: {
alternativeFieldName={"Output header type"}
isReadonly={true}
dmnEditorRootElementRef={dmnEditorRootElementRef}
- typeRef={headerType.itemDefinition?.["@_name"] ??
headerType.typeRef}
+ typeRef={
+ cellMustHaveSameTypeAsRoot
+ ? (root?.cell as Normalized<BoxedDecisionTable> |
undefined)?.["@_typeRef"]
+ : headerType.itemDefinition?.["@_name"] ?? headerType.typeRef
+ }
/>
</>
)}
diff --git a/packages/dmn-editor/tests-e2e/__fixtures__/base.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/base.ts
index 02fe2f2e98b..c8dd28a957f 100644
--- a/packages/dmn-editor/tests-e2e/__fixtures__/base.ts
+++ b/packages/dmn-editor/tests-e2e/__fixtures__/base.ts
@@ -34,15 +34,24 @@ import { GroupPropertiesPanel } from
"./propertiesPanel/groupPropertiesPanel";
import { DiagramPropertiesPanel } from
"./propertiesPanel/diagramPropertiesPanel";
import { MultipleNodesPropertiesPanel } from
"./propertiesPanel/multipleNodesPropertiesPanel";
import { Overlays } from "./overlays";
+import { DataTypes } from "./dataTypes";
+import { BeePropertiesPanel } from "./propertiesPanel/beePropertiesPanel";
+import { BoxedExpressionEditor } from
"@kie-tools/boxed-expression-component/tests-e2e/__fixtures__/boxedExpression";
+import { Monaco } from
"@kie-tools/boxed-expression-component/tests-e2e/__fixtures__/monaco";
+import { ProjectName } from "@kie-tools/playwright-base/projectNames";
type DmnEditorFixtures = {
+ bee: BoxedExpressionEditor;
+ dataTypes: DataTypes;
diagram: Diagram;
edges: Edges;
editor: Editor;
jsonModel: JsonModel;
+ monaco: Monaco;
nodes: Nodes;
palette: Palette;
overlays: Overlays;
+ beePropertiesPanel: BeePropertiesPanel;
bkmPropertiesPanel: BkmPropertiesPanel;
decisionPropertiesPanel: DecisionPropertiesPanel;
decisionServicePropertiesPanel: DecisionServicePropertiesPanel;
@@ -55,27 +64,39 @@ type DmnEditorFixtures = {
};
export const test = base.extend<DmnEditorFixtures>({
+ bee: async ({ page, baseURL, monaco }, use) => {
+ await use(new BoxedExpressionEditor(page, monaco, baseURL));
+ },
+ dataTypes: async ({ page, monaco }, use) => {
+ await use(new DataTypes(page, monaco));
+ },
+ diagram: async ({ page }, use) => {
+ await use(new Diagram(page));
+ },
+ edges: async ({ page, nodes, diagram }, use) => {
+ await use(new Edges(page, nodes, diagram));
+ },
editor: async ({ page, baseURL }, use) => {
await use(new Editor(page, baseURL));
},
jsonModel: async ({ page, baseURL }, use) => {
await use(new JsonModel(page, baseURL));
},
- diagram: async ({ page }, use) => {
- await use(new Diagram(page));
+ monaco: async ({ page }, use, testInfo) => {
+ await use(new Monaco(page, testInfo.project.name as ProjectName));
},
nodes: async ({ page, diagram, browserName }, use) => {
await use(new Nodes(page, diagram, browserName));
},
- edges: async ({ page, nodes, diagram }, use) => {
- await use(new Edges(page, nodes, diagram));
- },
palette: async ({ page, diagram, nodes }, use) => {
await use(new Palette(page, diagram, nodes));
},
overlays: async ({ page }, use) => {
await use(new Overlays(page));
},
+ beePropertiesPanel: async ({ diagram, page }, use) => {
+ await use(new BeePropertiesPanel(diagram, page));
+ },
bkmPropertiesPanel: async ({ diagram, page }, use) => {
await use(new BkmPropertiesPanel(diagram, page));
},
diff --git a/packages/dmn-editor/tests-e2e/__fixtures__/dataTypes.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/dataTypes.ts
new file mode 100644
index 00000000000..7aca804c055
--- /dev/null
+++ b/packages/dmn-editor/tests-e2e/__fixtures__/dataTypes.ts
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 { Monaco } from
"@kie-tools/boxed-expression-component/tests-e2e/__fixtures__/monaco";
+import { Page } from "@playwright/test";
+
+export enum DataType {
+ Undefined = "<Undefined>",
+ Any = "Any",
+ Boolean = "boolean",
+ Context = "context",
+ Date = "date",
+ DateTime = "date and time",
+ DateTimeDuration = "days and time duration",
+ Number = "number",
+ String = "string",
+ Time = "time",
+ YearsMonthsDuration = "years and months duration",
+}
+
+export enum ConstraintType {
+ ENUMERATION = "Enumeration",
+ EXPRESSION = "Expression",
+ NONE = "None",
+ RANGE = "Range",
+}
+
+export enum RangeConstraintPosition {
+ START = "start",
+ END = "end",
+}
+
+export class DataTypes {
+ constructor(
+ public page: Page,
+ public monaco: Monaco
+ ) {}
+
+ public get() {
+ return
this.page.getByTestId("kie-tools--dmn-editor--data-types-container");
+ }
+
+ public getNoneConstraintButton() {
+ return this.get().getByRole("button", { name: ConstraintType.NONE, exact:
true });
+ }
+
+ public getEnumerationConstraintButton() {
+ return this.get().getByRole("button", { name: ConstraintType.ENUMERATION,
exact: true });
+ }
+
+ public getExpressionConstraintButton() {
+ return this.get().getByRole("button", { name: ConstraintType.EXPRESSION,
exact: true });
+ }
+
+ public getRangeConstraintButton() {
+ return this.get().getByRole("button", { name: ConstraintType.RANGE, exact:
true });
+ }
+
+ public async createFirstCustonDataType() {
+ await this.get().getByRole("button", { name: "Create a custom data type"
}).click();
+ }
+
+ public async createNewDataType() {
+ await this.get().getByLabel("Add Data Type").click();
+ }
+
+ public async selectDataType(args: { name: string }) {
+ await
this.get().getByTestId("kie-tools--dmn-editor--data-types-list").getByText(args.name).click();
+ }
+
+ public async changeDataTypeName(args: { newName: string }) {
+ await this.get().getByPlaceholder("Enter a name...").fill(args.newName);
+ }
+
+ public async changeDataTypeBaseType(args: { newBaseType: DataType }) {
+ await this.get().getByPlaceholder("Select a data type...").click();
+ await this.get().getByPlaceholder("Select a data
type...").press("ControlOrMeta+a");
+ await this.get().getByPlaceholder("Select a data
type...").fill(args.newBaseType);
+ await this.page.getByRole("option", { name: args.newBaseType, exact: true
}).click();
+ }
+
+ public async changeDataTypeBaseCustomType(args: { newBaseType: string }) {
+ await this.get().getByPlaceholder("Select a data type...").click();
+ await this.get().getByPlaceholder("Select a data
type...").press("ControlOrMeta+a");
+ await this.get().getByPlaceholder("Select a data
type...").fill(args.newBaseType);
+ await this.page.getByRole("option", { name: `${args.newBaseType} `, exact:
false }).click();
+ }
+
+ // The current method only supports "string", "number"
+ public async addEnumerationConstraint(args: { values: string[] }) {
+ const enumerationList =
this.get().getByTestId("kie-tools--dmn-editor--enumeration-constraint-list");
+ const firstElementValue = await enumerationList
+ .getByTestId("kie-tools--dmn-editor--draggable-row-0")
+ .locator("input")
+ .getAttribute("value");
+ let append = false;
+ if (firstElementValue !== "" || firstElementValue === null) {
+ append = true;
+ }
+
+ if (append) {
+ // add at the end of a list;
+ const listCount = await enumerationList.getByRole("listitem").count();
+ await this.get().getByRole("button", { name: "Add value" }).click();
+ await this.addEnumerationValue({
+ values: args.values,
+ initial: listCount,
+ total: args.values.length + listCount,
+ });
+ } else {
+ // initialize a new list of values;
+ await this.addEnumerationValue({ values: args.values, initial: 0, total:
args.values.length });
+ }
+ }
+
+ private async addEnumerationValue(args: { values: string[]; initial: number;
total: number }) {
+ let valueIndex = 0;
+ for (let index = args.initial; index < args.total; index++) {
+ await this.get()
+ .getByTestId(`kie-tools--dmn-editor--draggable-row-${index}`)
+ .locator("input")
+ .fill(args.values[valueIndex]);
+ if (index !== args.total - 1) {
+ await this.get().getByRole("button", { name: "Add value" }).click();
+ }
+ valueIndex++;
+ }
+ }
+
+ public async addExpressionConstraint(args: { value: string }) {
+ await this.monaco.fill({ monacoParentLocator: this.get(), content:
args.value });
+ }
+
+ // The current method only supports "string", "number"
+ public async addRangeConstraint(args: { values: [string, string] }) {
+ await this.changeRangeStartConstraint(args.values[0]);
+ await
this.get().getByTestId("kie-tools--dmn-editor--range-constraint-end-value").click();
+ await this.changeRangeEndConstraint(args.values[1]);
+ }
+
+ public async changeRangeStartConstraint(value: string) {
+ await
this.get().getByTestId("kie-tools--dmn-editor--range-constraint-start-value").locator("input").fill(value);
+ }
+
+ public async changeRangeEndConstraint(value: string) {
+ await
this.get().getByTestId("kie-tools--dmn-editor--range-constraint-end-value").locator("input").fill(value);
+ }
+
+ public async deleteConstraint() {
+ await this.getNoneConstraintButton().click();
+ }
+}
diff --git a/packages/dmn-editor/tests-e2e/__fixtures__/editor.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/editor.ts
index 66306d19b16..933e635064b 100644
--- a/packages/dmn-editor/tests-e2e/__fixtures__/editor.ts
+++ b/packages/dmn-editor/tests-e2e/__fixtures__/editor.ts
@@ -19,6 +19,12 @@
import { Page } from "@playwright/test";
+export enum TabName {
+ EDITOR = "Editor",
+ DATA_TYPES = "Data types",
+ INCLUDED_MODELS = "Included models",
+}
+
export class Editor {
constructor(
public page: Page,
@@ -28,4 +34,8 @@ export class Editor {
public async open() {
await
this.page.goto(`${this.baseURL}/iframe.html?args=&id=misc-empty--empty&viewMode=story`);
}
+
+ public async changeTab(args: { tab: TabName }) {
+ await this.page.getByRole("tab", { name: args.tab }).click();
+ }
}
diff --git a/packages/dmn-editor/tests-e2e/__fixtures__/jsonModel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/jsonModel.ts
index d4cd564a9f5..d9308df6256 100644
--- a/packages/dmn-editor/tests-e2e/__fixtures__/jsonModel.ts
+++ b/packages/dmn-editor/tests-e2e/__fixtures__/jsonModel.ts
@@ -22,20 +22,6 @@ import { Page } from "@playwright/test";
import { DrgElement } from "./jsonModel/drgElement";
import { Drd } from "./jsonModel/drd";
-export enum DataType {
- Undefined = "<Undefined>",
- Any = "Any",
- Boolean = "boolean",
- Context = "context",
- Date = "date",
- DateTime = "date and time",
- DateTimeDuration = "days and time duration",
- Number = "number",
- String = "string",
- Time = "time",
- YearsMonthsDuration = "years and months duration",
-}
-
export const STORYBOOK__DMN_EDITOR_MODEL =
"div[data-testid='storybook--dmn-editor-model']";
export class JsonModel {
diff --git a/packages/dmn-editor/tests-e2e/__fixtures__/nodes.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/nodes.ts
index 84f272a2f71..82c5546c765 100644
--- a/packages/dmn-editor/tests-e2e/__fixtures__/nodes.ts
+++ b/packages/dmn-editor/tests-e2e/__fixtures__/nodes.ts
@@ -199,6 +199,11 @@ export class Nodes {
}
}
+ public async edit(args: { name: string }) {
+ await this.get({ name: args.name }).hover();
+ await this.get({ name: args.name }).getByText("Edit").click();
+ }
+
public async selectLabel(args: { name: string }) {
return this.get({ name: args.name }).locator("span", { hasText: args.name
}).dblclick();
}
diff --git a/packages/dmn-editor/tests-e2e/__fixtures__/editor.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/beePropertiesPanelBase.ts
similarity index 70%
copy from packages/dmn-editor/tests-e2e/__fixtures__/editor.ts
copy to
packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/beePropertiesPanelBase.ts
index 66306d19b16..53584cc26aa 100644
--- a/packages/dmn-editor/tests-e2e/__fixtures__/editor.ts
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/beePropertiesPanelBase.ts
@@ -18,14 +18,18 @@
*/
import { Page } from "@playwright/test";
+import { Diagram } from "../../diagram";
+import { PropertiesPanelBase } from "../propertiesPanelBase";
-export class Editor {
+export class BeePropertiesPanelBase extends PropertiesPanelBase {
constructor(
- public page: Page,
- public baseURL?: string
- ) {}
+ public diagram: Diagram,
+ public page: Page
+ ) {
+ super(diagram, page);
+ }
- public async open() {
- await
this.page.goto(`${this.baseURL}/iframe.html?args=&id=misc-empty--empty&viewMode=story`);
+ public panel() {
+ return
this.page.getByTestId("kie-tools--dmn-editor--bee-properties-panel-container");
}
}
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableInputHeaderPropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableInputHeaderPropertiesPanel.ts
new file mode 100644
index 00000000000..ef81f3eed1d
--- /dev/null
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableInputHeaderPropertiesPanel.ts
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 { expect, Page } from "@playwright/test";
+import { Diagram } from "../../diagram";
+import { DataTypeProperties } from "../parts/dataTypeProperties";
+import { ConstraintType, DataType, RangeConstraintPosition } from
"../../dataTypes";
+import { NameProperties } from "../parts/nameProperties";
+import { BeePropertiesPanelBase } from "./beePropertiesPanelBase";
+
+export class DecisionTableInputHeaderPropertiesPanel extends
BeePropertiesPanelBase {
+ private nameProperties: NameProperties;
+ private dataTypeProperties: DataTypeProperties;
+
+ constructor(
+ public diagram: Diagram,
+ public page: Page
+ ) {
+ super(diagram, page);
+ this.nameProperties = new NameProperties(this.panel(), page);
+ this.dataTypeProperties = new DataTypeProperties(this.panel(), page);
+ }
+
+ public async setName(args: { newName: string }) {
+ await this.nameProperties.setName({ ...args });
+ }
+
+ public async setDataType(args: { newDataType: DataType }) {
+ await this.dataTypeProperties.setDataType({ ...args });
+ }
+
+ public async setCustomDataType(args: { newDataType: string }) {
+ await this.dataTypeProperties.setCustomDataType({ ...args });
+ }
+
+ public getDataType() {
+ return this.dataTypeProperties.getDataType();
+ }
+
+ public getConstraintSection() {
+ return this.dataTypeProperties.getConstraintSection();
+ }
+
+ public getConstraintButton(args: { type: ConstraintType }) {
+ return this.dataTypeProperties.getConstraintButton({ ...args });
+ }
+
+ public async expectConstraintButtonsToBeDisabled() {
+ await expect(this.getConstraintButton({ type: ConstraintType.NONE
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.ENUMERATION
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.EXPRESSION
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.RANGE
})).toBeDisabled();
+ }
+
+ public getEnumerationValueAt(element: number) {
+ return this.dataTypeProperties.getEnumerationElementAt(element);
+ }
+
+ public getExpressionConstraintValue() {
+ return this.dataTypeProperties.getExpressionConstraintValue();
+ }
+
+ public getNoneConstraint() {
+ return this.dataTypeProperties.getNoneConstraint();
+ }
+
+ public getRangeConstraintValueAt(position: RangeConstraintPosition) {
+ return this.dataTypeProperties.getRangeConstraintValue(position);
+ }
+}
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableInputRulePropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableInputRulePropertiesPanel.ts
new file mode 100644
index 00000000000..0a5e023edef
--- /dev/null
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableInputRulePropertiesPanel.ts
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 { expect, Page } from "@playwright/test";
+import { Diagram } from "../../diagram";
+import { DataTypeProperties } from "../parts/dataTypeProperties";
+import { ConstraintType, RangeConstraintPosition } from "../../dataTypes";
+import { NameProperties } from "../parts/nameProperties";
+import { BeePropertiesPanelBase } from "./beePropertiesPanelBase";
+
+export class DecisionTableInputRulePropertiesPanel extends
BeePropertiesPanelBase {
+ private dataTypeProperties: DataTypeProperties;
+
+ constructor(
+ public diagram: Diagram,
+ public page: Page
+ ) {
+ super(diagram, page);
+ this.dataTypeProperties = new DataTypeProperties(this.panel(), page);
+ }
+
+ public getDataType() {
+ return this.dataTypeProperties.getDataType();
+ }
+
+ public getConstraintSection() {
+ return this.dataTypeProperties.getConstraintSection();
+ }
+
+ public getConstraintButton(args: { type: ConstraintType }) {
+ return this.dataTypeProperties.getConstraintButton({ ...args });
+ }
+
+ public async expectConstraintButtonsToBeDisabled() {
+ await expect(this.getConstraintButton({ type: ConstraintType.NONE
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.ENUMERATION
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.EXPRESSION
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.RANGE
})).toBeDisabled();
+ }
+
+ public getEnumerationValueAt(element: number) {
+ return this.dataTypeProperties.getEnumerationElementAt(element);
+ }
+
+ public getExpressionConstraintValue() {
+ return this.dataTypeProperties.getExpressionConstraintValue();
+ }
+
+ public getNoneConstraint() {
+ return this.dataTypeProperties.getNoneConstraint();
+ }
+
+ public getRangeConstraintValueAt(position: RangeConstraintPosition) {
+ return this.dataTypeProperties.getRangeConstraintValue(position);
+ }
+}
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableOutputHeaderPropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableOutputHeaderPropertiesPanel.ts
new file mode 100644
index 00000000000..62e070b9e9a
--- /dev/null
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableOutputHeaderPropertiesPanel.ts
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 { expect, Page } from "@playwright/test";
+import { Diagram } from "../../diagram";
+import { DataTypeProperties } from "../parts/dataTypeProperties";
+import { ConstraintType, DataType, RangeConstraintPosition } from
"../../dataTypes";
+import { NameProperties } from "../parts/nameProperties";
+import { BeePropertiesPanelBase } from "./beePropertiesPanelBase";
+
+export class DecisionTableOutputHeaderPropertiesPanel extends
BeePropertiesPanelBase {
+ private nameProperties: NameProperties;
+ private dataTypeProperties: DataTypeProperties;
+
+ constructor(
+ public diagram: Diagram,
+ public page: Page
+ ) {
+ super(diagram, page);
+ this.nameProperties = new NameProperties(this.panel(), page);
+ this.dataTypeProperties = new DataTypeProperties(this.panel(), page);
+ }
+
+ public async setExpressionName(args: { newName: string }) {
+ await this.panel().getByPlaceholder("Enter a
name...").nth(0).fill(args.newName);
+ await this.page.keyboard.press("Enter");
+ }
+
+ public async setColumnName(args: { newName: string }) {
+ await this.panel().getByPlaceholder("Enter a
name...").nth(1).fill(args.newName);
+ await this.page.keyboard.press("Enter");
+ }
+
+ public async setName(args: { newName: string }) {
+ await this.nameProperties.setName({ ...args });
+ }
+
+ public async setExpressionDataType(args: { newDataType: DataType }) {
+ await this.panel().getByPlaceholder("Select a data
type...").nth(0).click();
+ await this.panel().getByPlaceholder("Select a data
type...").nth(0).press("ControlOrMeta+a");
+ await this.panel().getByPlaceholder("Select a data
type...").nth(0).fill(args.newDataType);
+ await this.page.getByRole("option").getByText(args.newDataType, { exact:
true }).click();
+ }
+
+ public async setExpressionCustomDataType(args: { newDataType: string }) {
+ await this.panel().getByPlaceholder("Select a data
type...").nth(0).click();
+ await this.panel().getByPlaceholder("Select a data
type...").nth(0).press("ControlOrMeta+a");
+ await this.panel().getByPlaceholder("Select a data
type...").nth(0).fill(args.newDataType);
+ await this.page.getByRole("option").getByText(args.newDataType).click();
+ }
+
+ public async setColumnDataType(args: { newDataType: DataType }) {
+ await this.panel().getByPlaceholder("Select a data
type...").nth(1).click();
+ await this.panel().getByPlaceholder("Select a data
type...").nth(1).press("ControlOrMeta+a");
+ await this.panel().getByPlaceholder("Select a data
type...").nth(1).fill(args.newDataType);
+ await this.page.getByRole("option").getByText(args.newDataType, { exact:
true }).click();
+ }
+
+ public async setDataType(args: { newDataType: DataType }) {
+ await this.dataTypeProperties.setDataType({ ...args });
+ }
+
+ public async setCustomDataType(args: { newDataType: string }) {
+ await this.dataTypeProperties.setCustomDataType({ ...args });
+ }
+
+ public getExpressionDataType() {
+ return this.page.getByPlaceholder("Select a data type...").nth(0);
+ }
+
+ public getColumnDataType() {
+ return this.page.getByPlaceholder("Select a data type...").nth(1);
+ }
+
+ public getDataType() {
+ return this.page.getByPlaceholder("Select a data type...");
+ }
+
+ public getConstraintSection() {
+ return this.dataTypeProperties.getConstraintSection();
+ }
+
+ public getConstraintButton(args: { type: ConstraintType }) {
+ return this.dataTypeProperties.getConstraintButton({ ...args });
+ }
+
+ public async expectConstraintButtonsToBeDisabled() {
+ await expect(this.getConstraintButton({ type: ConstraintType.NONE
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.ENUMERATION
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.EXPRESSION
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.RANGE
})).toBeDisabled();
+ }
+
+ public getEnumerationValueAt(element: number) {
+ return this.dataTypeProperties.getEnumerationElementAt(element);
+ }
+
+ public getExpressionConstraintValue() {
+ return this.dataTypeProperties.getExpressionConstraintValue();
+ }
+
+ public getNoneConstraint() {
+ return this.dataTypeProperties.getNoneConstraint();
+ }
+
+ public getRangeConstraintValueAt(position: RangeConstraintPosition) {
+ return this.dataTypeProperties.getRangeConstraintValue(position);
+ }
+}
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableOutputRulePropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableOutputRulePropertiesPanel.ts
new file mode 100644
index 00000000000..3c5838f79fc
--- /dev/null
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bee/decisionTableOutputRulePropertiesPanel.ts
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 { expect, Page } from "@playwright/test";
+import { Diagram } from "../../diagram";
+import { DataTypeProperties } from "../parts/dataTypeProperties";
+import { BeePropertiesPanelBase } from "./beePropertiesPanelBase";
+import { ConstraintType, RangeConstraintPosition } from "../../dataTypes";
+
+export class DecisionTableOutputRulePropertiesPanel extends
BeePropertiesPanelBase {
+ private dataTypeProperties: DataTypeProperties;
+
+ constructor(
+ public diagram: Diagram,
+ public page: Page
+ ) {
+ super(diagram, page);
+ this.dataTypeProperties = new DataTypeProperties(this.panel(), page);
+ }
+
+ public getDataType() {
+ return this.dataTypeProperties.getDataType();
+ }
+
+ public getConstraintSection() {
+ return this.dataTypeProperties.getConstraintSection();
+ }
+
+ public getConstraintButton(args: { type: ConstraintType }) {
+ return this.dataTypeProperties.getConstraintButton({ ...args });
+ }
+
+ public async expectConstraintButtonsToBeDisabled() {
+ await expect(this.getConstraintButton({ type: ConstraintType.NONE
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.ENUMERATION
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.EXPRESSION
})).toBeDisabled();
+ await expect(this.getConstraintButton({ type: ConstraintType.RANGE
})).toBeDisabled();
+ }
+
+ public getEnumerationValueAt(element: number) {
+ return this.dataTypeProperties.getEnumerationElementAt(element);
+ }
+
+ public getExpressionConstraintValue() {
+ return this.dataTypeProperties.getExpressionConstraintValue();
+ }
+
+ public getNoneConstraint() {
+ return this.dataTypeProperties.getNoneConstraint();
+ }
+
+ public getRangeConstraintValueAt(position: RangeConstraintPosition) {
+ return this.dataTypeProperties.getRangeConstraintValue(position);
+ }
+}
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/beePropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/beePropertiesPanel.ts
new file mode 100644
index 00000000000..aab15d21ba5
--- /dev/null
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/beePropertiesPanel.ts
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 { Page } from "@playwright/test";
+import { DecisionTableInputHeaderPropertiesPanel } from
"./bee/decisionTableInputHeaderPropertiesPanel";
+import { DecisionTableInputRulePropertiesPanel } from
"./bee/decisionTableInputRulePropertiesPanel";
+import { DecisionTableOutputHeaderPropertiesPanel } from
"./bee/decisionTableOutputHeaderPropertiesPanel";
+import { DecisionTableOutputRulePropertiesPanel } from
"./bee/decisionTableOutputRulePropertiesPanel";
+import { Diagram } from "../diagram";
+
+export class BeePropertiesPanel {
+ public decisionTableInputHeader: DecisionTableInputHeaderPropertiesPanel;
+ public decisionTableInputRule: DecisionTableInputRulePropertiesPanel;
+ public decisionTableOutputHeader: DecisionTableOutputHeaderPropertiesPanel;
+ public decisionTableOutputRule: DecisionTableOutputRulePropertiesPanel;
+
+ constructor(
+ public diagram: Diagram,
+ public page: Page,
+ public baseURL?: string
+ ) {
+ this.decisionTableInputHeader = new
DecisionTableInputHeaderPropertiesPanel(diagram, page);
+ this.decisionTableInputRule = new
DecisionTableInputRulePropertiesPanel(diagram, page);
+ this.decisionTableOutputHeader = new
DecisionTableOutputHeaderPropertiesPanel(diagram, page);
+ this.decisionTableOutputRule = new
DecisionTableOutputRulePropertiesPanel(diagram, page);
+ }
+
+ public async open() {
+ await this.page.getByTitle("Properties panel").click();
+ }
+}
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bkmPropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bkmPropertiesPanel.ts
index a7b02f15ca8..ea9cc6a02cc 100644
---
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bkmPropertiesPanel.ts
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/bkmPropertiesPanel.ts
@@ -25,7 +25,7 @@ import { FontProperties } from "./parts/fontProperties";
import { DocumentationProperties } from "./parts/documentationProperties";
import { DescriptionProperties } from "./parts/descriptionProperties";
import { DataTypeProperties } from "./parts/dataTypeProperties";
-import { DataType } from "../jsonModel";
+import { DataType } from "../dataTypes";
import { NameProperties } from "./parts/nameProperties";
export class BkmPropertiesPanel extends PropertiesPanelBase {
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/decisionPropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/decisionPropertiesPanel.ts
index ce34f8cfbba..6cff539d82d 100644
---
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/decisionPropertiesPanel.ts
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/decisionPropertiesPanel.ts
@@ -25,7 +25,7 @@ import { FontProperties } from "./parts/fontProperties";
import { DocumentationProperties } from "./parts/documentationProperties";
import { DescriptionProperties } from "./parts/descriptionProperties";
import { DataTypeProperties } from "./parts/dataTypeProperties";
-import { DataType } from "../jsonModel";
+import { DataType } from "../dataTypes";
import { NameProperties } from "./parts/nameProperties";
export class DecisionPropertiesPanel extends PropertiesPanelBase {
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/decisionServicePropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/decisionServicePropertiesPanel.ts
index 6475f6cd740..084ce1fb23f 100644
---
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/decisionServicePropertiesPanel.ts
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/decisionServicePropertiesPanel.ts
@@ -24,7 +24,7 @@ import { PropertiesPanelBase } from "./propertiesPanelBase";
import { FontProperties } from "./parts/fontProperties";
import { DocumentationProperties } from "./parts/documentationProperties";
import { DescriptionProperties } from "./parts/descriptionProperties";
-import { DataType } from "../jsonModel";
+import { DataType } from "../dataTypes";
import { DataTypeProperties } from "./parts/dataTypeProperties";
import { NameProperties } from "./parts/nameProperties";
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/inputDataPropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/inputDataPropertiesPanel.ts
index 8c01ff2d370..b64d4217330 100644
---
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/inputDataPropertiesPanel.ts
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/inputDataPropertiesPanel.ts
@@ -24,7 +24,7 @@ import { PropertiesPanelBase } from "./propertiesPanelBase";
import { FontProperties } from "./parts/fontProperties";
import { DocumentationProperties } from "./parts/documentationProperties";
import { DescriptionProperties } from "./parts/descriptionProperties";
-import { DataType } from "../jsonModel";
+import { DataType } from "../dataTypes";
import { DataTypeProperties } from "./parts/dataTypeProperties";
import { NameProperties } from "./parts/nameProperties";
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/knowledgeSourcePropertiesPanel.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/knowledgeSourcePropertiesPanel.ts
index 7d8ea722f0d..5e6ea34c043 100644
---
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/knowledgeSourcePropertiesPanel.ts
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/knowledgeSourcePropertiesPanel.ts
@@ -19,7 +19,7 @@
import { Page } from "@playwright/test";
import { Diagram } from "../diagram";
-import { DataType } from "../jsonModel";
+import { DataType } from "../dataTypes";
import { ShapeProperties } from "./parts/shapeProperties";
import { PropertiesPanelBase } from "./propertiesPanelBase";
import { FontProperties } from "./parts/fontProperties";
diff --git
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/parts/dataTypeProperties.ts
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/parts/dataTypeProperties.ts
index 0f785cb713f..8d90c61b839 100644
---
a/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/parts/dataTypeProperties.ts
+++
b/packages/dmn-editor/tests-e2e/__fixtures__/propertiesPanel/parts/dataTypeProperties.ts
@@ -18,7 +18,7 @@
*/
import { Locator, Page } from "@playwright/test";
-import { DataType } from "../../jsonModel";
+import { ConstraintType, DataType, RangeConstraintPosition } from
"../../dataTypes";
export class DataTypeProperties {
constructor(
@@ -28,6 +28,47 @@ export class DataTypeProperties {
public async setDataType(args: { newDataType: DataType }) {
await this.panel.getByPlaceholder("Select a data type...").click();
+ await this.panel.getByPlaceholder("Select a data
type...").press("ControlOrMeta+a");
+ await this.panel.getByPlaceholder("Select a data
type...").fill(args.newDataType);
await this.page.getByRole("option").getByText(args.newDataType, { exact:
true }).click();
}
+
+ public async setCustomDataType(args: { newDataType: string }) {
+ await this.panel.getByPlaceholder("Select a data type...").click();
+ await this.panel.getByPlaceholder("Select a data
type...").press("ControlOrMeta+a");
+ await this.panel.getByPlaceholder("Select a data
type...").fill(args.newDataType);
+ await this.page.getByRole("option").getByText(`${args.newDataType} `, {
exact: false }).click();
+ }
+
+ public getDataType() {
+ return this.panel.getByPlaceholder("Select a data type...");
+ }
+
+ public getConstraintSection() {
+ return this.panel.getByText("Constraint");
+ }
+
+ public getConstraintButton(args: { type: ConstraintType }) {
+ return this.panel.getByRole("button", { name: args.type, exact: true });
+ }
+
+ public getNoneConstraint() {
+ return this.panel.getByText("All values are allowed");
+ }
+
+ public getEnumerationElementAt(element: number) {
+ return
this.panel.getByTestId(`kie-tools--dmn-editor--draggable-row-${element}`).locator("input");
+ }
+
+ public getExpressionConstraintValue() {
+ return
this.panel.getByTestId("kie-tools--dmn-editor--readonly-expression-constraint-with-value");
+ }
+
+ public getRangeConstraintValue(position: RangeConstraintPosition) {
+ if (position === RangeConstraintPosition.START) {
+ return
this.panel.getByTestId("kie-tools--dmn-editor--range-constraint-start-value").locator("input");
+ } else {
+ return
this.panel.getByTestId("kie-tools--dmn-editor--range-constraint-end-value").locator("input");
+ }
+ }
}
diff --git
a/packages/dmn-editor/tests-e2e/checkDecisionTableCellsDataType.spec.ts
b/packages/dmn-editor/tests-e2e/checkDecisionTableCellsDataType.spec.ts
new file mode 100644
index 00000000000..570d86334b9
--- /dev/null
+++ b/packages/dmn-editor/tests-e2e/checkDecisionTableCellsDataType.spec.ts
@@ -0,0 +1,1045 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 { test, expect } from "./__fixtures__/base";
+import { DataType, RangeConstraintPosition } from "./__fixtures__/dataTypes";
+import { TabName } from "./__fixtures__/editor";
+import { DefaultNodeName, NodeType } from "./__fixtures__/nodes";
+
+test.describe("Decision Table - Cells Data Type", () => {
+ test.describe("Decision Table - Cells Data Type - Merged expression header
and output column", () => {
+ test.beforeEach(async ({ editor, palette, nodes }) => {
+ await editor.open();
+
+ await palette.dragNewNode({ type: NodeType.DECISION, targetPosition: {
x: 100, y: 100 } });
+ await nodes.edit({ name: DefaultNodeName.DECISION });
+ });
+
+ test("Decision table output column type should match the expression header
type and be in readonly mode - built-in type", async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionDataType({
+ newDataType: DataType.DateTimeDuration,
+ });
+
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(
+ DataType.DateTimeDuration
+ );
+ });
+
+ test("Decision table output column type should match the expression header
type and be in readonly mode - custom type", async ({
+ editor,
+ dataTypes,
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await editor.changeTab({ tab: TabName.DATA_TYPES });
+ await dataTypes.createFirstCustonDataType();
+ await dataTypes.changeDataTypeName({ newName: "testType" });
+ await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.String });
+ await editor.changeTab({ tab: TabName.EDITOR });
+
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
newDataType: "testType" });
+
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^testType\s$/i);
+ });
+
+ test("Decision table output column with different type than expression
header shouldn't be in readonly mode", async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+
+ // Setup a decision table with expression header and output column with
two different types.
+ // First create a decision table with two output columns, change the
type of one and delete the other.
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().addOutputAtStart();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setDataType({
newDataType: DataType.Number });
+ await bee.expression.asDecisionTable().outputHeaderAt(2).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setDataType({
newDataType: DataType.Boolean });
+ await
bee.expression.asDecisionTable().outputHeaderAt(1).contextMenu.open();
+ await
bee.expression.asDecisionTable().outputHeaderAt(1).contextMenu.option("Delete").click();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toBeEnabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(DataType.Number);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(DataType.Boolean);
+ });
+
+ test("Decision table fix output column with different type than expression
header", async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+
+ // Setup a decision table with expression header and output column with
two different types.
+ // First create a decision table with two output columns, change the
type of one and delete the other.
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().addOutputAtStart();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setDataType({
newDataType: DataType.Number });
+ await bee.expression.asDecisionTable().outputHeaderAt(2).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setDataType({
newDataType: DataType.Boolean });
+ await
bee.expression.asDecisionTable().outputHeaderAt(1).contextMenu.open();
+ await
bee.expression.asDecisionTable().outputHeaderAt(1).contextMenu.option("Delete").click();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toBeEnabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(DataType.Number);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(DataType.Boolean);
+
+ await beePropertiesPanel.decisionTableOutputHeader.setColumnDataType({
newDataType: DataType.Number });
+
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(DataType.Number);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(DataType.Number);
+ });
+ });
+});
+test.describe("Decision Table - Cells Data Type - Constraint", () => {
+ test.beforeEach(async ({ editor, palette, nodes }) => {
+ await editor.open();
+
+ await palette.dragNewNode({ type: NodeType.DECISION, targetPosition: { x:
100, y: 100 } });
+ await nodes.edit({ name: DefaultNodeName.DECISION });
+ });
+
+ test.describe("Decision Table - Cells Data Type - Constraint - built-in data
type", () => {
+ const dataTypes: DataType[] = [
+ DataType.Any,
+ DataType.Boolean,
+ DataType.Context,
+ DataType.Date,
+ DataType.DateTime,
+ DataType.DateTimeDuration,
+ DataType.Number,
+ DataType.String,
+ DataType.Time,
+ DataType.Undefined,
+ DataType.YearsMonthsDuration,
+ ];
+
+ for (const dataType of dataTypes) {
+ test(`Decision Table input header properties panel shouldn't contain
constraint - '${dataType}' data type`, async ({
+ beePropertiesPanel,
+ bee,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setDataType({
newDataType: dataType });
+
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(`${dataType}`);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).not.toBeAttached();
+ });
+
+ test(`Decision Table input rule properties panel shouldn't contain
constraint - '${dataType}' data type`, async ({
+ beePropertiesPanel,
+ bee,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setDataType({
newDataType: dataType });
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(`${dataType}`);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).not.toBeAttached();
+ });
+
+ test(`Decision Table output header properties panel shouldn't contain
constraint - '${dataType}' data type`, async ({
+ beePropertiesPanel,
+ bee,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionDataType({
newDataType: dataType });
+
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(`${dataType}`);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(`${dataType}`);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).not.toBeAttached();
+ });
+
+ test(`Decision Table output header with nested columns properties panel
shouldn't contain constraint - '${dataType}' data type`, async ({
+ beePropertiesPanel,
+ bee,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().addOutputAtStart();
+
+ await
bee.expression.asDecisionTable().expressionHeaderCell.content.click();
+ await beePropertiesPanel.decisionTableOutputHeader.setDataType({
newDataType: dataType });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getDataType()).toHaveValue(`${dataType}`);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).not.toBeAttached();
+
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setDataType({
newDataType: dataType });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getDataType()).toHaveValue(`${dataType}`);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).not.toBeAttached();
+
+ await bee.expression.asDecisionTable().outputHeaderAt(1).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setDataType({
newDataType: dataType });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getDataType()).toHaveValue(`${dataType}`);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).not.toBeAttached();
+ });
+
+ test(`Decision Table output rule properties panel shouldn't contain
constraint - '${dataType}' data type`, async ({
+ beePropertiesPanel,
+ bee,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionDataType({
newDataType: dataType });
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(`${dataType}`);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).not.toBeAttached();
+ });
+ }
+ });
+
+ test.describe("Decision Table - Cells Data Type - Constraint - With custom
data types", () => {
+ test.beforeEach("create custom data types", async ({ editor, dataTypes })
=> {
+ // create string data type with enum constraint;
+ await editor.changeTab({ tab: TabName.DATA_TYPES });
+ await dataTypes.createFirstCustonDataType();
+ await dataTypes.changeDataTypeName({ newName: "enumType" });
+ await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.String });
+ await dataTypes.getEnumerationConstraintButton().click();
+ await dataTypes.addEnumerationConstraint({ values: ["foo", "bar", "baz"]
});
+
+ // create number data type with range constraint;
+ await dataTypes.createNewDataType();
+ await dataTypes.changeDataTypeName({ newName: "rangeType" });
+ await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Number });
+ await dataTypes.getRangeConstraintButton().click();
+ await dataTypes.addRangeConstraint({ values: ["10", "200"] });
+
+ // create number data type with expression constraint;
+ await dataTypes.createNewDataType();
+ await dataTypes.changeDataTypeName({ newName: "expressionType" });
+ await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Number });
+ await dataTypes.getExpressionConstraintButton().click();
+ await dataTypes.addExpressionConstraint({ value: "> 20" });
+
+ // create date data type without constraint;
+ await dataTypes.createNewDataType();
+ await dataTypes.changeDataTypeName({ newName: "noneType" });
+ await dataTypes.changeDataTypeBaseType({ newBaseType: DataType.Date });
+
+ await editor.changeTab({ tab: TabName.EDITOR });
+ });
+
+ test.describe("Decision Table input column", () => {
+ test(`Decision Table input header and rule properties panel should
contain constraint - enum`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "enumType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(2)).toHaveValue("baz");
+ });
+
+ test(`Decision Table input header and rule properties panel should
contain constraint - enum edited`, async ({
+ bee,
+ beePropertiesPanel,
+ editor,
+ dataTypes,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "enumType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await editor.changeTab({ tab: TabName.DATA_TYPES });
+ await dataTypes.selectDataType({ name: "enumType" });
+ await dataTypes.addEnumerationConstraint({ values: ["qux"] });
+
+ await editor.changeTab({ tab: TabName.EDITOR });
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(2)).toHaveValue("baz");
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(3)).toHaveValue("qux");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(2)).toHaveValue("baz");
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(3)).toHaveValue("qux");
+ });
+
+ test(`Decision Table input header and rule properties panel should
contain constraint - range`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "rangeType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+
+ await expect(
+
beePropertiesPanel.decisionTableInputHeader.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableInputHeader.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableInputRule.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableInputRule.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+ });
+
+ test(`Decision Table input header and rule properties panel should
contain constraint - range edited`, async ({
+ bee,
+ beePropertiesPanel,
+ editor,
+ dataTypes,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "rangeType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableInputHeader.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableInputHeader.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await editor.changeTab({ tab: TabName.DATA_TYPES });
+ await dataTypes.selectDataType({ name: "rangeType" });
+ await dataTypes.changeRangeStartConstraint("20");
+
+ await editor.changeTab({ tab: TabName.EDITOR });
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableInputHeader.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("20");
+ await expect(
+
beePropertiesPanel.decisionTableInputHeader.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableInputRule.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("20");
+ await expect(
+
beePropertiesPanel.decisionTableInputRule.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+ });
+
+ test(`Decision Table input header and rule properties panel should
contain constraint - expression`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "expressionType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getExpressionConstraintValue()).toHaveText(">
20");
+ });
+
+ test(`Decision Table input header and rule properties panel should
contain constraint - expression edited`, async ({
+ bee,
+ beePropertiesPanel,
+ editor,
+ dataTypes,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "expressionType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await editor.changeTab({ tab: TabName.DATA_TYPES });
+ await dataTypes.selectDataType({ name: "expressionType" });
+ await dataTypes.addExpressionConstraint({ value: "< 30" });
+
+ await editor.changeTab({ tab: TabName.EDITOR });
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getExpressionConstraintValue()).toHaveText("<
30");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getExpressionConstraintValue()).toHaveText("<
30");
+ });
+
+ test(`Decision Table input header and rule properties panel shouldn't
contain constraint`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "noneType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getNoneConstraint()).toBeAttached();
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getNoneConstraint()).toBeAttached();
+ });
+
+ test(`Decision Table input header and rule properties panel should
contain constraint - change between types`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "enumType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableInputRule.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "rangeType" });
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableInputHeader.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableInputHeader.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableInputRule.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableInputRule.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "expressionType" });
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await bee.expression.asDecisionTable().inputHeaderAt(0).select();
+ await beePropertiesPanel.decisionTableInputHeader.setCustomDataType({
newDataType: "noneType" });
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputHeader.getNoneConstraint()).toBeAttached();
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 1
}).select();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableInputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableInputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableInputRule.getNoneConstraint()).toBeAttached();
+ });
+ });
+
+ test.describe("Decision Table output column", () => {
+ test(`Decision Table output header and rule properties panel should
contain constraint - enum`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
newDataType: "enumType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*enumType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(2)).toHaveValue("baz");
+ });
+
+ test(`Decision Table output header and rule properties panel should
contain constraint - enum edited`, async ({
+ bee,
+ beePropertiesPanel,
+ editor,
+ dataTypes,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
newDataType: "enumType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*enumType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await editor.changeTab({ tab: TabName.DATA_TYPES });
+ await dataTypes.selectDataType({ name: "enumType" });
+ await dataTypes.addEnumerationConstraint({ values: ["qux"] });
+
+ await editor.changeTab({ tab: TabName.EDITOR });
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*enumType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(2)).toHaveValue("baz");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(3)).toHaveValue("qux");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(2)).toHaveValue("baz");
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(3)).toHaveValue("qux");
+ });
+
+ test(`Decision Table output header and rule properties panel should
contain constraint - range`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
newDataType: "rangeType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*rangeType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableOutputRule.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableOutputRule.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+ });
+
+ test(`Decision Table output header and rule properties panel should
contain constraint - range edited`, async ({
+ bee,
+ beePropertiesPanel,
+ editor,
+ dataTypes,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
newDataType: "rangeType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*rangeType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await editor.changeTab({ tab: TabName.DATA_TYPES });
+ await dataTypes.selectDataType({ name: "rangeType" });
+ await dataTypes.changeRangeStartConstraint("20");
+
+ await editor.changeTab({ tab: TabName.EDITOR });
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*rangeType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("20");
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableOutputRule.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("20");
+ await expect(
+
beePropertiesPanel.decisionTableOutputRule.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+ });
+
+ test(`Decision Table output header and rule properties panel should
contain constraint - expression`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
+ newDataType: "expressionType",
+ });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*expressionType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(
+ /^\s*expressionType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getExpressionConstraintValue()).toHaveText(">
20");
+ });
+
+ test(`Decision Table output header and rule properties panel should
contain constraint - expression edited`, async ({
+ bee,
+ beePropertiesPanel,
+ editor,
+ dataTypes,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
+ newDataType: "expressionType",
+ });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*expressionType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(
+ /^\s*expressionType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await editor.changeTab({ tab: TabName.DATA_TYPES });
+ await dataTypes.selectDataType({ name: "expressionType" });
+ await dataTypes.addExpressionConstraint({ value: "< 30" });
+
+ await editor.changeTab({ tab: TabName.EDITOR });
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*expressionType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(
+ /^\s*expressionType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionConstraintValue()).toHaveText("<
30");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getExpressionConstraintValue()).toHaveText("<
30");
+ });
+
+ test(`Decision Table output header and rule properties panel shouldn't
contain constraint`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
newDataType: "noneType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*noneType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getNoneConstraint()).toBeAttached();
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getNoneConstraint()).toBeAttached();
+ });
+
+ test(`Decision Table output header and rule properties panel should
contain constraint - change between types`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
newDataType: "enumType" });
+
+ // Using RegExp matcher as it will check for characters as well.
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*enumType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
newDataType: "rangeType" });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*rangeType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableOutputRule.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableOutputRule.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
+ newDataType: "expressionType",
+ });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*expressionType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(
+ /^\s*expressionType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await bee.expression.asDecisionTable().outputHeaderAt(0).select();
+ await
beePropertiesPanel.decisionTableOutputHeader.setExpressionCustomDataType({
newDataType: "noneType" });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionDataType()).toHaveValue(
+ /^\s*noneType\s$/i
+ );
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getColumnDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getNoneConstraint()).toBeAttached();
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getNoneConstraint()).toBeAttached();
+ });
+ });
+
+ test.describe("Decision Table output header with nested columns", () => {
+ test(`Decision Table output header and rule with nested columns
properties panel should contain constraint - each column with a type`, async ({
+ bee,
+ beePropertiesPanel,
+ }) => {
+ await beePropertiesPanel.open();
+ await bee.selectExpressionMenu.selectDecisionTable();
+ await bee.expression.asDecisionTable().addOutputAtStart();
+ await bee.expression.asDecisionTable().addOutputAtStart();
+ await bee.expression.asDecisionTable().addOutputAtStart();
+
+ await bee.expression.asDecisionTable().expressionHeaderCell.select();
+ await beePropertiesPanel.decisionTableOutputHeader.setCustomDataType({
newDataType: "enumType" });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).not.toBeAttached();
+
+ await bee.expression.asDecisionTable().outputHeaderAt(4).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setCustomDataType({
newDataType: "enumType" });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 5
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*enumType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(0)).toHaveValue("foo");
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(1)).toHaveValue("bar");
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getEnumerationValueAt(2)).toHaveValue("baz");
+
+ await bee.expression.asDecisionTable().outputHeaderAt(3).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setCustomDataType({
newDataType: "rangeType" });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableOutputHeader.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 4
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*rangeType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await expect(
+
beePropertiesPanel.decisionTableOutputRule.getRangeConstraintValueAt(RangeConstraintPosition.START)
+ ).toHaveValue("10");
+ await expect(
+
beePropertiesPanel.decisionTableOutputRule.getRangeConstraintValueAt(RangeConstraintPosition.END)
+ ).toHaveValue("200");
+
+ await bee.expression.asDecisionTable().outputHeaderAt(2).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setCustomDataType({
newDataType: "expressionType" });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 3
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*expressionType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getExpressionConstraintValue()).toHaveText(">
20");
+
+ await bee.expression.asDecisionTable().outputHeaderAt(1).select();
+ await beePropertiesPanel.decisionTableOutputHeader.setCustomDataType({
newDataType: "noneType" });
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputHeader.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputHeader.getNoneConstraint()).toBeAttached();
+
+ await bee.expression.asDecisionTable().cellAt({ row: 1, column: 2
}).select();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toHaveValue(/^\s*noneType\s$/i);
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getDataType()).toBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getConstraintSection()).toBeAttached();
+ await
beePropertiesPanel.decisionTableOutputRule.expectConstraintButtonsToBeDisabled();
+ await
expect(beePropertiesPanel.decisionTableOutputRule.getNoneConstraint()).toBeAttached();
+ });
+ });
+ });
+});
diff --git a/packages/dmn-editor/tests-e2e/drgElements/addBkm.spec.ts
b/packages/dmn-editor/tests-e2e/drgElements/addBkm.spec.ts
index 4b2eab15766..82f855262f0 100644
--- a/packages/dmn-editor/tests-e2e/drgElements/addBkm.spec.ts
+++ b/packages/dmn-editor/tests-e2e/drgElements/addBkm.spec.ts
@@ -19,7 +19,6 @@
import { test, expect } from "../__fixtures__/base";
import { EdgeType } from "../__fixtures__/edges";
-import { DataType } from "../__fixtures__/jsonModel";
import { DefaultNodeName, NodeType } from "../__fixtures__/nodes";
test.beforeEach(async ({ editor }) => {
diff --git a/packages/dmn-editor/tests-e2e/drgElements/addDecision.spec.ts
b/packages/dmn-editor/tests-e2e/drgElements/addDecision.spec.ts
index c9f835fc8d9..9134334c9cc 100644
--- a/packages/dmn-editor/tests-e2e/drgElements/addDecision.spec.ts
+++ b/packages/dmn-editor/tests-e2e/drgElements/addDecision.spec.ts
@@ -19,7 +19,6 @@
import { test, expect } from "../__fixtures__/base";
import { EdgeType } from "../__fixtures__/edges";
-import { DataType } from "../__fixtures__/jsonModel";
import { DefaultNodeName, NodeType } from "../__fixtures__/nodes";
test.beforeEach(async ({ editor }) => {
diff --git
a/packages/dmn-editor/tests-e2e/drgElements/addDecisionService.spec.ts
b/packages/dmn-editor/tests-e2e/drgElements/addDecisionService.spec.ts
index 58d8621ccb5..b89385ce237 100644
--- a/packages/dmn-editor/tests-e2e/drgElements/addDecisionService.spec.ts
+++ b/packages/dmn-editor/tests-e2e/drgElements/addDecisionService.spec.ts
@@ -18,7 +18,6 @@
*/
import { test, expect } from "../__fixtures__/base";
-import { DataType } from "../__fixtures__/jsonModel";
import { DefaultNodeName, NodeType } from "../__fixtures__/nodes";
test.beforeEach(async ({ editor }) => {
diff --git a/packages/dmn-editor/tests-e2e/drgElements/addInputData.spec.ts
b/packages/dmn-editor/tests-e2e/drgElements/addInputData.spec.ts
index 8d53eb2d2ac..e6204313cee 100644
--- a/packages/dmn-editor/tests-e2e/drgElements/addInputData.spec.ts
+++ b/packages/dmn-editor/tests-e2e/drgElements/addInputData.spec.ts
@@ -18,7 +18,6 @@
*/
import { test, expect } from "../__fixtures__/base";
-import { DataType } from "../__fixtures__/jsonModel";
import { DefaultNodeName, NodeType } from "../__fixtures__/nodes";
test.beforeEach(async ({ editor }) => {
diff --git
a/packages/dmn-editor/tests-e2e/drgElements/changeBkmProperties.spec.ts
b/packages/dmn-editor/tests-e2e/drgElements/changeBkmProperties.spec.ts
index db866f507d2..99aef5f81be 100644
--- a/packages/dmn-editor/tests-e2e/drgElements/changeBkmProperties.spec.ts
+++ b/packages/dmn-editor/tests-e2e/drgElements/changeBkmProperties.spec.ts
@@ -19,7 +19,7 @@
import { TestAnnotations } from "@kie-tools/playwright-base/annotations";
import { test, expect } from "../__fixtures__/base";
-import { DataType } from "../__fixtures__/jsonModel";
+import { DataType } from "../__fixtures__/dataTypes";
import { DefaultNodeName, NodeType } from "../__fixtures__/nodes";
test.beforeEach(async ({ editor }) => {
diff --git
a/packages/dmn-editor/tests-e2e/drgElements/changeDecisionProperties.spec.ts
b/packages/dmn-editor/tests-e2e/drgElements/changeDecisionProperties.spec.ts
index 6e0d665c618..20456b594fa 100644
--- a/packages/dmn-editor/tests-e2e/drgElements/changeDecisionProperties.spec.ts
+++ b/packages/dmn-editor/tests-e2e/drgElements/changeDecisionProperties.spec.ts
@@ -19,7 +19,7 @@
import { TestAnnotations } from "@kie-tools/playwright-base/annotations";
import { test, expect } from "../__fixtures__/base";
-import { DataType } from "../__fixtures__/jsonModel";
+import { DataType } from "../__fixtures__/dataTypes";
import { DefaultNodeName, NodeType } from "../__fixtures__/nodes";
test.beforeEach(async ({ editor }) => {
diff --git
a/packages/dmn-editor/tests-e2e/drgElements/changeDecisionServiceProperties.spec.ts
b/packages/dmn-editor/tests-e2e/drgElements/changeDecisionServiceProperties.spec.ts
index 6e463fe499f..b77e9636dc8 100644
---
a/packages/dmn-editor/tests-e2e/drgElements/changeDecisionServiceProperties.spec.ts
+++
b/packages/dmn-editor/tests-e2e/drgElements/changeDecisionServiceProperties.spec.ts
@@ -19,7 +19,7 @@
import { TestAnnotations } from "@kie-tools/playwright-base/annotations";
import { test, expect } from "../__fixtures__/base";
-import { DataType } from "../__fixtures__/jsonModel";
+import { DataType } from "../__fixtures__/dataTypes";
import { DefaultNodeName, NodePosition, NodeType } from
"../__fixtures__/nodes";
test.beforeEach(async ({ editor }) => {
diff --git
a/packages/dmn-editor/tests-e2e/drgElements/changeInputDataProperties.spec.ts
b/packages/dmn-editor/tests-e2e/drgElements/changeInputDataProperties.spec.ts
index 38830383375..153dd42596b 100644
---
a/packages/dmn-editor/tests-e2e/drgElements/changeInputDataProperties.spec.ts
+++
b/packages/dmn-editor/tests-e2e/drgElements/changeInputDataProperties.spec.ts
@@ -19,7 +19,7 @@
import { TestAnnotations } from "@kie-tools/playwright-base/annotations";
import { test, expect } from "../__fixtures__/base";
-import { DataType } from "../__fixtures__/jsonModel";
+import { DataType } from "../__fixtures__/dataTypes";
import { DefaultNodeName, NodeType } from "../__fixtures__/nodes";
test.beforeEach(async ({ editor }) => {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]