jomarko commented on code in PR #2211:
URL:
https://github.com/apache/incubator-kie-tools/pull/2211#discussion_r1540660222
##########
packages/dmn-editor/tests/e2e/__fixtures__/nodes.ts:
##########
@@ -173,6 +164,12 @@ export class Nodes {
return this.get({ name: args.name }).locator("span", { hasText: args.name
}).dblclick();
}
+ public async startDraggingEdge(args: { from: string; edgeType: EdgeType }) {
+ await this.select({ name: args.from, position: NodePosition.TOP });
+ await this.get({ name: args.from
}).getByTitle(this.getAddEdgeTitle(args.edgeType)).hover();
+ await this.page.mouse.down();
+ }
Review Comment:
```suggestion
/**
* Used for testing invalid edges. No edge is created using this method.
*/
public async startDraggingEdge(args: { from: string; edgeType: EdgeType })
{
await this.select({ name: args.from, position: NodePosition.TOP });
await this.get({ name: args.from
}).getByTitle(this.getAddEdgeTitle(args.edgeType)).hover();
await this.page.mouse.down();
}
```
##########
packages/dmn-editor/tests/e2e/__fixtures__/jsonModel/drgElements.ts:
##########
@@ -0,0 +1,387 @@
+/*
+ * 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 { DmnLatestModel } from "@kie-tools/dmn-marshaller";
+import {
+ DMN15__tBusinessKnowledgeModel,
+ DMN15__tDecision,
+ DMN15__tDecisionService,
+ DMN15__tDefinitions,
+ DMN15__tInputData,
+ DMN15__tKnowledgeSource,
+ DMNDI15__DMNDiagram,
+ DMNDI15__DMNShape,
+} from "@kie-tools/dmn-marshaller/dist/schemas/dmn-1_5/ts-gen/types";
+import { Page } from "@playwright/test";
+import { STORYBOOK__DMN_EDITOR_MODEL } from "../jsonModel";
+
+type AllDrgElements = NonNullable<DMN15__tDefinitions["drgElement"]>[0];
+
+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",
+}
Review Comment:
I think we have this in `__fixtures__/jsonModel.ts`
##########
packages/dmn-editor/tests/e2e/drgRequirements/invalidAuthorityRequirement.spec.ts:
##########
@@ -0,0 +1,172 @@
+/*
+ * 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 { DefaultNodeName, NodePosition, NodeType } from
"../__fixtures__/nodes";
+import { EdgeType } from "../__fixtures__/edges";
+
+test.beforeEach(async ({ editor }) => {
+ await editor.open();
+});
+
+test.describe("Invalid edge - Authority Requirement", () => {
+ test.describe("Invalid edge - Authority Requirement - From Knowledge
Source", () => {
+ test.beforeEach(async ({ palette }) => {
+ await palette.dragNewNode({
+ type: NodeType.KNOWLEDGE_SOURCE,
+ targetPosition: { x: 100, y: 100 },
+ thenRenameTo: "Source Node",
+ });
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Input Data node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.AUTHORITY_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.INPUT_DATA,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.INPUT_DATA })).not.toBeAttached();
+ });
+
+ test("should dim the target Input Data node", async ({ palette, nodes })
=> {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.AUTHORITY_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("should dim the target Alternative Input Data node", async ({
diagram, palette, nodes }) => {
+ await diagram.selectAlternativeInputDataShape();
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.AUTHORITY_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Decision Service node", async ({
Review Comment:
```suggestion
test("shouldn't add an Authority Requirement edge from Knowledge Source
node to Decision Service node", async ({
```
##########
packages/dmn-editor/tests/e2e/drgRequirements/invalidKnowledgeRequirement.spec.ts:
##########
@@ -0,0 +1,171 @@
+/*
+ * 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 { DefaultNodeName, NodePosition, NodeType } from
"../__fixtures__/nodes";
+import { EdgeType } from "../__fixtures__/edges";
+
+test.beforeEach(async ({ editor }) => {
+ await editor.open();
+});
+
+test.describe("Invalid edge - Knowledge Requirement", () => {
+ test.describe("Invalid edge - Knowledge Requirement - From BKM", () => {
+ test.beforeEach(async ({ palette }) => {
+ await palette.dragNewNode({
+ type: NodeType.BKM,
+ targetPosition: { x: 100, y: 100 },
+ thenRenameTo: "Source Node",
+ });
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Input Data node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.KNOWLEDGE_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.INPUT_DATA,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.INPUT_DATA })).not.toBeAttached();
+ });
+
+ test("should dim the target Input Data node", async ({ palette, nodes })
=> {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.KNOWLEDGE_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("should dim the target Alternative Input Data node", async ({
diagram, palette, nodes }) => {
+ await diagram.selectAlternativeInputDataShape();
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.KNOWLEDGE_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Knowledge Source node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.KNOWLEDGE_SOURCE,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.KNOWLEDGE_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.KNOWLEDGE_SOURCE,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.KNOWLEDGE_SOURCE })).not.toBeAttached();
+ });
+
+ test("should dim the target Knowledge Source node", async ({ palette,
nodes }) => {
+ await palette.dragNewNode({
+ type: NodeType.KNOWLEDGE_SOURCE,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.KNOWLEDGE_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.KNOWLEDGE_SOURCE
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Group node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.GROUP,
+ targetPosition: { x: 400, y: 400 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.KNOWLEDGE_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.GROUP,
+ position: NodePosition.TOP,
+ });
+
+ expect(await edges.get({ from: "Source Node", to: DefaultNodeName.GROUP
})).not.toBeAttached();
+ });
+
+ test("should dim the target Group node", async ({ palette, nodes }) => {
+ await palette.dragNewNode({
+ type: NodeType.GROUP,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.KNOWLEDGE_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.GROUP
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Text Annotation node", async ({
Review Comment:
```suggestion
test("shouldn't add an Knowledge Requirement edge from BKM node to Text
Annotation node", async ({
```
##########
packages/dmn-editor/tests/e2e/drgRequirements/invalidAuthorityRequirement.spec.ts:
##########
@@ -0,0 +1,172 @@
+/*
+ * 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 { DefaultNodeName, NodePosition, NodeType } from
"../__fixtures__/nodes";
+import { EdgeType } from "../__fixtures__/edges";
+
+test.beforeEach(async ({ editor }) => {
+ await editor.open();
+});
+
+test.describe("Invalid edge - Authority Requirement", () => {
+ test.describe("Invalid edge - Authority Requirement - From Knowledge
Source", () => {
+ test.beforeEach(async ({ palette }) => {
+ await palette.dragNewNode({
+ type: NodeType.KNOWLEDGE_SOURCE,
+ targetPosition: { x: 100, y: 100 },
+ thenRenameTo: "Source Node",
+ });
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Input Data node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.AUTHORITY_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.INPUT_DATA,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.INPUT_DATA })).not.toBeAttached();
+ });
+
+ test("should dim the target Input Data node", async ({ palette, nodes })
=> {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.AUTHORITY_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("should dim the target Alternative Input Data node", async ({
diagram, palette, nodes }) => {
+ await diagram.selectAlternativeInputDataShape();
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.AUTHORITY_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Decision Service node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.DECISION_SERVICE,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.AUTHORITY_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.DECISION_SERVICE,
+ position: NodePosition.TOP,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.DECISION_SERVICE })).not.toBeAttached();
+ });
+
+ test("should dim the target Decision Service node", async ({ palette,
nodes }) => {
+ await palette.dragNewNode({
+ type: NodeType.DECISION_SERVICE,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.AUTHORITY_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.DECISION_SERVICE
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Group node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.GROUP,
+ targetPosition: { x: 400, y: 400 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.AUTHORITY_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.GROUP,
+ position: NodePosition.TOP,
+ });
+
+ expect(await edges.get({ from: "Source Node", to: DefaultNodeName.GROUP
})).not.toBeAttached();
+ });
+
+ test("should dim the target Group node", async ({ palette, nodes }) => {
+ await palette.dragNewNode({
+ type: NodeType.GROUP,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.AUTHORITY_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.GROUP
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Text Annotation node", async ({
Review Comment:
```suggestion
test("shouldn't add an Authority Requirement edge from Knowledge Source
node to Text Annotation node", async ({
```
##########
packages/dmn-editor/tests/e2e/drgRequirements/invalidAuthorityRequirement.spec.ts:
##########
@@ -0,0 +1,172 @@
+/*
+ * 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 { DefaultNodeName, NodePosition, NodeType } from
"../__fixtures__/nodes";
+import { EdgeType } from "../__fixtures__/edges";
+
+test.beforeEach(async ({ editor }) => {
+ await editor.open();
+});
+
+test.describe("Invalid edge - Authority Requirement", () => {
+ test.describe("Invalid edge - Authority Requirement - From Knowledge
Source", () => {
+ test.beforeEach(async ({ palette }) => {
+ await palette.dragNewNode({
+ type: NodeType.KNOWLEDGE_SOURCE,
+ targetPosition: { x: 100, y: 100 },
+ thenRenameTo: "Source Node",
+ });
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Input Data node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.AUTHORITY_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.INPUT_DATA,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.INPUT_DATA })).not.toBeAttached();
+ });
+
+ test("should dim the target Input Data node", async ({ palette, nodes })
=> {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.AUTHORITY_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("should dim the target Alternative Input Data node", async ({
diagram, palette, nodes }) => {
+ await diagram.selectAlternativeInputDataShape();
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.AUTHORITY_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Decision Service node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.DECISION_SERVICE,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.AUTHORITY_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.DECISION_SERVICE,
+ position: NodePosition.TOP,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.DECISION_SERVICE })).not.toBeAttached();
+ });
+
+ test("should dim the target Decision Service node", async ({ palette,
nodes }) => {
+ await palette.dragNewNode({
+ type: NodeType.DECISION_SERVICE,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.AUTHORITY_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.DECISION_SERVICE
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Group node", async ({
Review Comment:
```suggestion
test("shouldn't add an Authority Requirement edge from Knowledge Source
node to Group node", async ({
```
##########
packages/dmn-editor/tests/e2e/drgRequirements/invalidAuthorityRequirement.spec.ts:
##########
@@ -0,0 +1,172 @@
+/*
+ * 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 { DefaultNodeName, NodePosition, NodeType } from
"../__fixtures__/nodes";
+import { EdgeType } from "../__fixtures__/edges";
+
+test.beforeEach(async ({ editor }) => {
+ await editor.open();
+});
+
+test.describe("Invalid edge - Authority Requirement", () => {
+ test.describe("Invalid edge - Authority Requirement - From Knowledge
Source", () => {
+ test.beforeEach(async ({ palette }) => {
+ await palette.dragNewNode({
+ type: NodeType.KNOWLEDGE_SOURCE,
+ targetPosition: { x: 100, y: 100 },
+ thenRenameTo: "Source Node",
+ });
+ });
+
+ test("shouldn't add an Authority Requirement edge from Input Data node to
Input Data node", async ({
Review Comment:
```suggestion
test("shouldn't add an Authority Requirement edge from Knowledge Source
node to Input Data node", async ({
```
##########
packages/dmn-editor/tests/e2e/drgRequirements/invalidKnowledgeRequirement.spec.ts:
##########
@@ -0,0 +1,171 @@
+/*
+ * 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 { DefaultNodeName, NodePosition, NodeType } from
"../__fixtures__/nodes";
+import { EdgeType } from "../__fixtures__/edges";
+
+test.beforeEach(async ({ editor }) => {
+ await editor.open();
+});
+
+test.describe("Invalid edge - Knowledge Requirement", () => {
+ test.describe("Invalid edge - Knowledge Requirement - From BKM", () => {
+ test.beforeEach(async ({ palette }) => {
+ await palette.dragNewNode({
+ type: NodeType.BKM,
+ targetPosition: { x: 100, y: 100 },
+ thenRenameTo: "Source Node",
+ });
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Input Data node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.KNOWLEDGE_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.INPUT_DATA,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.INPUT_DATA })).not.toBeAttached();
+ });
+
+ test("should dim the target Input Data node", async ({ palette, nodes })
=> {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.KNOWLEDGE_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("should dim the target Alternative Input Data node", async ({
diagram, palette, nodes }) => {
+ await diagram.selectAlternativeInputDataShape();
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.KNOWLEDGE_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Knowledge Source node", async ({
Review Comment:
```suggestion
test("shouldn't add an Knowledge Requirement edge from BKM node to
Knowledge Source node", async ({
```
##########
packages/dmn-editor/tests/e2e/drgRequirements/invalidKnowledgeRequirement.spec.ts:
##########
@@ -0,0 +1,171 @@
+/*
+ * 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 { DefaultNodeName, NodePosition, NodeType } from
"../__fixtures__/nodes";
+import { EdgeType } from "../__fixtures__/edges";
+
+test.beforeEach(async ({ editor }) => {
+ await editor.open();
+});
+
+test.describe("Invalid edge - Knowledge Requirement", () => {
+ test.describe("Invalid edge - Knowledge Requirement - From BKM", () => {
+ test.beforeEach(async ({ palette }) => {
+ await palette.dragNewNode({
+ type: NodeType.BKM,
+ targetPosition: { x: 100, y: 100 },
+ thenRenameTo: "Source Node",
+ });
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Input Data node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.KNOWLEDGE_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.INPUT_DATA,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.INPUT_DATA })).not.toBeAttached();
+ });
+
+ test("should dim the target Input Data node", async ({ palette, nodes })
=> {
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.KNOWLEDGE_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("should dim the target Alternative Input Data node", async ({
diagram, palette, nodes }) => {
+ await diagram.selectAlternativeInputDataShape();
+ await palette.dragNewNode({
+ type: NodeType.INPUT_DATA,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.KNOWLEDGE_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Knowledge Source node", async ({
+ palette,
+ nodes,
+ edges,
+ }) => {
+ await palette.dragNewNode({
+ type: NodeType.KNOWLEDGE_SOURCE,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.dragNewConnectedEdge({
+ type: EdgeType.KNOWLEDGE_REQUIREMENT,
+ from: "Source Node",
+ to: DefaultNodeName.KNOWLEDGE_SOURCE,
+ });
+
+ expect(await edges.get({ from: "Source Node", to:
DefaultNodeName.KNOWLEDGE_SOURCE })).not.toBeAttached();
+ });
+
+ test("should dim the target Knowledge Source node", async ({ palette,
nodes }) => {
+ await palette.dragNewNode({
+ type: NodeType.KNOWLEDGE_SOURCE,
+ targetPosition: { x: 300, y: 100 },
+ });
+
+ await nodes.startDraggingEdge({ from: "Source Node", edgeType:
EdgeType.KNOWLEDGE_REQUIREMENT });
+
+ await expect(nodes.get({ name: DefaultNodeName.KNOWLEDGE_SOURCE
})).toHaveClass(/.*dimmed/);
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Group node", async ({
Review Comment:
```suggestion
test("shouldn't add an Knowledge Requirement edge from BKM node to Group
node", async ({
```
##########
packages/dmn-editor/tests/e2e/drgRequirements/invalidKnowledgeRequirement.spec.ts:
##########
@@ -0,0 +1,171 @@
+/*
+ * 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 { DefaultNodeName, NodePosition, NodeType } from
"../__fixtures__/nodes";
+import { EdgeType } from "../__fixtures__/edges";
+
+test.beforeEach(async ({ editor }) => {
+ await editor.open();
+});
+
+test.describe("Invalid edge - Knowledge Requirement", () => {
+ test.describe("Invalid edge - Knowledge Requirement - From BKM", () => {
+ test.beforeEach(async ({ palette }) => {
+ await palette.dragNewNode({
+ type: NodeType.BKM,
+ targetPosition: { x: 100, y: 100 },
+ thenRenameTo: "Source Node",
+ });
+ });
+
+ test("shouldn't add an Knowledge Requirement edge from Input Data node to
Input Data node", async ({
Review Comment:
```suggestion
test("shouldn't add an Knowledge Requirement edge from BKM node to Input
Data node", async ({
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]