diff --git a/packages/dmn-editor/src/diagram/edges/Waypoints.tsx b/packages/dmn-editor/src/diagram/edges/Waypoints.tsx index ec3f318c001..e5fca361a2a 100644 --- a/packages/dmn-editor/src/diagram/edges/Waypoints.tsx +++ b/packages/dmn-editor/src/diagram/edges/Waypoints.tsx @@ -105,6 +105,7 @@ export function Waypoint({ return ( ({ nodes: async ({ page, diagram, browserName }, use) => { await use(new Nodes(page, diagram, browserName)); }, - edges: async ({ page, nodes }, use) => { - await use(new Edges(page, nodes)); + edges: async ({ page, nodes, diagram }, use) => { + await use(new Edges(page, nodes, diagram)); }, palette: async ({ page, diagram, nodes }, use) => { await use(new Palette(page, diagram, nodes)); diff --git a/packages/dmn-editor/tests/e2e/__fixtures__/edges.ts b/packages/dmn-editor/tests/e2e/__fixtures__/edges.ts index 110ed64d507..7bde0b20643 100644 --- a/packages/dmn-editor/tests/e2e/__fixtures__/edges.ts +++ b/packages/dmn-editor/tests/e2e/__fixtures__/edges.ts @@ -19,6 +19,7 @@ import { Page } from "@playwright/test"; import { Nodes } from "./nodes"; +import { Diagram } from "./diagram"; export enum EdgeType { ASSOCIATION = "association", @@ -28,7 +29,7 @@ export enum EdgeType { } export class Edges { - constructor(public page: Page, public nodes: Nodes) {} + constructor(public page: Page, public nodes: Nodes, public diagram: Diagram) {} public async get(args: { from: string; to: string }) { const from = await this.nodes.getId({ name: args.from }); @@ -45,6 +46,21 @@ export class Edges { await (await this.get({ from: args.from, to: args.to })).dblclick(); } + public async moveNthWaypoint(args: { + from: string; + to: string; + nth: number; + targetPosition: { x: number; y: number }; + }) { + await this.select({ from: args.from, to: args.to }); + + await (await this.get({ from: args.from, to: args.to })) + .locator(`[data-waypointindex="${args.nth}"]`) + .dragTo(this.diagram.get(), { + targetPosition: args.targetPosition, + }); + } + public async delete(args: { from: string; to: string; isBackspace?: boolean }) { await this.select({ from: args.from, to: args.to }); if (args.isBackspace) { @@ -55,6 +71,7 @@ export class Edges { } public async select(args: { from: string; to: string }) { - await (await this.get({ from: args.from, to: args.to })).click(); + // because of the waypoints on the edge, we can not click into the edge bounding box middle + await (await this.get({ from: args.from, to: args.to })).locator("circle").nth(1).click(); } } diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drdArtifacts/add-association-waypoint-and-move-it.png b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drdArtifacts/add-association-waypoint-and-move-it.png new file mode 100644 index 00000000000..62a3f77ed73 Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drdArtifacts/add-association-waypoint-and-move-it.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drdArtifacts/add-multiple-association-waypoint-and-move-them.png b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drdArtifacts/add-multiple-association-waypoint-and-move-them.png new file mode 100644 index 00000000000..d2944fc101e Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drdArtifacts/add-multiple-association-waypoint-and-move-them.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-authority-requirement-waypoint-and-move-it.png b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-authority-requirement-waypoint-and-move-it.png new file mode 100644 index 00000000000..6affb970283 Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-authority-requirement-waypoint-and-move-it.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-information-requirement-waypoint-and-move-it.png b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-information-requirement-waypoint-and-move-it.png new file mode 100644 index 00000000000..082f239ad13 Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-information-requirement-waypoint-and-move-it.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-knowledge-requirement-waypoint-and-move-it.png b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-knowledge-requirement-waypoint-and-move-it.png new file mode 100644 index 00000000000..dadb9638cc8 Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-knowledge-requirement-waypoint-and-move-it.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-multiple-authority-requirement-waypoints-and-move-them.png b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-multiple-authority-requirement-waypoints-and-move-them.png new file mode 100644 index 00000000000..7af6fea728a Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-multiple-authority-requirement-waypoints-and-move-them.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-multiple-information-requirement-waypoints-and-move-them.png b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-multiple-information-requirement-waypoints-and-move-them.png new file mode 100644 index 00000000000..fb2444aec8a Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/Google-Chrome/drgRequirements/add-multiple-information-requirement-waypoints-and-move-them.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drdArtifacts/add-association-waypoint-and-move-it.png b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drdArtifacts/add-association-waypoint-and-move-it.png new file mode 100644 index 00000000000..392e34af151 Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drdArtifacts/add-association-waypoint-and-move-it.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drdArtifacts/add-multiple-association-waypoint-and-move-them.png b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drdArtifacts/add-multiple-association-waypoint-and-move-them.png new file mode 100644 index 00000000000..0a8f2b2295b Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drdArtifacts/add-multiple-association-waypoint-and-move-them.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-authority-requirement-waypoint-and-move-it.png b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-authority-requirement-waypoint-and-move-it.png new file mode 100644 index 00000000000..2ec8554336a Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-authority-requirement-waypoint-and-move-it.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-information-requirement-waypoint-and-move-it.png b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-information-requirement-waypoint-and-move-it.png new file mode 100644 index 00000000000..dc6511ae185 Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-information-requirement-waypoint-and-move-it.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-knowledge-requirement-waypoint-and-move-it.png b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-knowledge-requirement-waypoint-and-move-it.png new file mode 100644 index 00000000000..0370ed76f18 Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-knowledge-requirement-waypoint-and-move-it.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-multiple-authority-requirement-waypoints-and-move-them.png b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-multiple-authority-requirement-waypoints-and-move-them.png new file mode 100644 index 00000000000..d267ff7ab9c Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-multiple-authority-requirement-waypoints-and-move-them.png differ diff --git a/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-multiple-information-requirement-waypoints-and-move-them.png b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-multiple-information-requirement-waypoints-and-move-them.png new file mode 100644 index 00000000000..a7b0759604c Binary files /dev/null and b/packages/dmn-editor/tests/e2e/__screenshots__/chromium/drgRequirements/add-multiple-information-requirement-waypoints-and-move-them.png differ diff --git a/packages/dmn-editor/tests/e2e/drdArtifacts/addAssociationWaypoint.spec.ts b/packages/dmn-editor/tests/e2e/drdArtifacts/addAssociationWaypoint.spec.ts index fcfc251d151..b982d2a7405 100644 --- a/packages/dmn-editor/tests/e2e/drdArtifacts/addAssociationWaypoint.spec.ts +++ b/packages/dmn-editor/tests/e2e/drdArtifacts/addAssociationWaypoint.spec.ts @@ -20,6 +20,7 @@ import { expect } from "@playwright/test"; import { test } from "../__fixtures__/base"; import { DefaultNodeName, NodeType } from "../__fixtures__/nodes"; +import { TestAnnotations } from "@kie-tools/playwright-base/annotations"; test.beforeEach(async ({ editor }) => { await editor.open(); @@ -35,29 +36,88 @@ test.describe("Add edge waypoint - Association", () => { }); }); - test("should add single waypoint to Association edge and should not move when the ending node is moved", async ({ - diagram, - nodes, - edges, - }) => { - await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.TEXT_ANNOTATION }); - await nodes.move({ name: DefaultNodeName.TEXT_ANNOTATION, targetPosition: { x: 500, y: 300 } }); + test.describe("Add Single Waypoint", () => { + test("Association edge waypoint should not move when the ending node is moved", async ({ + diagram, + edges, + nodes, + }) => { + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.TEXT_ANNOTATION }); + await nodes.move({ name: DefaultNodeName.TEXT_ANNOTATION, targetPosition: { x: 500, y: 300 } }); - await expect(diagram.get()).toHaveScreenshot("add-association-waypoint-and-not-move-it.png"); + await expect(diagram.get()).toHaveScreenshot("add-association-waypoint-and-not-move-it.png"); + }); + + test("Association edge ending nodes should not move when the waypoint is moved", async ({ + diagram, + edges, + browserName, + }) => { + test.skip(browserName === "webkit", "https://github.com/apache/incubator-kie-issues/issues/991"); + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + description: "https://github.com/apache/incubator-kie-issues/issues/991", + }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.TEXT_ANNOTATION }); + await edges.moveNthWaypoint({ + from: DefaultNodeName.INPUT_DATA, + to: DefaultNodeName.TEXT_ANNOTATION, + nth: 1, + targetPosition: { x: 500, y: 300 }, + }); + + await expect(diagram.get()).toHaveScreenshot("add-association-waypoint-and-move-it.png"); + }); }); - test("should add multiple waypoints to Association edge and should not move when the ending nodes are moved", async ({ - diagram, - nodes, - edges, - }) => { - await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.TEXT_ANNOTATION }); - await nodes.move({ name: DefaultNodeName.TEXT_ANNOTATION, targetPosition: { x: 200, y: 500 } }); + test.describe("Add Multiple Waypoints", () => { + test("Association edge waypoints should not move when the ending nodes are moved", async ({ + diagram, + nodes, + edges, + }) => { + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.TEXT_ANNOTATION }); + await nodes.move({ name: DefaultNodeName.TEXT_ANNOTATION, targetPosition: { x: 200, y: 500 } }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.TEXT_ANNOTATION }); + await nodes.move({ name: DefaultNodeName.TEXT_ANNOTATION, targetPosition: { x: 500, y: 500 } }); + await nodes.move({ name: DefaultNodeName.INPUT_DATA, targetPosition: { x: 500, y: 100 } }); - await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.TEXT_ANNOTATION }); - await nodes.move({ name: DefaultNodeName.TEXT_ANNOTATION, targetPosition: { x: 500, y: 500 } }); - await nodes.move({ name: DefaultNodeName.INPUT_DATA, targetPosition: { x: 500, y: 100 } }); + await expect(diagram.get()).toHaveScreenshot("add-multiple-association-waypoint-and-not-move-them.png"); + }); + + test("Association edge ending nodes should not move when the waypoints are moved", async ({ + diagram, + nodes, + edges, + browserName, + }) => { + test.skip(browserName === "webkit", "https://github.com/apache/incubator-kie-issues/issues/991"); + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + description: "https://github.com/apache/incubator-kie-issues/issues/991", + }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.TEXT_ANNOTATION }); + await nodes.move({ name: DefaultNodeName.TEXT_ANNOTATION, targetPosition: { x: 200, y: 500 } }); - await expect(diagram.get()).toHaveScreenshot("add-multiple-association-waypoint-and-not-move-them.png"); + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.TEXT_ANNOTATION }); + + await edges.moveNthWaypoint({ + from: DefaultNodeName.INPUT_DATA, + to: DefaultNodeName.TEXT_ANNOTATION, + nth: 1, + targetPosition: { x: 500, y: 100 }, + }); + await edges.moveNthWaypoint({ + from: DefaultNodeName.INPUT_DATA, + to: DefaultNodeName.TEXT_ANNOTATION, + nth: 2, + targetPosition: { x: 500, y: 500 }, + }); + + await expect(diagram.get()).toHaveScreenshot("add-multiple-association-waypoint-and-move-them.png"); + }); }); }); diff --git a/packages/dmn-editor/tests/e2e/drgRequirements/addAuthorityRequirementWaypoint.spec.ts b/packages/dmn-editor/tests/e2e/drgRequirements/addAuthorityRequirementWaypoint.spec.ts index 31480a53cbf..2ba710c2a9a 100644 --- a/packages/dmn-editor/tests/e2e/drgRequirements/addAuthorityRequirementWaypoint.spec.ts +++ b/packages/dmn-editor/tests/e2e/drgRequirements/addAuthorityRequirementWaypoint.spec.ts @@ -20,6 +20,7 @@ import { expect } from "@playwright/test"; import { test } from "../__fixtures__/base"; import { DefaultNodeName, NodeType } from "../__fixtures__/nodes"; +import { TestAnnotations } from "@kie-tools/playwright-base/annotations"; test.beforeEach(async ({ editor }) => { await editor.open(); @@ -35,29 +36,90 @@ test.describe("Add edge waypoint - Authority Requirement", () => { }); }); - test("should add single waypoint to Authority Requirement and should not move when the ending node is moved", async ({ - diagram, - nodes, - edges, - }) => { - await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE }); - await nodes.move({ name: DefaultNodeName.KNOWLEDGE_SOURCE, targetPosition: { x: 300, y: 300 } }); + test.describe("Add Single Waypoint", () => { + test("Authority Requirement waypoint should not move when the ending node is moved", async ({ + diagram, + nodes, + edges, + }) => { + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE }); + await nodes.move({ name: DefaultNodeName.KNOWLEDGE_SOURCE, targetPosition: { x: 300, y: 300 } }); - await expect(diagram.get()).toHaveScreenshot("add-authority-requirement-waypoint-and-not-move-it.png"); + await expect(diagram.get()).toHaveScreenshot("add-authority-requirement-waypoint-and-not-move-it.png"); + }); + + test("Authority Requirement ending nodes should not move when the waypoint is moved", async ({ + diagram, + edges, + browserName, + }) => { + test.skip(browserName === "webkit", "https://github.com/apache/incubator-kie-issues/issues/991"); + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + description: "https://github.com/apache/incubator-kie-issues/issues/991", + }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE }); + await edges.moveNthWaypoint({ + from: DefaultNodeName.INPUT_DATA, + to: DefaultNodeName.KNOWLEDGE_SOURCE, + nth: 1, + targetPosition: { x: 300, y: 300 }, + }); + + await expect(diagram.get()).toHaveScreenshot("add-authority-requirement-waypoint-and-move-it.png"); + }); }); - test("should add multiple waypoints to Authority Requirement and should not move when the ending nodes are moved", async ({ - diagram, - nodes, - edges, - }) => { - await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE }); - await nodes.move({ name: DefaultNodeName.KNOWLEDGE_SOURCE, targetPosition: { x: 200, y: 500 } }); + test.describe("Add Multiple Waypoints", () => { + test("Authority Requirement waypoints should not move when the ending nodes are moved", async ({ + diagram, + nodes, + edges, + }) => { + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE }); + await nodes.move({ name: DefaultNodeName.KNOWLEDGE_SOURCE, targetPosition: { x: 200, y: 500 } }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE }); + await nodes.move({ name: DefaultNodeName.KNOWLEDGE_SOURCE, targetPosition: { x: 500, y: 500 } }); + await nodes.move({ name: DefaultNodeName.INPUT_DATA, targetPosition: { x: 500, y: 100 } }); - await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE }); - await nodes.move({ name: DefaultNodeName.KNOWLEDGE_SOURCE, targetPosition: { x: 500, y: 500 } }); - await nodes.move({ name: DefaultNodeName.INPUT_DATA, targetPosition: { x: 500, y: 100 } }); + await expect(diagram.get()).toHaveScreenshot( + "add-multiple-authority-requirement-waypoints-and-not-move-them.png" + ); + }); + + test("Authority Requirement ending nodes should not move when the waypoints are moved", async ({ + diagram, + nodes, + edges, + browserName, + }) => { + test.skip(browserName === "webkit", "https://github.com/apache/incubator-kie-issues/issues/991"); + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + description: "https://github.com/apache/incubator-kie-issues/issues/991", + }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE }); + await nodes.move({ name: DefaultNodeName.KNOWLEDGE_SOURCE, targetPosition: { x: 200, y: 500 } }); - await expect(diagram.get()).toHaveScreenshot("add-multiple-authority-requirement-waypoints-and-not-move-them.png"); + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE }); + + await edges.moveNthWaypoint({ + from: DefaultNodeName.INPUT_DATA, + to: DefaultNodeName.KNOWLEDGE_SOURCE, + nth: 1, + targetPosition: { x: 500, y: 100 }, + }); + await edges.moveNthWaypoint({ + from: DefaultNodeName.INPUT_DATA, + to: DefaultNodeName.KNOWLEDGE_SOURCE, + nth: 2, + targetPosition: { x: 500, y: 500 }, + }); + + await expect(diagram.get()).toHaveScreenshot("add-multiple-authority-requirement-waypoints-and-move-them.png"); + }); }); }); diff --git a/packages/dmn-editor/tests/e2e/drgRequirements/addInformationRequirementWaypoint.spec.ts b/packages/dmn-editor/tests/e2e/drgRequirements/addInformationRequirementWaypoint.spec.ts index 308bb13b8ae..ab70358ec4a 100644 --- a/packages/dmn-editor/tests/e2e/drgRequirements/addInformationRequirementWaypoint.spec.ts +++ b/packages/dmn-editor/tests/e2e/drgRequirements/addInformationRequirementWaypoint.spec.ts @@ -20,6 +20,7 @@ import { expect } from "@playwright/test"; import { test } from "../__fixtures__/base"; import { DefaultNodeName, NodeType } from "../__fixtures__/nodes"; +import { TestAnnotations } from "@kie-tools/playwright-base/annotations"; test.beforeEach(async ({ editor }) => { await editor.open(); @@ -35,31 +36,90 @@ test.describe("Add edge waypoint - Information Requirement", () => { }); }); - test("should add single waypoint to Information Requirement edge and should not move when the ending node is moved", async ({ - diagram, - nodes, - edges, - }) => { - await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION }); - await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 300, y: 300 } }); + test.describe("Add Single Waypoint", () => { + test("Information Requirement edge waypoint should not move when the ending node is moved", async ({ + diagram, + nodes, + edges, + }) => { + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION }); + await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 300, y: 300 } }); - await expect(diagram.get()).toHaveScreenshot("add-information-requirement-waypoint-and-not-move-it.png"); + await expect(diagram.get()).toHaveScreenshot("add-information-requirement-waypoint-and-not-move-it.png"); + }); + + test("Information Requirement edge ending nodes should not move when the waypoint is moved", async ({ + diagram, + edges, + browserName, + }) => { + test.skip(browserName === "webkit", "https://github.com/apache/incubator-kie-issues/issues/991"); + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + description: "https://github.com/apache/incubator-kie-issues/issues/991", + }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION }); + await edges.moveNthWaypoint({ + from: DefaultNodeName.INPUT_DATA, + to: DefaultNodeName.DECISION, + nth: 1, + targetPosition: { x: 300, y: 300 }, + }); + + await expect(diagram.get()).toHaveScreenshot("add-information-requirement-waypoint-and-move-it.png"); + }); }); - test("should add multiple waypoints to Information Requirement edge and should not move when the ending nodes are moved", async ({ - diagram, - nodes, - edges, - }) => { - await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION }); - await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 200, y: 500 } }); - - await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION }); - await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 500, y: 500 } }); - await nodes.move({ name: DefaultNodeName.INPUT_DATA, targetPosition: { x: 500, y: 100 } }); - - await expect(diagram.get()).toHaveScreenshot( - "add-multiple-information-requirement-waypoints-and-not-move-them.png" - ); + test.describe("Add Multiple Waypoints", () => { + test("Information Requirement edge waypoints should not move when the ending nodes are moved", async ({ + diagram, + nodes, + edges, + }) => { + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION }); + await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 200, y: 500 } }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION }); + await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 500, y: 500 } }); + await nodes.move({ name: DefaultNodeName.INPUT_DATA, targetPosition: { x: 500, y: 100 } }); + + await expect(diagram.get()).toHaveScreenshot( + "add-multiple-information-requirement-waypoints-and-not-move-them.png" + ); + }); + + test("Information Requirement edge ending nodes should not move when the waypoints are moved", async ({ + diagram, + nodes, + edges, + browserName, + }) => { + test.skip(browserName === "webkit", "https://github.com/apache/incubator-kie-issues/issues/991"); + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + description: "https://github.com/apache/incubator-kie-issues/issues/991", + }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION }); + await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 200, y: 500 } }); + + await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION }); + + await edges.moveNthWaypoint({ + from: DefaultNodeName.INPUT_DATA, + to: DefaultNodeName.DECISION, + nth: 1, + targetPosition: { x: 500, y: 100 }, + }); + await edges.moveNthWaypoint({ + from: DefaultNodeName.INPUT_DATA, + to: DefaultNodeName.DECISION, + nth: 2, + targetPosition: { x: 500, y: 500 }, + }); + + await expect(diagram.get()).toHaveScreenshot("add-multiple-information-requirement-waypoints-and-move-them.png"); + }); }); }); diff --git a/packages/dmn-editor/tests/e2e/drgRequirements/addKnowledgeRequirementWaypoint.spec.ts b/packages/dmn-editor/tests/e2e/drgRequirements/addKnowledgeRequirementWaypoint.spec.ts index 9990c815f4b..235cb259d69 100644 --- a/packages/dmn-editor/tests/e2e/drgRequirements/addKnowledgeRequirementWaypoint.spec.ts +++ b/packages/dmn-editor/tests/e2e/drgRequirements/addKnowledgeRequirementWaypoint.spec.ts @@ -20,6 +20,7 @@ import { expect } from "@playwright/test"; import { test } from "../__fixtures__/base"; import { DefaultNodeName, NodeType } from "../__fixtures__/nodes"; +import { TestAnnotations } from "@kie-tools/playwright-base/annotations"; test.beforeEach(async ({ editor }) => { await editor.open(); @@ -35,29 +36,92 @@ test.describe("Add edge waypoint - Knowledge Requirement", () => { }); }); - test("should add single waypoint to Knowledge Requirement edge and should not move when the ending node is moved", async ({ - diagram, - nodes, - edges, - }) => { - await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION }); - await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 300, y: 300 } }); + test.describe("Add Single Waypoint", () => { + test("Knowledge Requirement edge waypoint should not move when the ending node is moved", async ({ + diagram, + nodes, + edges, + }) => { + await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION }); + await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 300, y: 300 } }); - await expect(diagram.get()).toHaveScreenshot("add-knowledge-requirement-waypoint-and-not-move-it.png"); + await expect(diagram.get()).toHaveScreenshot("add-knowledge-requirement-waypoint-and-not-move-it.png"); + }); + + test("Knowledge Requirement edge ending nodes should not move when the waypoint is moved", async ({ + diagram, + edges, + browserName, + }) => { + test.skip(browserName === "webkit", "https://github.com/apache/incubator-kie-issues/issues/991"); + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + description: "https://github.com/apache/incubator-kie-issues/issues/991", + }); + + await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION }); + await edges.moveNthWaypoint({ + from: DefaultNodeName.BKM, + to: DefaultNodeName.DECISION, + nth: 1, + targetPosition: { x: 300, y: 300 }, + }); + + await expect(diagram.get()).toHaveScreenshot("add-knowledge-requirement-waypoint-and-move-it.png"); + }); }); - test("should add multiple waypoints to Knowledge Requirement edge and should not move when the ending nodes are moved", async ({ - diagram, - nodes, - edges, - }) => { - await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION }); - await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 200, y: 500 } }); + test.describe("Add Multiple Waypoints", () => { + test("Knowledge Requirement edge waypoints should not move when the ending nodes are moved", async ({ + diagram, + nodes, + edges, + }) => { + await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION }); + await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 200, y: 500 } }); + + await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION }); + await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 500, y: 500 } }); + await nodes.move({ name: DefaultNodeName.BKM, targetPosition: { x: 500, y: 100 } }); - await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION }); - await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 500, y: 500 } }); - await nodes.move({ name: DefaultNodeName.BKM, targetPosition: { x: 500, y: 100 } }); + await expect(diagram.get()).toHaveScreenshot( + "add-multiple-knowledge-requirement-waypoints-and-not-move-them.png" + ); + }); + + test("Knowledge Requirement edge ending nodes should not move when the waypoints are moved", async ({ + diagram, + nodes, + edges, + browserName, + }) => { + test.skip(browserName === "webkit", "https://github.com/apache/incubator-kie-issues/issues/991"); + test.info().annotations.push({ + type: TestAnnotations.REGRESSION, + description: "https://github.com/apache/incubator-kie-issues/issues/991", + }); + + await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION }); + await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 200, y: 500 } }); - await expect(diagram.get()).toHaveScreenshot("add-multiple-knowledge-requirement-waypoints-and-not-move-them.png"); + await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION }); + + await edges.moveNthWaypoint({ + from: DefaultNodeName.BKM, + to: DefaultNodeName.DECISION, + nth: 1, + targetPosition: { x: 500, y: 100 }, + }); + await edges.moveNthWaypoint({ + from: DefaultNodeName.BKM, + to: DefaultNodeName.DECISION, + nth: 2, + targetPosition: { x: 500, y: 500 }, + }); + + await expect(diagram.get()).toHaveScreenshot( + "add-multiple-knowledge-requirement-waypoints-and-not-move-them.png" + ); + }); }); });