From a3d0499bae66c26203e8c8fdd77c2e0bf0a2d404 Mon Sep 17 00:00:00 2001 From: Luiz Motta Date: Wed, 27 Mar 2024 21:38:33 -0300 Subject: [PATCH] Code review --- .../e2e/__fixtures__/jsonModel/drgElements.ts | 15 --------------- .../dmn-editor/tests/e2e/__fixtures__/nodes.ts | 1 + .../invalidAuthorityRequirement.spec.ts | 8 ++++---- .../invalidKnowledgeRequirement.spec.ts | 8 ++++---- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/packages/dmn-editor/tests/e2e/__fixtures__/jsonModel/drgElements.ts b/packages/dmn-editor/tests/e2e/__fixtures__/jsonModel/drgElements.ts index a1dc0e907b3..ce6e958e1cd 100644 --- a/packages/dmn-editor/tests/e2e/__fixtures__/jsonModel/drgElements.ts +++ b/packages/dmn-editor/tests/e2e/__fixtures__/jsonModel/drgElements.ts @@ -29,24 +29,9 @@ import { DMNDI15__DMNShape, } from "@kie-tools/dmn-marshaller/dist/schemas/dmn-1_5/ts-gen/types"; import { Page } from "@playwright/test"; -import { STORYBOOK__DMN_EDITOR_MODEL } from "../jsonModel"; type AllDrgElements = NonNullable[0]; -export enum DataType { - Undefined = "", - Any = "Any", - Boolean = "boolean", - Context = "context", - Date = "date", - DateTime = "date and time", - DateTimeDuration = "days and time duration", - Number = "number", - String = "string", - Time = "time", - YearsMonthsDuration = "years and months duration", -} - export class DrgElements { constructor(public page: Page) {} diff --git a/packages/dmn-editor/tests/e2e/__fixtures__/nodes.ts b/packages/dmn-editor/tests/e2e/__fixtures__/nodes.ts index b4a4ef27a77..6c79cff4a16 100644 --- a/packages/dmn-editor/tests/e2e/__fixtures__/nodes.ts +++ b/packages/dmn-editor/tests/e2e/__fixtures__/nodes.ts @@ -164,6 +164,7 @@ export class Nodes { return this.get({ name: args.name }).locator("span", { hasText: args.name }).dblclick(); } + // Used for testing invalid edges. No edge is created using this method. public async startDraggingEdge(args: { from: string; edgeType: EdgeType }) { await this.select({ name: args.from, position: NodePosition.TOP }); await this.get({ name: args.from }).getByTitle(this.getAddEdgeTitle(args.edgeType)).hover(); diff --git a/packages/dmn-editor/tests/e2e/drgRequirements/invalidAuthorityRequirement.spec.ts b/packages/dmn-editor/tests/e2e/drgRequirements/invalidAuthorityRequirement.spec.ts index 00786328b33..8d4205ab017 100644 --- a/packages/dmn-editor/tests/e2e/drgRequirements/invalidAuthorityRequirement.spec.ts +++ b/packages/dmn-editor/tests/e2e/drgRequirements/invalidAuthorityRequirement.spec.ts @@ -35,7 +35,7 @@ test.describe("Invalid edge - Authority Requirement", () => { }); }); - test("shouldn't add an Authority Requirement edge from Input Data node to Input Data node", async ({ + test("shouldn't add an Authority Requirement edge from Knowledge Source node to Input Data node", async ({ palette, nodes, edges, @@ -77,7 +77,7 @@ test.describe("Invalid edge - Authority Requirement", () => { await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA })).toHaveClass(/.*dimmed/); }); - test("shouldn't add an Authority Requirement edge from Input Data node to Decision Service node", async ({ + test("shouldn't add an Authority Requirement edge from Knowledge Source node to Decision Service node", async ({ palette, nodes, edges, @@ -108,7 +108,7 @@ test.describe("Invalid edge - Authority Requirement", () => { await expect(nodes.get({ name: DefaultNodeName.DECISION_SERVICE })).toHaveClass(/.*dimmed/); }); - test("shouldn't add an Authority Requirement edge from Input Data node to Group node", async ({ + test("shouldn't add an Authority Requirement edge from Knowledge Source node to Group node", async ({ palette, nodes, edges, @@ -139,7 +139,7 @@ test.describe("Invalid edge - Authority Requirement", () => { await expect(nodes.get({ name: DefaultNodeName.GROUP })).toHaveClass(/.*dimmed/); }); - test("shouldn't add an Authority Requirement edge from Input Data node to Text Annotation node", async ({ + test("shouldn't add an Authority Requirement edge from Knowledge Source node to Text Annotation node", async ({ palette, nodes, edges, diff --git a/packages/dmn-editor/tests/e2e/drgRequirements/invalidKnowledgeRequirement.spec.ts b/packages/dmn-editor/tests/e2e/drgRequirements/invalidKnowledgeRequirement.spec.ts index 7daa7283389..bb331d11390 100644 --- a/packages/dmn-editor/tests/e2e/drgRequirements/invalidKnowledgeRequirement.spec.ts +++ b/packages/dmn-editor/tests/e2e/drgRequirements/invalidKnowledgeRequirement.spec.ts @@ -35,7 +35,7 @@ test.describe("Invalid edge - Knowledge Requirement", () => { }); }); - test("shouldn't add an Knowledge Requirement edge from Input Data node to Input Data node", async ({ + test("shouldn't add an Knowledge Requirement edge from BKM node to Input Data node", async ({ palette, nodes, edges, @@ -77,7 +77,7 @@ test.describe("Invalid edge - Knowledge Requirement", () => { await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA })).toHaveClass(/.*dimmed/); }); - test("shouldn't add an Knowledge Requirement edge from Input Data node to Knowledge Source node", async ({ + test("shouldn't add an Knowledge Requirement edge from BKM node to Knowledge Source node", async ({ palette, nodes, edges, @@ -107,7 +107,7 @@ test.describe("Invalid edge - Knowledge Requirement", () => { await expect(nodes.get({ name: DefaultNodeName.KNOWLEDGE_SOURCE })).toHaveClass(/.*dimmed/); }); - test("shouldn't add an Knowledge Requirement edge from Input Data node to Group node", async ({ + test("shouldn't add an Knowledge Requirement edge from BKM node to Group node", async ({ palette, nodes, edges, @@ -138,7 +138,7 @@ test.describe("Invalid edge - Knowledge Requirement", () => { await expect(nodes.get({ name: DefaultNodeName.GROUP })).toHaveClass(/.*dimmed/); }); - test("shouldn't add an Knowledge Requirement edge from Input Data node to Text Annotation node", async ({ + test("shouldn't add an Knowledge Requirement edge from BKM node to Text Annotation node", async ({ palette, nodes, edges,