ljmotta commented on code in PR #3556: URL: https://github.com/apache/incubator-kie-tools/pull/3556#discussion_r3280510694
########## packages/bpmn-editor/tests-e2e/propertiesPanel/changeSequenceFlowProperties.spec.ts: ########## @@ -0,0 +1,204 @@ +/* + * 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 { NodeType } from "../__fixtures__/nodes"; + +test.beforeEach(async ({ editor }) => { + await editor.open(); +}); + +test.describe("Change Properties - Sequence Flow", () => { + test.beforeEach(async ({ palette, nodes, edges, sequenceFlowPropertiesPanel, diagram, page }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 100, y: 100 }, thenRenameTo: "Task A" }); + await diagram.resetFocus(); + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 400, y: 400 }, thenRenameTo: "Task B" }); + await diagram.resetFocus(); + + await nodes.get({ name: "Task A" }).scrollIntoViewIfNeeded(); + await nodes.get({ name: "Task B" }).scrollIntoViewIfNeeded(); + + await nodes.showNodeHandles({ name: "Task A" }); + + await nodes + .get({ name: "Task A" }) + .getByTitle("Add Sequence Flow") + .dragTo(diagram.get(), { + targetPosition: await nodes.getNodeCenterPosition({ name: "Task B" }), + }); + + const edge = await edges.get({ from: "Task A", to: "Task B" }); + await edge.scrollIntoViewIfNeeded(); + await edge.click({ force: true }); + + await sequenceFlowPropertiesPanel.open(); + }); + + test("should change the Sequence Flow name", async ({ sequenceFlowPropertiesPanel }) => { + await sequenceFlowPropertiesPanel.nameProperties.setName({ newName: "Normal Flow" }); + + expect(await sequenceFlowPropertiesPanel.nameProperties.getName()).toBe("Normal Flow"); + }); + + test("should change the Sequence Flow documentation", async ({ sequenceFlowPropertiesPanel }) => { + await sequenceFlowPropertiesPanel.documentationProperties.setDocumentation({ + newDocumentation: "This flow connects Task A to Task B", + }); + + expect(await sequenceFlowPropertiesPanel.documentationProperties.getDocumentation()).toBe( + "This flow connects Task A to Task B" + ); + }); + + test("should configure conditional expression", async ({ sequenceFlowPropertiesPanel }) => { + await sequenceFlowPropertiesPanel.setConditionExpression({ expression: "${amount > 1000}" }); + + expect(await sequenceFlowPropertiesPanel.getConditionExpression()).toBe("${amount > 1000}"); + }); + + test("should set priority", async ({ sequenceFlowPropertiesPanel }) => { + await sequenceFlowPropertiesPanel.setPriority({ priority: "1" }); + + expect(await sequenceFlowPropertiesPanel.getPriority()).toBe("1"); + }); +}); + +test.describe("Change Properties - Conditional Sequence Flow from Gateway", () => { + test.beforeEach(async ({ palette, nodes, edges, sequenceFlowPropertiesPanel, diagram, page }) => { + await palette.dragNewNode({ type: NodeType.GATEWAY, targetPosition: { x: 100, y: 250 } }); + + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 50 }, thenRenameTo: "High Amount" }); + + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 400 }, thenRenameTo: "Low Amount" }); + + await expect(nodes.getByType(NodeType.GATEWAY)).toBeVisible(); + const gatewayId = (await nodes.getByType(NodeType.GATEWAY).getAttribute("data-nodehref")) ?? ""; Review Comment: shouldn't have a fallback. ########## packages/bpmn-editor/tests-e2e/flowElements/addCallActivity.spec.ts: ########## @@ -0,0 +1,384 @@ +/* + * 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 { TestAnnotations } from "@kie-tools/playwright-base/annotations"; +import { test, expect } from "../__fixtures__/base"; +import { DefaultNodeName, NodeType, TaskNodeType } from "../__fixtures__/nodes"; + +test.beforeEach(async ({ editor }) => { + await editor.open(); +}); + +test.describe("Add node - Call Activity", () => { + test.describe("Add from palette", () => { + test("should add Call Activity node from palette", async ({ palette, nodes, jsonModel }) => { + await palette.dragNewNode({ type: NodeType.CALL_ACTIVITY, targetPosition: { x: 100, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.CALL_ACTIVITY })).toBeAttached(); + + const callActivity = await jsonModel.getFlowElement({ elementIndex: 0 }); + expect(callActivity.__$$element).toBe("callActivity"); + expect(callActivity["@_name"]).toBe(DefaultNodeName.CALL_ACTIVITY); + }); + + test("should add two Call Activity nodes from palette in a row", async ({ palette, nodes, diagram }) => { + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 300, y: 300 }, + thenRenameTo: "Second Call Activity", + }); + + await diagram.resetFocus(); + + await expect(nodes.get({ name: "First Call Activity" })).toBeAttached(); + await expect(nodes.get({ name: "Second Call Activity" })).toBeAttached(); + }); + }); + + test.describe("Add connected Call Activity node", () => { + test("should add connected Task node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addTaskHandle = callActivity.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); Review Comment: Why are you not using `nodes.dragNewConnectedNode`? ########## packages/bpmn-editor/tests-e2e/flowElements/addBoundaryEvent.spec.ts: ########## @@ -0,0 +1,223 @@ +/* + * 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 { NodeType, DefaultNodeName, TaskNodeType } from "../__fixtures__/nodes"; + +test.beforeEach(async ({ editor }) => { + await editor.open(); +}); + +test.describe("Add Boundary Event", () => { + test.describe("Basic attachment", () => { + test("should attach intermediate catch event to task", async ({ palette, jsonModel }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + + const boundaryEvent = await jsonModel.getFlowElement({ elementIndex: 1 }); + expect(boundaryEvent.__$$element).toBe("boundaryEvent"); + expect(boundaryEvent["@_attachedToRef"]).toBeDefined(); + }); + + test("should attach intermediate catch event to subprocess", async ({ palette, jsonModel }) => { + await palette.dragNewNode({ type: NodeType.SUB_PROCESS, targetPosition: { x: 100, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 550, y: 350 } }); + + const boundaryEvent = await jsonModel.getFlowElement({ elementIndex: 1 }); + expect(boundaryEvent.__$$element).toBe("boundaryEvent"); + expect(boundaryEvent["@_attachedToRef"]).toBeDefined(); + }); + + test("should attach multiple boundary events to same task", async ({ palette, jsonModel, diagram }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 300, y: 280 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 350, y: 350 } }); + + await expect(diagram.get()).toHaveScreenshot("attach-multiple-boundary-events-to-task.png"); + + const process = await jsonModel.getProcess(); + const boundaryEvents = process.flowElement?.filter( + (e: { __$$element: string }) => e.__$$element === "boundaryEvent" + ); + expect(boundaryEvents?.length).toBe(3); + boundaryEvents?.forEach((event: { __$$element: string; "@_attachedToRef"?: string }) => { + expect(event.__$$element).toBe("boundaryEvent"); + expect(event["@_attachedToRef"]).toBeDefined(); + }); + }); + }); + + test.describe("Detachment", () => { + test("should detach boundary event back to intermediate catch event", async ({ + palette, + jsonModel, + diagram, + nodes, + }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + + await expect(nodes.getByType(NodeType.INTERMEDIATE_CATCH_EVENT)).toBeVisible(); + await nodes + .getByType(NodeType.INTERMEDIATE_CATCH_EVENT) + .dragTo(diagram.get(), { targetPosition: { x: 500, y: 100 } }); + + await expect(diagram.get()).toHaveScreenshot("detach-boundary-event-from-task.png"); + + const detachedEvent = await jsonModel.getFlowElement({ elementIndex: 1 }); + expect(detachedEvent.__$$element).toBe("intermediateCatchEvent"); + expect(detachedEvent["@_attachedToRef"]).toBeUndefined(); + }); + }); + + test.describe("Interrupting vs Non-interrupting", () => { + test("should create interrupting boundary event by default", async ({ palette, jsonModel, diagram }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + + await expect(diagram.get()).toHaveScreenshot("interrupting-boundary-event.png"); + + const boundaryEvent = await jsonModel.getFlowElement({ elementIndex: 1 }); + expect(boundaryEvent.__$$element).toBe("boundaryEvent"); + expect(boundaryEvent["@_attachedToRef"]).toBeDefined(); + expect(boundaryEvent["@_cancelActivity"]).not.toBe(false); + }); + + test("should create non-interrupting boundary event", async ({ + palette, + jsonModel, + diagram, + nodes, + intermediateEventPropertiesPanel, + }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + + await expect(nodes.getByType(NodeType.INTERMEDIATE_CATCH_EVENT)).toBeVisible(); + await nodes.getByType(NodeType.INTERMEDIATE_CATCH_EVENT).click(); + + await intermediateEventPropertiesPanel.setCancelActivity({ cancelActivity: false }); + + await expect + .poll(async () => { + return await jsonModel.getFlowElement({ elementIndex: 1 }); + }) + .toMatchObject({ + __$$element: "boundaryEvent", + "@_attachedToRef": expect.stringMatching(/.+/), + "@_cancelActivity": false, + }); + + await expect(diagram.get()).toHaveScreenshot("non-interrupting-boundary-event.png"); + }); + }); + + test.describe("Activity types", () => { + test("should attach to user task", async ({ palette, nodes, jsonModel, diagram }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 300 } }); + + await nodes.morph({ node: nodes.get({ name: DefaultNodeName.TASK }), to: TaskNodeType.USER }); + + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + + await expect(diagram.get()).toHaveScreenshot("attach-boundary-event-to-user-task.png"); + + const boundaryEvent = await jsonModel.getFlowElement({ elementIndex: 1 }); + expect(boundaryEvent.__$$element).toBe("boundaryEvent"); + expect(boundaryEvent["@_attachedToRef"]).toBeDefined(); + }); + + test("should attach to call activity", async ({ palette, jsonModel, diagram }) => { + await palette.dragNewNode({ type: NodeType.CALL_ACTIVITY, targetPosition: { x: 300, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + + await expect(diagram.get()).toHaveScreenshot("attach-boundary-event-to-call-activity.png"); + + const boundaryEvent = await jsonModel.getFlowElement({ elementIndex: 1 }); + expect(boundaryEvent.__$$element).toBe("boundaryEvent"); + expect(boundaryEvent["@_attachedToRef"]).toBeDefined(); + }); + }); + + test.describe("Operations", () => { + test("should delete boundary event", async ({ palette, jsonModel, nodes }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + + await expect(nodes.getByType(NodeType.INTERMEDIATE_CATCH_EVENT)).toBeAttached(); + + await nodes.deleteByType({ type: NodeType.INTERMEDIATE_CATCH_EVENT }); + + await expect(nodes.getByType(NodeType.INTERMEDIATE_CATCH_EVENT)).not.toBeAttached(); + + const process = await jsonModel.getProcess(); + expect( + process.flowElement?.find((e: { __$$element: string }) => e.__$$element === "boundaryEvent") + ).toBeUndefined(); + expect(process.flowElement?.find((e: { __$$element: string }) => e.__$$element === "task")).toBeDefined(); + }); + + test.skip( + "should delete task with boundary event", + { + annotation: { + type: "issue", + description: "https://github.com/apache/incubator-kie-issues/issues/2318", + }, + }, + async ({ palette, nodes, jsonModel, diagram }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + + await nodes.delete({ name: DefaultNodeName.TASK }); + + const process = await jsonModel.getProcess(); + expect(process.flowElement?.filter((e: { __$$element: string }) => e.__$$element === "task").length).toBe(0); + expect( + process.flowElement?.filter((e: { __$$element: string }) => e.__$$element === "boundaryEvent").length + ).toBe(0); + + await expect(diagram.get()).toHaveScreenshot("delete-task-with-boundary-event.png"); + } + ); + + test("should move task with boundary event", async ({ palette, jsonModel, diagram, nodes }) => { + await palette.dragNewNode({ type: NodeType.TASK, targetPosition: { x: 300, y: 300 } }); + await palette.dragNewNode({ type: NodeType.INTERMEDIATE_CATCH_EVENT, targetPosition: { x: 450, y: 300 } }); + + await expect(nodes.getByType(NodeType.TASK)).toBeAttached(); + await nodes.getByType(NodeType.TASK).scrollIntoViewIfNeeded(); + + const taskBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.TASK) }); + + await nodes.getByType(NodeType.TASK).dragTo(diagram.get(), { + sourcePosition: { x: 20, y: taskBox.height / 2 }, + targetPosition: { x: 400, y: 350 }, + force: true, + }); Review Comment: It is not clear why moving to `taskBox.height / 2`, and where is this on the editor. Fixed numbers are prefered, or this should be behind a fixture with a good name on it. ########## packages/bpmn-editor/tests-e2e/flowElements/addCallActivity.spec.ts: ########## @@ -0,0 +1,384 @@ +/* + * 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 { TestAnnotations } from "@kie-tools/playwright-base/annotations"; +import { test, expect } from "../__fixtures__/base"; +import { DefaultNodeName, NodeType, TaskNodeType } from "../__fixtures__/nodes"; + +test.beforeEach(async ({ editor }) => { + await editor.open(); +}); + +test.describe("Add node - Call Activity", () => { + test.describe("Add from palette", () => { + test("should add Call Activity node from palette", async ({ palette, nodes, jsonModel }) => { + await palette.dragNewNode({ type: NodeType.CALL_ACTIVITY, targetPosition: { x: 100, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.CALL_ACTIVITY })).toBeAttached(); + + const callActivity = await jsonModel.getFlowElement({ elementIndex: 0 }); + expect(callActivity.__$$element).toBe("callActivity"); + expect(callActivity["@_name"]).toBe(DefaultNodeName.CALL_ACTIVITY); + }); + + test("should add two Call Activity nodes from palette in a row", async ({ palette, nodes, diagram }) => { + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 300, y: 300 }, + thenRenameTo: "Second Call Activity", + }); + + await diagram.resetFocus(); + + await expect(nodes.get({ name: "First Call Activity" })).toBeAttached(); + await expect(nodes.get({ name: "Second Call Activity" })).toBeAttached(); + }); + }); + + test.describe("Add connected Call Activity node", () => { + test("should add connected Task node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addTaskHandle = callActivity.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.TASK })).toBeAttached(); + }); + + test("should add connected Gateway node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addGatewayHandle = callActivity.getByTitle("Add Gateway"); + await expect(addGatewayHandle).toBeVisible(); + + await addGatewayHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(diagram.get()).toHaveScreenshot("add-gateway-node-from-call-activity.png"); + }); + + test("should create sequence flow from Call Activity to End Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + await diagram.resetFocus(); + await palette.dragNewNode({ + type: NodeType.END_EVENT, + targetPosition: { x: 300, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + await expect(nodes.getByType(NodeType.END_EVENT)).toBeVisible(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addSequenceFlowHandle = callActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const endEventBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.END_EVENT) }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { x: endEventBox.x + endEventBox.width / 2, y: endEventBox.y + endEventBox.height / 2 }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-end-event.png"); + }); + + test("should add connected Call Activity from Start Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.START_EVENT, + targetPosition: { x: 100, y: 100 }, + }); + + const startEvent = nodes.getByType(NodeType.START_EVENT); + await expect(startEvent).toBeAttached(); + + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.START_EVENT) }); + + const addTaskHandle = startEvent.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + const task = nodes.get({ name: "New Task" }); + await expect(task).toBeAttached(); + + await nodes.morph({ node: task, to: TaskNodeType.CALL_ACTIVITY }); + + await expect(diagram.get()).toHaveScreenshot("add-call-activity-from-start-event.png"); + }); + + test("should create sequence flow from Call Activity to another Call Activity", async ({ + diagram, + palette, + nodes, + }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + thenRenameTo: "Second Call Activity", + }); + + const firstCallActivity = nodes.get({ name: "First Call Activity" }); + await expect(firstCallActivity).toBeAttached(); + + const secondCallActivity = nodes.get({ name: "Second Call Activity" }); + await expect(secondCallActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "First Call Activity" }); + + const addSequenceFlowHandle = firstCallActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const secondCallActivityBox = await nodes.getNodeBounds({ name: "Second Call Activity" }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { + x: secondCallActivityBox.x + secondCallActivityBox.width / 2, + y: secondCallActivityBox.y + secondCallActivityBox.height / 2, + }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-call-activity.png"); + }); + + test("should create sequence flow from Gateway to Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.GATEWAY, + targetPosition: { x: 100, y: 100 }, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + }); + + const gateway = nodes.getByType(NodeType.GATEWAY); + await expect(gateway).toBeVisible(); + await expect(nodes.get({ name: "New Call Activity" })).toBeAttached(); Review Comment: Not using enum value. ########## packages/bpmn-editor/tests-e2e/flowElements/addCallActivity.spec.ts: ########## @@ -0,0 +1,384 @@ +/* + * 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 { TestAnnotations } from "@kie-tools/playwright-base/annotations"; +import { test, expect } from "../__fixtures__/base"; +import { DefaultNodeName, NodeType, TaskNodeType } from "../__fixtures__/nodes"; + +test.beforeEach(async ({ editor }) => { + await editor.open(); +}); + +test.describe("Add node - Call Activity", () => { + test.describe("Add from palette", () => { + test("should add Call Activity node from palette", async ({ palette, nodes, jsonModel }) => { + await palette.dragNewNode({ type: NodeType.CALL_ACTIVITY, targetPosition: { x: 100, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.CALL_ACTIVITY })).toBeAttached(); + + const callActivity = await jsonModel.getFlowElement({ elementIndex: 0 }); + expect(callActivity.__$$element).toBe("callActivity"); + expect(callActivity["@_name"]).toBe(DefaultNodeName.CALL_ACTIVITY); + }); + + test("should add two Call Activity nodes from palette in a row", async ({ palette, nodes, diagram }) => { + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 300, y: 300 }, + thenRenameTo: "Second Call Activity", + }); + + await diagram.resetFocus(); + + await expect(nodes.get({ name: "First Call Activity" })).toBeAttached(); + await expect(nodes.get({ name: "Second Call Activity" })).toBeAttached(); + }); + }); + + test.describe("Add connected Call Activity node", () => { + test("should add connected Task node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addTaskHandle = callActivity.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.TASK })).toBeAttached(); + }); + + test("should add connected Gateway node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addGatewayHandle = callActivity.getByTitle("Add Gateway"); + await expect(addGatewayHandle).toBeVisible(); + + await addGatewayHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(diagram.get()).toHaveScreenshot("add-gateway-node-from-call-activity.png"); + }); + + test("should create sequence flow from Call Activity to End Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + await diagram.resetFocus(); + await palette.dragNewNode({ + type: NodeType.END_EVENT, + targetPosition: { x: 300, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + await expect(nodes.getByType(NodeType.END_EVENT)).toBeVisible(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addSequenceFlowHandle = callActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const endEventBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.END_EVENT) }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { x: endEventBox.x + endEventBox.width / 2, y: endEventBox.y + endEventBox.height / 2 }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-end-event.png"); + }); + + test("should add connected Call Activity from Start Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.START_EVENT, + targetPosition: { x: 100, y: 100 }, + }); + + const startEvent = nodes.getByType(NodeType.START_EVENT); + await expect(startEvent).toBeAttached(); + + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.START_EVENT) }); + + const addTaskHandle = startEvent.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + const task = nodes.get({ name: "New Task" }); + await expect(task).toBeAttached(); + + await nodes.morph({ node: task, to: TaskNodeType.CALL_ACTIVITY }); + + await expect(diagram.get()).toHaveScreenshot("add-call-activity-from-start-event.png"); + }); + + test("should create sequence flow from Call Activity to another Call Activity", async ({ + diagram, + palette, + nodes, + }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + thenRenameTo: "Second Call Activity", + }); + + const firstCallActivity = nodes.get({ name: "First Call Activity" }); + await expect(firstCallActivity).toBeAttached(); + + const secondCallActivity = nodes.get({ name: "Second Call Activity" }); + await expect(secondCallActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "First Call Activity" }); + + const addSequenceFlowHandle = firstCallActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const secondCallActivityBox = await nodes.getNodeBounds({ name: "Second Call Activity" }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { + x: secondCallActivityBox.x + secondCallActivityBox.width / 2, + y: secondCallActivityBox.y + secondCallActivityBox.height / 2, + }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-call-activity.png"); + }); + + test("should create sequence flow from Gateway to Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.GATEWAY, + targetPosition: { x: 100, y: 100 }, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + }); + + const gateway = nodes.getByType(NodeType.GATEWAY); + await expect(gateway).toBeVisible(); + await expect(nodes.get({ name: "New Call Activity" })).toBeAttached(); + + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.GATEWAY) }); + + const addSequenceFlowHandle = gateway.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const callActivityBox = await nodes.getNodeBounds({ name: "New Call Activity" }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { + x: callActivityBox.x + callActivityBox.width / 2, + y: callActivityBox.y + callActivityBox.height / 2, + }, + }); Review Comment: Not using `dragNewConnectedNode`. Not clear to where the node is being drag to. ########## packages/bpmn-editor/tests-e2e/flowElements/addCallActivity.spec.ts: ########## @@ -0,0 +1,384 @@ +/* + * 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 { TestAnnotations } from "@kie-tools/playwright-base/annotations"; +import { test, expect } from "../__fixtures__/base"; +import { DefaultNodeName, NodeType, TaskNodeType } from "../__fixtures__/nodes"; + +test.beforeEach(async ({ editor }) => { + await editor.open(); +}); + +test.describe("Add node - Call Activity", () => { + test.describe("Add from palette", () => { + test("should add Call Activity node from palette", async ({ palette, nodes, jsonModel }) => { + await palette.dragNewNode({ type: NodeType.CALL_ACTIVITY, targetPosition: { x: 100, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.CALL_ACTIVITY })).toBeAttached(); + + const callActivity = await jsonModel.getFlowElement({ elementIndex: 0 }); + expect(callActivity.__$$element).toBe("callActivity"); + expect(callActivity["@_name"]).toBe(DefaultNodeName.CALL_ACTIVITY); + }); + + test("should add two Call Activity nodes from palette in a row", async ({ palette, nodes, diagram }) => { + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 300, y: 300 }, + thenRenameTo: "Second Call Activity", + }); + + await diagram.resetFocus(); + + await expect(nodes.get({ name: "First Call Activity" })).toBeAttached(); + await expect(nodes.get({ name: "Second Call Activity" })).toBeAttached(); + }); + }); + + test.describe("Add connected Call Activity node", () => { + test("should add connected Task node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addTaskHandle = callActivity.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.TASK })).toBeAttached(); + }); + + test("should add connected Gateway node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addGatewayHandle = callActivity.getByTitle("Add Gateway"); + await expect(addGatewayHandle).toBeVisible(); + + await addGatewayHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(diagram.get()).toHaveScreenshot("add-gateway-node-from-call-activity.png"); + }); + + test("should create sequence flow from Call Activity to End Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + await diagram.resetFocus(); + await palette.dragNewNode({ + type: NodeType.END_EVENT, + targetPosition: { x: 300, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + await expect(nodes.getByType(NodeType.END_EVENT)).toBeVisible(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addSequenceFlowHandle = callActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const endEventBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.END_EVENT) }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { x: endEventBox.x + endEventBox.width / 2, y: endEventBox.y + endEventBox.height / 2 }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-end-event.png"); + }); + + test("should add connected Call Activity from Start Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.START_EVENT, + targetPosition: { x: 100, y: 100 }, + }); + + const startEvent = nodes.getByType(NodeType.START_EVENT); + await expect(startEvent).toBeAttached(); + + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.START_EVENT) }); + + const addTaskHandle = startEvent.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + const task = nodes.get({ name: "New Task" }); + await expect(task).toBeAttached(); + + await nodes.morph({ node: task, to: TaskNodeType.CALL_ACTIVITY }); + + await expect(diagram.get()).toHaveScreenshot("add-call-activity-from-start-event.png"); + }); + + test("should create sequence flow from Call Activity to another Call Activity", async ({ + diagram, + palette, + nodes, + }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + thenRenameTo: "Second Call Activity", + }); + + const firstCallActivity = nodes.get({ name: "First Call Activity" }); + await expect(firstCallActivity).toBeAttached(); + + const secondCallActivity = nodes.get({ name: "Second Call Activity" }); + await expect(secondCallActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "First Call Activity" }); + + const addSequenceFlowHandle = firstCallActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const secondCallActivityBox = await nodes.getNodeBounds({ name: "Second Call Activity" }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { + x: secondCallActivityBox.x + secondCallActivityBox.width / 2, + y: secondCallActivityBox.y + secondCallActivityBox.height / 2, + }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-call-activity.png"); + }); + + test("should create sequence flow from Gateway to Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.GATEWAY, + targetPosition: { x: 100, y: 100 }, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + }); + + const gateway = nodes.getByType(NodeType.GATEWAY); + await expect(gateway).toBeVisible(); + await expect(nodes.get({ name: "New Call Activity" })).toBeAttached(); + + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.GATEWAY) }); + + const addSequenceFlowHandle = gateway.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const callActivityBox = await nodes.getNodeBounds({ name: "New Call Activity" }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { + x: callActivityBox.x + callActivityBox.width / 2, + y: callActivityBox.y + callActivityBox.height / 2, + }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-gateway-to-call-activity.png"); + }); + + test("should create sequence flow from Call Activity to Gateway", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + await palette.dragNewNode({ + type: NodeType.GATEWAY, + targetPosition: { x: 350, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + await expect(nodes.getByType(NodeType.GATEWAY)).toBeVisible(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addSequenceFlowHandle = callActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const gatewayBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.GATEWAY) }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { x: gatewayBox.x + gatewayBox.width / 2, y: gatewayBox.y + gatewayBox.height / 2 }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-gateway.png"); + }); + }); + + test.describe("Call Activity in process flow", () => { + test.beforeEach(async ({ editor, page }) => { + await page.setViewportSize({ width: 1920, height: 1080 }); + await editor.open(); + }); + + test("should create a complete process with Call Activity", async ({ jsonModel, palette, nodes, diagram }) => { + await palette.dragNewNode({ type: NodeType.START_EVENT, targetPosition: { x: 100, y: 150 } }); + await palette.dragNewNode({ + type: NodeType.TASK, + targetPosition: { x: 250, y: 150 }, + thenRenameTo: "Prepare Data", + }); + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 500, y: 150 }, + thenRenameTo: "Execute Subprocess", + }); + await palette.dragNewNode({ + type: NodeType.TASK, + targetPosition: { x: 750, y: 150 }, + thenRenameTo: "Process Results", + }); + await palette.dragNewNode({ type: NodeType.END_EVENT, targetPosition: { x: 1000, y: 150 } }); + + const startEvent = nodes.getByType(NodeType.START_EVENT); + await expect(startEvent).toBeAttached(); + + const prepareData = nodes.get({ name: "Prepare Data" }); + const callActivity = nodes.get({ name: "Execute Subprocess" }); + const processResults = nodes.get({ name: "Process Results" }); + const endEvent = nodes.getByType(NodeType.END_EVENT); Review Comment: unecessary variables. ########## packages/bpmn-editor/tests-e2e/flowElements/addCallActivity.spec.ts: ########## @@ -0,0 +1,384 @@ +/* + * 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 { TestAnnotations } from "@kie-tools/playwright-base/annotations"; +import { test, expect } from "../__fixtures__/base"; +import { DefaultNodeName, NodeType, TaskNodeType } from "../__fixtures__/nodes"; + +test.beforeEach(async ({ editor }) => { + await editor.open(); +}); + +test.describe("Add node - Call Activity", () => { + test.describe("Add from palette", () => { + test("should add Call Activity node from palette", async ({ palette, nodes, jsonModel }) => { + await palette.dragNewNode({ type: NodeType.CALL_ACTIVITY, targetPosition: { x: 100, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.CALL_ACTIVITY })).toBeAttached(); + + const callActivity = await jsonModel.getFlowElement({ elementIndex: 0 }); + expect(callActivity.__$$element).toBe("callActivity"); + expect(callActivity["@_name"]).toBe(DefaultNodeName.CALL_ACTIVITY); + }); + + test("should add two Call Activity nodes from palette in a row", async ({ palette, nodes, diagram }) => { + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 300, y: 300 }, + thenRenameTo: "Second Call Activity", + }); + + await diagram.resetFocus(); + + await expect(nodes.get({ name: "First Call Activity" })).toBeAttached(); + await expect(nodes.get({ name: "Second Call Activity" })).toBeAttached(); + }); + }); + + test.describe("Add connected Call Activity node", () => { + test("should add connected Task node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addTaskHandle = callActivity.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.TASK })).toBeAttached(); + }); + + test("should add connected Gateway node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addGatewayHandle = callActivity.getByTitle("Add Gateway"); + await expect(addGatewayHandle).toBeVisible(); + + await addGatewayHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); Review Comment: Same here. ########## packages/bpmn-editor/tests-e2e/flowElements/addCallActivity.spec.ts: ########## @@ -0,0 +1,384 @@ +/* + * 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 { TestAnnotations } from "@kie-tools/playwright-base/annotations"; +import { test, expect } from "../__fixtures__/base"; +import { DefaultNodeName, NodeType, TaskNodeType } from "../__fixtures__/nodes"; + +test.beforeEach(async ({ editor }) => { + await editor.open(); +}); + +test.describe("Add node - Call Activity", () => { + test.describe("Add from palette", () => { + test("should add Call Activity node from palette", async ({ palette, nodes, jsonModel }) => { + await palette.dragNewNode({ type: NodeType.CALL_ACTIVITY, targetPosition: { x: 100, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.CALL_ACTIVITY })).toBeAttached(); + + const callActivity = await jsonModel.getFlowElement({ elementIndex: 0 }); + expect(callActivity.__$$element).toBe("callActivity"); + expect(callActivity["@_name"]).toBe(DefaultNodeName.CALL_ACTIVITY); + }); + + test("should add two Call Activity nodes from palette in a row", async ({ palette, nodes, diagram }) => { + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 300, y: 300 }, + thenRenameTo: "Second Call Activity", + }); + + await diagram.resetFocus(); + + await expect(nodes.get({ name: "First Call Activity" })).toBeAttached(); + await expect(nodes.get({ name: "Second Call Activity" })).toBeAttached(); + }); + }); + + test.describe("Add connected Call Activity node", () => { + test("should add connected Task node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addTaskHandle = callActivity.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.TASK })).toBeAttached(); + }); + + test("should add connected Gateway node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addGatewayHandle = callActivity.getByTitle("Add Gateway"); + await expect(addGatewayHandle).toBeVisible(); + + await addGatewayHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(diagram.get()).toHaveScreenshot("add-gateway-node-from-call-activity.png"); + }); + + test("should create sequence flow from Call Activity to End Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + await diagram.resetFocus(); + await palette.dragNewNode({ + type: NodeType.END_EVENT, + targetPosition: { x: 300, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + await expect(nodes.getByType(NodeType.END_EVENT)).toBeVisible(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addSequenceFlowHandle = callActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const endEventBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.END_EVENT) }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { x: endEventBox.x + endEventBox.width / 2, y: endEventBox.y + endEventBox.height / 2 }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-end-event.png"); + }); + + test("should add connected Call Activity from Start Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.START_EVENT, + targetPosition: { x: 100, y: 100 }, + }); + + const startEvent = nodes.getByType(NodeType.START_EVENT); + await expect(startEvent).toBeAttached(); + + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.START_EVENT) }); + + const addTaskHandle = startEvent.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + const task = nodes.get({ name: "New Task" }); + await expect(task).toBeAttached(); + + await nodes.morph({ node: task, to: TaskNodeType.CALL_ACTIVITY }); + + await expect(diagram.get()).toHaveScreenshot("add-call-activity-from-start-event.png"); + }); + + test("should create sequence flow from Call Activity to another Call Activity", async ({ + diagram, + palette, + nodes, + }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + thenRenameTo: "Second Call Activity", + }); + + const firstCallActivity = nodes.get({ name: "First Call Activity" }); + await expect(firstCallActivity).toBeAttached(); + + const secondCallActivity = nodes.get({ name: "Second Call Activity" }); + await expect(secondCallActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "First Call Activity" }); + + const addSequenceFlowHandle = firstCallActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const secondCallActivityBox = await nodes.getNodeBounds({ name: "Second Call Activity" }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { + x: secondCallActivityBox.x + secondCallActivityBox.width / 2, + y: secondCallActivityBox.y + secondCallActivityBox.height / 2, + }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-call-activity.png"); + }); + + test("should create sequence flow from Gateway to Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.GATEWAY, + targetPosition: { x: 100, y: 100 }, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + }); + + const gateway = nodes.getByType(NodeType.GATEWAY); + await expect(gateway).toBeVisible(); + await expect(nodes.get({ name: "New Call Activity" })).toBeAttached(); + + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.GATEWAY) }); + + const addSequenceFlowHandle = gateway.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const callActivityBox = await nodes.getNodeBounds({ name: "New Call Activity" }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { + x: callActivityBox.x + callActivityBox.width / 2, + y: callActivityBox.y + callActivityBox.height / 2, + }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-gateway-to-call-activity.png"); + }); + + test("should create sequence flow from Call Activity to Gateway", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + await palette.dragNewNode({ + type: NodeType.GATEWAY, + targetPosition: { x: 350, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + await expect(nodes.getByType(NodeType.GATEWAY)).toBeVisible(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addSequenceFlowHandle = callActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const gatewayBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.GATEWAY) }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { x: gatewayBox.x + gatewayBox.width / 2, y: gatewayBox.y + gatewayBox.height / 2 }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-gateway.png"); + }); + }); + + test.describe("Call Activity in process flow", () => { + test.beforeEach(async ({ editor, page }) => { + await page.setViewportSize({ width: 1920, height: 1080 }); + await editor.open(); + }); + + test("should create a complete process with Call Activity", async ({ jsonModel, palette, nodes, diagram }) => { + await palette.dragNewNode({ type: NodeType.START_EVENT, targetPosition: { x: 100, y: 150 } }); + await palette.dragNewNode({ + type: NodeType.TASK, + targetPosition: { x: 250, y: 150 }, + thenRenameTo: "Prepare Data", + }); + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 500, y: 150 }, + thenRenameTo: "Execute Subprocess", + }); + await palette.dragNewNode({ + type: NodeType.TASK, + targetPosition: { x: 750, y: 150 }, + thenRenameTo: "Process Results", + }); + await palette.dragNewNode({ type: NodeType.END_EVENT, targetPosition: { x: 1000, y: 150 } }); + + const startEvent = nodes.getByType(NodeType.START_EVENT); + await expect(startEvent).toBeAttached(); + + const prepareData = nodes.get({ name: "Prepare Data" }); + const callActivity = nodes.get({ name: "Execute Subprocess" }); + const processResults = nodes.get({ name: "Process Results" }); + const endEvent = nodes.getByType(NodeType.END_EVENT); + + // Connect Start Event -> Prepare Data + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.START_EVENT) }); + const handle1 = startEvent.getByTitle("Add Sequence Flow"); + await expect(handle1).toBeVisible(); + let targetBox = await nodes.getNodeBounds({ name: "Prepare Data" }); + await handle1.dragTo(diagram.get(), { + targetPosition: { x: targetBox.x + targetBox.width / 2, y: targetBox.y + targetBox.height / 2 }, + }); Review Comment: `nodes.dragNewConnectedNode`. ########## packages/bpmn-editor/tests-e2e/flowElements/addCallActivity.spec.ts: ########## @@ -0,0 +1,384 @@ +/* + * 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 { TestAnnotations } from "@kie-tools/playwright-base/annotations"; +import { test, expect } from "../__fixtures__/base"; +import { DefaultNodeName, NodeType, TaskNodeType } from "../__fixtures__/nodes"; + +test.beforeEach(async ({ editor }) => { + await editor.open(); +}); + +test.describe("Add node - Call Activity", () => { + test.describe("Add from palette", () => { + test("should add Call Activity node from palette", async ({ palette, nodes, jsonModel }) => { + await palette.dragNewNode({ type: NodeType.CALL_ACTIVITY, targetPosition: { x: 100, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.CALL_ACTIVITY })).toBeAttached(); + + const callActivity = await jsonModel.getFlowElement({ elementIndex: 0 }); + expect(callActivity.__$$element).toBe("callActivity"); + expect(callActivity["@_name"]).toBe(DefaultNodeName.CALL_ACTIVITY); + }); + + test("should add two Call Activity nodes from palette in a row", async ({ palette, nodes, diagram }) => { + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 300, y: 300 }, + thenRenameTo: "Second Call Activity", + }); + + await diagram.resetFocus(); + + await expect(nodes.get({ name: "First Call Activity" })).toBeAttached(); + await expect(nodes.get({ name: "Second Call Activity" })).toBeAttached(); + }); + }); + + test.describe("Add connected Call Activity node", () => { + test("should add connected Task node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addTaskHandle = callActivity.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(nodes.get({ name: DefaultNodeName.TASK })).toBeAttached(); + }); + + test("should add connected Gateway node from Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addGatewayHandle = callActivity.getByTitle("Add Gateway"); + await expect(addGatewayHandle).toBeVisible(); + + await addGatewayHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + await expect(diagram.get()).toHaveScreenshot("add-gateway-node-from-call-activity.png"); + }); + + test("should create sequence flow from Call Activity to End Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + await diagram.resetFocus(); + await palette.dragNewNode({ + type: NodeType.END_EVENT, + targetPosition: { x: 300, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + await expect(nodes.getByType(NodeType.END_EVENT)).toBeVisible(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addSequenceFlowHandle = callActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const endEventBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.END_EVENT) }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { x: endEventBox.x + endEventBox.width / 2, y: endEventBox.y + endEventBox.height / 2 }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-end-event.png"); + }); + + test("should add connected Call Activity from Start Event", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.START_EVENT, + targetPosition: { x: 100, y: 100 }, + }); + + const startEvent = nodes.getByType(NodeType.START_EVENT); + await expect(startEvent).toBeAttached(); + + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.START_EVENT) }); + + const addTaskHandle = startEvent.getByTitle("Add Task"); + await expect(addTaskHandle).toBeVisible(); + + await addTaskHandle.dragTo(diagram.get(), { targetPosition: { x: 300, y: 100 } }); + + const task = nodes.get({ name: "New Task" }); + await expect(task).toBeAttached(); + + await nodes.morph({ node: task, to: TaskNodeType.CALL_ACTIVITY }); + + await expect(diagram.get()).toHaveScreenshot("add-call-activity-from-start-event.png"); + }); + + test("should create sequence flow from Call Activity to another Call Activity", async ({ + diagram, + palette, + nodes, + }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + thenRenameTo: "First Call Activity", + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + thenRenameTo: "Second Call Activity", + }); + + const firstCallActivity = nodes.get({ name: "First Call Activity" }); + await expect(firstCallActivity).toBeAttached(); + + const secondCallActivity = nodes.get({ name: "Second Call Activity" }); + await expect(secondCallActivity).toBeAttached(); + + await nodes.showNodeHandles({ name: "First Call Activity" }); + + const addSequenceFlowHandle = firstCallActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const secondCallActivityBox = await nodes.getNodeBounds({ name: "Second Call Activity" }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { + x: secondCallActivityBox.x + secondCallActivityBox.width / 2, + y: secondCallActivityBox.y + secondCallActivityBox.height / 2, + }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-call-activity.png"); + }); + + test("should create sequence flow from Gateway to Call Activity", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.GATEWAY, + targetPosition: { x: 100, y: 100 }, + }); + + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 350, y: 100 }, + }); + + const gateway = nodes.getByType(NodeType.GATEWAY); + await expect(gateway).toBeVisible(); + await expect(nodes.get({ name: "New Call Activity" })).toBeAttached(); + + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.GATEWAY) }); + + const addSequenceFlowHandle = gateway.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const callActivityBox = await nodes.getNodeBounds({ name: "New Call Activity" }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { + x: callActivityBox.x + callActivityBox.width / 2, + y: callActivityBox.y + callActivityBox.height / 2, + }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-gateway-to-call-activity.png"); + }); + + test("should create sequence flow from Call Activity to Gateway", async ({ diagram, palette, nodes }) => { + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 100, y: 100 }, + }); + + await palette.dragNewNode({ + type: NodeType.GATEWAY, + targetPosition: { x: 350, y: 100 }, + }); + + const callActivity = nodes.get({ name: "New Call Activity" }); + await expect(callActivity).toBeAttached(); + await expect(nodes.getByType(NodeType.GATEWAY)).toBeVisible(); + + await nodes.showNodeHandles({ name: "New Call Activity" }); + + const addSequenceFlowHandle = callActivity.getByTitle("Add Sequence Flow"); + await expect(addSequenceFlowHandle).toBeVisible(); + + const gatewayBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.GATEWAY) }); + + await addSequenceFlowHandle.dragTo(diagram.get(), { + targetPosition: { x: gatewayBox.x + gatewayBox.width / 2, y: gatewayBox.y + gatewayBox.height / 2 }, + }); + + await expect(diagram.get()).toHaveScreenshot("create-sequence-flow-call-activity-to-gateway.png"); + }); + }); + + test.describe("Call Activity in process flow", () => { + test.beforeEach(async ({ editor, page }) => { + await page.setViewportSize({ width: 1920, height: 1080 }); + await editor.open(); + }); + + test("should create a complete process with Call Activity", async ({ jsonModel, palette, nodes, diagram }) => { + await palette.dragNewNode({ type: NodeType.START_EVENT, targetPosition: { x: 100, y: 150 } }); + await palette.dragNewNode({ + type: NodeType.TASK, + targetPosition: { x: 250, y: 150 }, + thenRenameTo: "Prepare Data", + }); + await palette.dragNewNode({ + type: NodeType.CALL_ACTIVITY, + targetPosition: { x: 500, y: 150 }, + thenRenameTo: "Execute Subprocess", + }); + await palette.dragNewNode({ + type: NodeType.TASK, + targetPosition: { x: 750, y: 150 }, + thenRenameTo: "Process Results", + }); + await palette.dragNewNode({ type: NodeType.END_EVENT, targetPosition: { x: 1000, y: 150 } }); + + const startEvent = nodes.getByType(NodeType.START_EVENT); + await expect(startEvent).toBeAttached(); + + const prepareData = nodes.get({ name: "Prepare Data" }); + const callActivity = nodes.get({ name: "Execute Subprocess" }); + const processResults = nodes.get({ name: "Process Results" }); + const endEvent = nodes.getByType(NodeType.END_EVENT); + + // Connect Start Event -> Prepare Data + await nodes.showNodeHandles({ id: await nodes.getIdByType(NodeType.START_EVENT) }); + const handle1 = startEvent.getByTitle("Add Sequence Flow"); + await expect(handle1).toBeVisible(); + let targetBox = await nodes.getNodeBounds({ name: "Prepare Data" }); + await handle1.dragTo(diagram.get(), { + targetPosition: { x: targetBox.x + targetBox.width / 2, y: targetBox.y + targetBox.height / 2 }, + }); + + // Connect Prepare Data -> Execute Subprocess + await nodes.showNodeHandles({ name: "Prepare Data" }); + const handle2 = prepareData.getByTitle("Add Sequence Flow"); + await expect(handle2).toBeVisible(); + targetBox = await nodes.getNodeBounds({ name: "Execute Subprocess" }); + await handle2.dragTo(diagram.get(), { + targetPosition: { x: targetBox.x + targetBox.width / 2, y: targetBox.y + targetBox.height / 2 }, + }); + + // Connect Execute Subprocess -> Process Results + await nodes.showNodeHandles({ name: "Execute Subprocess" }); + const handle3 = callActivity.getByTitle("Add Sequence Flow"); + await expect(handle3).toBeVisible(); + targetBox = await nodes.getNodeBounds({ name: "Process Results" }); + await handle3.dragTo(diagram.get(), { + targetPosition: { x: targetBox.x + targetBox.width / 2, y: targetBox.y + targetBox.height / 2 }, + }); + + // Connect Process Results -> End Event + await nodes.showNodeHandles({ name: "Process Results" }); + const handle4 = processResults.getByTitle("Add Sequence Flow"); + await expect(handle4).toBeVisible(); + targetBox = await nodes.getNodeBounds({ id: await nodes.getIdByType(NodeType.END_EVENT) }); + await handle4.dragTo(diagram.get(), { + targetPosition: { x: targetBox.x + targetBox.width / 2, y: targetBox.y + targetBox.height / 2 }, + }); + + await diagram.resetFocus(); Review Comment: Why? If it is not clear, probably it should be behind a fixture. -- 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]
