ljmotta commented on code in PR #3616:
URL: 
https://github.com/apache/incubator-kie-tools/pull/3616#discussion_r3350389353


##########
packages/bpmn-editor/tests-e2e/propertiesPanel/changeStartEventProperties.spec.ts:
##########
@@ -231,4 +231,35 @@ test.describe("Change Properties - Error/Escalation Start 
Events in Event Sub-Pr
 
     expect(await 
startEventPropertiesPanel.getEscalationName()).toBe("StartEscalation");
   });
+
+  test.describe("Message Event - ItemDefinition Validation", () => {
+    test("should create itemDefinition when message start event is 
configured", async ({
+      palette,
+      nodes,
+      startEventPropertiesPanel,
+      jsonModel,
+    }) => {
+      await palette.dragNewNode({ type: NodeType.START_EVENT, targetPosition: 
{ x: 100, y: 100 } });
+      await expect(nodes.getByType(NodeType.START_EVENT)).toBeVisible();
+
+      const messageName = "TestMessage";
+      await startEventPropertiesPanel.setMessageDefinition({
+        messageName,
+        startEventLocator: nodes.getByType(NodeType.START_EVENT).first(),
+      });
+
+      const definitions = await jsonModel.getDefinitions();
+      const rootElements = definitions?.rootElement || [];
+
+      const message = rootElements.find((el: any) => el.__$$element === 
"message" && el["@_name"] === messageName);
+      expect(message).toBeDefined();
+      expect(message?.["@_itemRef"]).toBeDefined();
+
+      const itemDefinitionId = message?.["@_itemRef"];
+      const itemDefinition = rootElements.find(
+        (el: any) => el.__$$element === "itemDefinition" && el["@_id"] === 
itemDefinitionId
+      );
+      expect(itemDefinition).toBeDefined();

Review Comment:
   Assert the entire object instead of searching for specific values.



##########
packages/bpmn-editor/tests-e2e/propertiesPanel/changeStartEventProperties.spec.ts:
##########
@@ -231,4 +231,35 @@ test.describe("Change Properties - Error/Escalation Start 
Events in Event Sub-Pr
 
     expect(await 
startEventPropertiesPanel.getEscalationName()).toBe("StartEscalation");
   });
+
+  test.describe("Message Event - ItemDefinition Validation", () => {
+    test("should create itemDefinition when message start event is 
configured", async ({
+      palette,
+      nodes,
+      startEventPropertiesPanel,
+      jsonModel,
+    }) => {
+      await palette.dragNewNode({ type: NodeType.START_EVENT, targetPosition: 
{ x: 100, y: 100 } });
+      await expect(nodes.getByType(NodeType.START_EVENT)).toBeVisible();
+
+      const messageName = "TestMessage";

Review Comment:
   You can inline this variable.



-- 
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]

Reply via email to