From 9bdf7ed6007f3f090d436b74ef08d3d12615589b Mon Sep 17 00:00:00 2001 From: Jozef Marko Date: Thu, 28 Mar 2024 11:19:11 +0100 Subject: [PATCH] decisionServiceProperties -> containerNodeProperties --- .../dmn-editor/tests/e2e/__fixtures__/base.ts | 8 ++--- ...s.ts => containerNodeGeneralProperties.ts} | 7 ++-- .../propertiesPanel/decisionProperties.ts | 8 ++--- .../propertiesPanel/generalProperties.ts | 24 ++++++------- .../knowledgeSourceProperties.ts | 8 ++--- .../propertiesPanel/propertiesPanelBase.ts | 2 +- .../e2e/drdArtifacts/resizeGroup.spec.ts | 14 +++++--- .../changeDecisionServiceProperties.spec.ts | 36 +++++++++---------- .../drgElements/resizeDecisionService.spec.ts | 8 ++--- 9 files changed, 60 insertions(+), 55 deletions(-) rename packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/{generalDecisionServiceProperties.ts => containerNodeGeneralProperties.ts} (79%) diff --git a/packages/dmn-editor/tests/e2e/__fixtures__/base.ts b/packages/dmn-editor/tests/e2e/__fixtures__/base.ts index efdc2478ba9..fbd20c10096 100644 --- a/packages/dmn-editor/tests/e2e/__fixtures__/base.ts +++ b/packages/dmn-editor/tests/e2e/__fixtures__/base.ts @@ -26,7 +26,7 @@ import { Edges } from "./edges"; import { JsonModel } from "./jsonModel"; import { GeneralProperties } from "./propertiesPanel/generalProperties"; import { PropertiesPanelBase } from "./propertiesPanel/propertiesPanelBase"; -import { GeneralDecisionServiceProperties } from "./propertiesPanel/generalDecisionServiceProperties"; +import { ContainerNodeGeneralProperties } from "./propertiesPanel/containerNodeGeneralProperties"; import { DecisionProperties } from "./propertiesPanel/decisionProperties"; import { KnowledgeSourceProperties } from "./propertiesPanel/knowledgeSourceProperties"; @@ -41,7 +41,7 @@ type DmnEditorFixtures = { decisionProperties: DecisionProperties; knowledgeSourceProperties: KnowledgeSourceProperties; propertiesPanel: PropertiesPanelBase; - generalDecisionServiceProperties: GeneralDecisionServiceProperties; + containerNodeGeneralProperties: ContainerNodeGeneralProperties; }; export const test = base.extend({ @@ -75,8 +75,8 @@ export const test = base.extend({ propertiesPanel: async ({ diagram, nodes, page }, use) => { await use(new PropertiesPanelBase(diagram, nodes, page)); }, - generalDecisionServiceProperties: async ({ diagram, nodes, page }, use) => { - await use(new GeneralDecisionServiceProperties(diagram, nodes, page)); + containerNodeGeneralProperties: async ({ diagram, nodes, page }, use) => { + await use(new ContainerNodeGeneralProperties(diagram, nodes, page)); }, }); diff --git a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/generalDecisionServiceProperties.ts b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/containerNodeGeneralProperties.ts similarity index 79% rename from packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/generalDecisionServiceProperties.ts rename to packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/containerNodeGeneralProperties.ts index 28c3f9d8417..72086b2a9a1 100644 --- a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/generalDecisionServiceProperties.ts +++ b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/containerNodeGeneralProperties.ts @@ -20,8 +20,11 @@ import { NodePosition } from "../nodes"; import { GeneralProperties } from "./generalProperties"; -export class GeneralDecisionServiceProperties extends GeneralProperties { - public async selectNodeToLoadPropertiesPanel(args: { nodeName: string }) { +/** + * Please use this fixture for manipulation with 'Decision Service' and 'Group' nodes + */ +export class ContainerNodeGeneralProperties extends GeneralProperties { + public async selectNodeByClickToAppropriatePosition(args: { nodeName: string }) { await this.nodes.select({ name: args.nodeName, position: NodePosition.TOP }); } } diff --git a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/decisionProperties.ts b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/decisionProperties.ts index eeb9a1d21ab..eda0cdc7d8f 100644 --- a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/decisionProperties.ts +++ b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/decisionProperties.ts @@ -21,26 +21,26 @@ import { PropertiesPanelBase } from "./propertiesPanelBase"; export class DecisionProperties extends PropertiesPanelBase { public async changeNodeQuestion(args: { nodeName: string; newQuestion: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByPlaceholder("Enter a question...").fill(args.newQuestion); // commit changes by click to the diagram await this.diagram.resetFocus(); } public async getNodeQuestion(args: { nodeName: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); return await this.panel().getByPlaceholder("Enter a question...").inputValue(); } public async changeNodeAllowedAnswers(args: { nodeName: string; newAllowedAnswers: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByPlaceholder("Enter allowed answers...").fill(args.newAllowedAnswers); // commit changes by click to the diagram await this.diagram.resetFocus(); } public async getNodeAllowedAnswers(args: { nodeName: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); return await this.panel().getByPlaceholder("Enter allowed answers...").inputValue(); } } diff --git a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/generalProperties.ts b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/generalProperties.ts index 28cc11cfd48..53a68c7f81e 100644 --- a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/generalProperties.ts +++ b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/generalProperties.ts @@ -18,24 +18,23 @@ */ import { DataType } from "../jsonModel"; -import { NodePosition } from "../nodes"; import { PropertiesPanelBase } from "./propertiesPanelBase"; export class GeneralProperties extends PropertiesPanelBase { public async changeNodeName(args: { from: string; to: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.from }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.from }); await this.panel().getByPlaceholder("Enter a name...").fill(args.to); await this.page.keyboard.press("Enter"); } public async changeNodeDataType(args: { nodeName: string; newDataType: DataType }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByPlaceholder("Select a data type...").click(); await this.page.getByRole("option").getByText(args.newDataType, { exact: true }).click(); } public async changeNodeDescription(args: { nodeName: string; newDescription: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByPlaceholder("Enter a description...").fill(args.newDescription); // commit changes by click to the diagram @@ -43,12 +42,12 @@ export class GeneralProperties extends PropertiesPanelBase { } public async getNodeDescription(args: { nodeName: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); return await this.panel().getByPlaceholder("Enter a description...").inputValue(); } public async addDocumentationLink(args: { nodeName: string; linkText: string; linkHref: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByTitle("Add documentation link").click(); await this.panel() .locator(".kie-dmn-editor--documentation-link--row") @@ -62,12 +61,12 @@ export class GeneralProperties extends PropertiesPanelBase { } public async getDocumentationLinks(args: { nodeName: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); return await this.panel().locator(".kie-dmn-editor--documentation-link--row-title").locator("a").all(); } public async changeNodeFont(args: { nodeName: string; newFont: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByTitle("Expand / collapse Font").click(); await this.panel().locator("[data-ouia-component-id='node-font-style-selector']").click(); @@ -77,17 +76,14 @@ export class GeneralProperties extends PropertiesPanelBase { } public async getNodeFont(args: { nodeName: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByTitle("Expand / collapse Font").click(); return await this.panel().locator("[data-ouia-component-id='node-font-style-selector']").textContent(); } - public async getNodeShape(args: { nodeName: string; position?: NodePosition }) { - await this.selectNodeToLoadPropertiesPanel({ - nodeName: args.nodeName, - position: args.position ?? NodePosition.CENTER, - }); + public async getNodeShape(args: { nodeName: string }) { + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByTitle("Expand / collapse Shape").click(); const width = await this.panel().getByTestId("node-shape-width-input-box").inputValue(); diff --git a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/knowledgeSourceProperties.ts b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/knowledgeSourceProperties.ts index 5ddd43b4dc7..2b4ce35778d 100644 --- a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/knowledgeSourceProperties.ts +++ b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/knowledgeSourceProperties.ts @@ -21,26 +21,26 @@ import { PropertiesPanelBase } from "./propertiesPanelBase"; export class KnowledgeSourceProperties extends PropertiesPanelBase { public async changeNodeSourceType(args: { nodeName: string; newSourceType: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByPlaceholder("Enter source type...").fill(args.newSourceType); // commit changes by click to the diagram await this.diagram.resetFocus(); } public async getNodeSourceType(args: { nodeName: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); return await this.panel().getByPlaceholder("Enter source type...").inputValue(); } public async changeNodeLocationURI(args: { nodeName: string; newLocationURI: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); await this.panel().getByPlaceholder("Enter location URI...").fill(args.newLocationURI); // commit changes by click to the diagram await this.diagram.resetFocus(); } public async getNodeLocationURI(args: { nodeName: string }) { - await this.selectNodeToLoadPropertiesPanel({ nodeName: args.nodeName }); + await this.selectNodeByClickToAppropriatePosition({ nodeName: args.nodeName }); return await this.panel().getByPlaceholder("Enter location URI...").inputValue(); } } diff --git a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/propertiesPanelBase.ts b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/propertiesPanelBase.ts index 18a1f73a04a..681376f65f5 100644 --- a/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/propertiesPanelBase.ts +++ b/packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/propertiesPanelBase.ts @@ -28,7 +28,7 @@ export class PropertiesPanelBase { return this.page.getByTestId("properties-panel-container"); } - public async selectNodeToLoadPropertiesPanel(args: { nodeName: string; position?: NodePosition }) { + public async selectNodeByClickToAppropriatePosition(args: { nodeName: string; position?: NodePosition }) { await this.nodes.select({ name: args.nodeName, position: args.position ?? NodePosition.CENTER }); } diff --git a/packages/dmn-editor/tests/e2e/drdArtifacts/resizeGroup.spec.ts b/packages/dmn-editor/tests/e2e/drdArtifacts/resizeGroup.spec.ts index 2a4d2fc46a1..cd01ff72a69 100644 --- a/packages/dmn-editor/tests/e2e/drdArtifacts/resizeGroup.spec.ts +++ b/packages/dmn-editor/tests/e2e/drdArtifacts/resizeGroup.spec.ts @@ -25,20 +25,26 @@ test.beforeEach(async ({ editor }) => { }); test.describe("Resize node - Group", () => { - test("should resize Group node", async ({ palette, nodes, generalProperties }) => { + test("should resize Group node", async ({ palette, nodes, containerNodeGeneralProperties }) => { await palette.dragNewNode({ type: NodeType.GROUP, targetPosition: { x: 300, y: 300 } }); await nodes.resize({ nodeName: DefaultNodeName.GROUP, position: NodePosition.TOP, xOffset: 50, yOffset: 50 }); - await generalProperties.open(); + await containerNodeGeneralProperties.open(); await expect( ( - await generalProperties.getNodeShape({ nodeName: DefaultNodeName.GROUP, position: NodePosition.TOP }) + await containerNodeGeneralProperties.getNodeShape({ + nodeName: DefaultNodeName.GROUP, + position: NodePosition.TOP, + }) ).width ).toEqual("360"); await expect( ( - await generalProperties.getNodeShape({ nodeName: DefaultNodeName.GROUP, position: NodePosition.TOP }) + await containerNodeGeneralProperties.getNodeShape({ + nodeName: DefaultNodeName.GROUP, + position: NodePosition.TOP, + }) ).height ).toEqual("360"); }); diff --git a/packages/dmn-editor/tests/e2e/drgElements/changeDecisionServiceProperties.spec.ts b/packages/dmn-editor/tests/e2e/drgElements/changeDecisionServiceProperties.spec.ts index 4e48ce728ac..7d9285737b5 100644 --- a/packages/dmn-editor/tests/e2e/drgElements/changeDecisionServiceProperties.spec.ts +++ b/packages/dmn-editor/tests/e2e/drgElements/changeDecisionServiceProperties.spec.ts @@ -19,21 +19,21 @@ import { test, expect } from "../__fixtures__/base"; import { DataType } from "../__fixtures__/jsonModel"; -import { DefaultNodeName, NodeType } from "../__fixtures__/nodes"; +import { DefaultNodeName, NodePosition, NodeType } from "../__fixtures__/nodes"; test.beforeEach(async ({ editor }) => { await editor.open(); }); test.describe("Change Properties - Decision Service", () => { - test.beforeEach(async ({ palette, nodes, generalDecisionServiceProperties }) => { + test.beforeEach(async ({ palette, nodes, containerNodeGeneralProperties }) => { await palette.dragNewNode({ type: NodeType.DECISION_SERVICE, targetPosition: { x: 100, y: 100 } }); - await nodes.select({ name: DefaultNodeName.DECISION_SERVICE }); - await generalDecisionServiceProperties.open(); + await nodes.select({ name: DefaultNodeName.DECISION_SERVICE, position: NodePosition.TOP }); + await containerNodeGeneralProperties.open(); }); - test("should change the Decision Service node name", async ({ nodes, generalDecisionServiceProperties }) => { - await generalDecisionServiceProperties.changeNodeName({ + test("should change the Decision Service node name", async ({ nodes, containerNodeGeneralProperties }) => { + await containerNodeGeneralProperties.changeNodeName({ from: DefaultNodeName.DECISION_SERVICE, to: "Renamed Decision Service", }); @@ -41,8 +41,8 @@ test.describe("Change Properties - Decision Service", () => { await expect(nodes.get({ name: "Renamed Decision Service" })).toBeVisible(); }); - test("should change the Decision Service node data type", async ({ nodes, generalDecisionServiceProperties }) => { - await generalDecisionServiceProperties.changeNodeDataType({ + test("should change the Decision Service node data type", async ({ nodes, containerNodeGeneralProperties }) => { + await containerNodeGeneralProperties.changeNodeDataType({ nodeName: DefaultNodeName.DECISION_SERVICE, newDataType: DataType.Number, }); @@ -53,25 +53,25 @@ test.describe("Change Properties - Decision Service", () => { ).toHaveValue(DataType.Number); }); - test("should change the Decision Service node description", async ({ generalDecisionServiceProperties }) => { - await generalDecisionServiceProperties.changeNodeDescription({ + test("should change the Decision Service node description", async ({ containerNodeGeneralProperties }) => { + await containerNodeGeneralProperties.changeNodeDescription({ nodeName: DefaultNodeName.DECISION_SERVICE, newDescription: "New Decision Service Description", }); expect( - await generalDecisionServiceProperties.getNodeDescription({ nodeName: DefaultNodeName.DECISION_SERVICE }) + await containerNodeGeneralProperties.getNodeDescription({ nodeName: DefaultNodeName.DECISION_SERVICE }) ).toBe("New Decision Service Description"); }); - test("should change the Decision Service node documentation links", async ({ generalDecisionServiceProperties }) => { - await generalDecisionServiceProperties.addDocumentationLink({ + test("should change the Decision Service node documentation links", async ({ containerNodeGeneralProperties }) => { + await containerNodeGeneralProperties.addDocumentationLink({ nodeName: DefaultNodeName.DECISION_SERVICE, linkText: "Link Text", linkHref: "http://link.test.com", }); - const links = await generalDecisionServiceProperties.getDocumentationLinks({ + const links = await containerNodeGeneralProperties.getDocumentationLinks({ nodeName: DefaultNodeName.DECISION_SERVICE, }); expect(links).toHaveLength(1); @@ -79,20 +79,20 @@ test.describe("Change Properties - Decision Service", () => { expect(links[0]).toHaveAttribute("href", "http://link.test.com/"); }); - test("should change the Decision Service node font - family", async ({ generalDecisionServiceProperties }) => { - await generalDecisionServiceProperties.changeNodeFont({ + test("should change the Decision Service node font - family", async ({ containerNodeGeneralProperties }) => { + await containerNodeGeneralProperties.changeNodeFont({ nodeName: DefaultNodeName.DECISION_SERVICE, newFont: "Verdana", }); - expect(await generalDecisionServiceProperties.getNodeFont({ nodeName: DefaultNodeName.DECISION_SERVICE })).toBe( + expect(await containerNodeGeneralProperties.getNodeFont({ nodeName: DefaultNodeName.DECISION_SERVICE })).toBe( "Verdana" ); }); test.skip("should change the Decision Service node shape - background color", async ({ nodes, - generalDecisionServiceProperties, + containerNodeGeneralProperties, }) => { // blocked https://github.com/microsoft/playwright/issues/19929#issuecomment-1377035969 }); diff --git a/packages/dmn-editor/tests/e2e/drgElements/resizeDecisionService.spec.ts b/packages/dmn-editor/tests/e2e/drgElements/resizeDecisionService.spec.ts index ad0e8088577..3e59dbcb6fb 100644 --- a/packages/dmn-editor/tests/e2e/drgElements/resizeDecisionService.spec.ts +++ b/packages/dmn-editor/tests/e2e/drgElements/resizeDecisionService.spec.ts @@ -25,7 +25,7 @@ test.beforeEach(async ({ editor }) => { }); test.describe("Resize node - Decision Service", () => { - test("should resize Decision Service node", async ({ palette, nodes, generalDecisionServiceProperties }) => { + test("should resize Decision Service node", async ({ palette, nodes, containerNodeGeneralProperties }) => { await palette.dragNewNode({ type: NodeType.DECISION_SERVICE, targetPosition: { x: 100, y: 100 } }); await nodes.resize({ @@ -35,15 +35,15 @@ test.describe("Resize node - Decision Service", () => { yOffset: 50, }); - await generalDecisionServiceProperties.open(); + await containerNodeGeneralProperties.open(); await expect( ( - await generalDecisionServiceProperties.getNodeShape({ nodeName: DefaultNodeName.DECISION_SERVICE }) + await containerNodeGeneralProperties.getNodeShape({ nodeName: DefaultNodeName.DECISION_SERVICE }) ).width ).toEqual("360"); await expect( ( - await generalDecisionServiceProperties.getNodeShape({ nodeName: DefaultNodeName.DECISION_SERVICE }) + await containerNodeGeneralProperties.getNodeShape({ nodeName: DefaultNodeName.DECISION_SERVICE }) ).height ).toEqual("360"); });