Skip to content

Commit

Permalink
finish deleteEdgeWaypoint.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jomarko committed Mar 6, 2024
1 parent 9a99f3c commit f007a9d
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 30 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.beforeEach(async ({ editor }) => {
await editor.open();
});

test.describe.only("Delete edge waypoint - Association", () => {
test.describe("Delete edge waypoint - Association", () => {
test.beforeEach(async ({ palette, nodes, browserName }) => {
test.skip(browserName === "webkit", "https://github.com/apache/incubator-kie-issues/issues/991");
test.info().annotations.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,51 @@ test.describe("Delete edge waypoint - Authority Requirement", () => {
});
});

test("should delete first waypoint of the Authoriry Requirement and second waypoint should stay", async ({
test("should delete the single Association edge waypoint to make it straight", async ({ diagram, edges }) => {
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");

await edges.deleteNthWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE, nth: 1 });
await expect(diagram.get()).toHaveScreenshot("delete-authority-requirement-waypoint-straight-edge.png");
});

test("should delete one of Authority Requirement edge waypoints to reduce edge corners", async ({
diagram,
nodes,
edges,
}) => {
await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE });
const boundingBox = await nodes.get({ name: DefaultNodeName.KNOWLEDGE_SOURCE }).boundingBox();
await nodes
.get({ name: DefaultNodeName.KNOWLEDGE_SOURCE })
.dragTo(diagram.get(), { targetPosition: { x: 100 + (boundingBox?.width ?? 0) / 2, y: 500 } });
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
.get({ name: DefaultNodeName.KNOWLEDGE_SOURCE })
.dragTo(diagram.get(), { targetPosition: { x: 500, y: 500 } });
await nodes.get({ name: DefaultNodeName.INPUT_DATA }).dragTo(diagram.get(), { targetPosition: { x: 500, y: 100 } });

await edges.deleteNthWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.KNOWLEDGE_SOURCE, nth: 1 });
await expect(diagram.get()).toHaveScreenshot();
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");

await edges.deleteNthWaypoint({
from: DefaultNodeName.INPUT_DATA,
to: DefaultNodeName.KNOWLEDGE_SOURCE,
nth: 1,
});
await expect(diagram.get()).toHaveScreenshot("delete-authority-requirement-waypoint-edge-with-corner.png");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,55 @@ test.describe("Delete edge waypoint - Information Requirement", () => {
});
});

test("should delete first waypoint of the Information Requirement edge and second waypoint should stay", async ({
test("should delete the single Information Requirement edge waypoint to make it straight", async ({
diagram,
edges,
}) => {
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");

await edges.deleteNthWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION, nth: 1 });

await expect(diagram.get()).toHaveScreenshot("delete-information-requirement-waypoint-straight-edge.png");
});

test("should delete one of Information Requirement edge waypoints to reduce edge corners", async ({
diagram,
nodes,
edges,
}) => {
await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION });
const boundingBox = await nodes.get({ name: DefaultNodeName.DECISION }).boundingBox();
await nodes
.get({ name: DefaultNodeName.DECISION })
.dragTo(diagram.get(), { targetPosition: { x: 100 + (boundingBox?.width ?? 0) / 2, y: 500 } });
await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 200, y: 500 } });

await edges.addWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION });
await nodes.get({ name: DefaultNodeName.DECISION }).dragTo(diagram.get(), { targetPosition: { x: 500, y: 500 } });
await nodes.get({ name: DefaultNodeName.INPUT_DATA }).dragTo(diagram.get(), { targetPosition: { x: 500, y: 100 } });

await edges.deleteNthWaypoint({ from: DefaultNodeName.INPUT_DATA, to: DefaultNodeName.DECISION, nth: 1 });
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");

await expect(diagram.get()).toHaveScreenshot();
await edges.deleteNthWaypoint({
from: DefaultNodeName.INPUT_DATA,
to: DefaultNodeName.DECISION,
nth: 1,
});
await expect(diagram.get()).toHaveScreenshot("delete-information-requirement-waypoint-edge-with-corner.png");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,59 @@ test.describe("Delete edge waypoint - Knowledge Requirement", () => {
});
});

test("should delete first waypoint of the Knowledge Requirement edge and second waypoint should stay", async ({
test("should delete the single Knowledge Requirement edge waypoint to make it straight", async ({
diagram,
edges,
}) => {
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");

await edges.deleteNthWaypoint({
from: DefaultNodeName.BKM,
to: DefaultNodeName.DECISION,
nth: 1,
});

await expect(diagram.get()).toHaveScreenshot("delete-knowledge-requirement-waypoint-straight-edge.png");
});

test("should delete one of Knowledge Requirement edge waypoints to reduce edge corner", async ({
diagram,
nodes,
edges,
}) => {
await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION });
const boundingBox = await nodes.get({ name: DefaultNodeName.DECISION }).boundingBox();
await nodes
.get({ name: DefaultNodeName.DECISION })
.dragTo(diagram.get(), { targetPosition: { x: 100 + (boundingBox?.width ?? 0) / 2, y: 500 } });
await nodes.move({ name: DefaultNodeName.DECISION, targetPosition: { x: 200, y: 500 } });

await edges.addWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION });
await nodes.get({ name: DefaultNodeName.DECISION }).dragTo(diagram.get(), { targetPosition: { x: 500, y: 500 } });
await nodes.get({ name: DefaultNodeName.BKM }).dragTo(diagram.get(), { targetPosition: { x: 500, y: 100 } });

await edges.deleteNthWaypoint({ from: DefaultNodeName.BKM, to: DefaultNodeName.DECISION, nth: 1 });
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");

await expect(diagram.get()).toHaveScreenshot();
await edges.deleteNthWaypoint({
from: DefaultNodeName.BKM,
to: DefaultNodeName.DECISION,
nth: 1,
});
await expect(diagram.get()).toHaveScreenshot("delete-knowledge-requirement-waypoint-edge-with-corner.png");
});
});

0 comments on commit f007a9d

Please sign in to comment.