Skip to content

Commit

Permalink
last properties panel tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jomarko committed Apr 10, 2024
1 parent e51f279 commit 1b703d0
Show file tree
Hide file tree
Showing 55 changed files with 194 additions and 5 deletions.
7 changes: 4 additions & 3 deletions packages/dmn-editor/src/propertiesPanel/ShapeOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,9 @@ export function ShapeOptions({
buttonId={"shape-style-toggle-group-bound-height"}
/>
</Tooltip>
<Tooltip content={"Reset"}>
<Tooltip content={"Reset shape"}>
<ToggleGroupItem
title={"Reset shape"}
onClick={onReset}
className={"kie-dmn-editor--shape-options-toggle-button"}
text={<UndoAltIcon />}
Expand Down Expand Up @@ -421,7 +422,7 @@ export function ShapeOptions({
isDisabled={false}
value={boundPositionX}
onChange={onChangePositionX}
placeholder={"Enter a value..."}
placeholder={"Enter X value..."}
/>
</div>
<div style={{ gridArea: "position-x-label" }}>
Expand All @@ -435,7 +436,7 @@ export function ShapeOptions({
isDisabled={false}
value={boundPositionY}
onChange={onChangePositionY}
placeholder={"Enter a value..."}
placeholder={"Enter Y value..."}
/>
</div>
<div style={{ gridArea: "position-y-label" }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ export abstract class PropertiesPanelBase {
await this.diagram.resetFocus();
}

public async resetFont() {}
public async resetFont() {
await this.panel().getByTitle("Reset font").click();
}

public async getFont() {
await this.panel().getByTitle("Expand / collapse Font").click();
Expand All @@ -132,6 +134,13 @@ export abstract class PropertiesPanelBase {
await this.panel().getByTitle("Expand / collapse Shape").click();
}

public async setPosition(args: { x: string; y: string }) {
await this.panel().getByRole("button", { name: "Expand / collapse Shape" }).click();
await this.panel().getByPlaceholder("Enter X value...").fill(args.x);
await this.panel().getByPlaceholder("Enter Y value...").fill(args.y);
await this.panel().getByRole("button", { name: "Expand / collapse Shape" }).click();
}

public async getShape() {
await this.panel().getByTitle("Expand / collapse Shape").click();

Expand All @@ -142,4 +151,8 @@ export abstract class PropertiesPanelBase {

return { width: width, height: height };
}

public async resetShape() {
await this.panel().getByTitle("Reset shape").click();
}
}
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.
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 @@ -66,6 +66,7 @@ test.describe("Change Properties - Group", () => {
});

test("should reset the Group node font", async ({ nodes, groupPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1076");
await nodes.select({ name: DefaultNodeName.GROUP, position: NodePosition.TOP });
await groupPropertiesPanel.setFont({
fontSize: "40",
Expand All @@ -76,9 +77,10 @@ test.describe("Change Properties - Group", () => {
color: "#f12200",
fontFamily: "Verdana",
});
await nodes.select({ name: DefaultNodeName.GROUP, position: NodePosition.TOP });
await groupPropertiesPanel.resetFont();

await expect(nodes.get({ name: DefaultNodeName.GROUP })).toHaveScreenshot("change-group-font.png");
await expect(nodes.get({ name: DefaultNodeName.GROUP })).toHaveScreenshot("reset-group-font.png");
});

test("should change the Group node shape - fill color", async ({ nodes, groupPropertiesPanel }) => {
Expand All @@ -102,4 +104,11 @@ test.describe("Change Properties - Group", () => {
"rgba(241, 34, 0, 1)"
);
});

test("should change the Group node shape - position", async ({ diagram, nodes, groupPropertiesPanel }) => {
await nodes.select({ name: DefaultNodeName.GROUP, position: NodePosition.TOP });
await groupPropertiesPanel.setPosition({ x: "200", y: "200" });

await expect(diagram.get()).toHaveScreenshot("change-group-position.png");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ test.describe("Change Properties - Text Annotation", () => {
});

test("should reset the Text Annotation node font", async ({ nodes, textAnnotationPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1076");
await nodes.select({ name: DefaultNodeName.TEXT_ANNOTATION });
await textAnnotationPropertiesPanel.setFont({
fontSize: "40",
Expand All @@ -89,6 +90,7 @@ test.describe("Change Properties - Text Annotation", () => {
color: "#f12200",
fontFamily: "Verdana",
});
await nodes.select({ name: DefaultNodeName.TEXT_ANNOTATION });
await textAnnotationPropertiesPanel.resetFont();

await expect(nodes.get({ name: DefaultNodeName.TEXT_ANNOTATION })).toHaveScreenshot(
Expand Down Expand Up @@ -121,4 +123,11 @@ test.describe("Change Properties - Text Annotation", () => {
nodes.get({ name: DefaultNodeName.TEXT_ANNOTATION }).locator("..").locator("path").nth(0)
).toHaveAttribute("stroke", "rgba(241, 34, 0, 1)");
});

test("should change the Group node shape - position", async ({ diagram, nodes, textAnnotationPropertiesPanel }) => {
await nodes.select({ name: DefaultNodeName.TEXT_ANNOTATION });
await textAnnotationPropertiesPanel.setPosition({ x: "200", y: "200" });

await expect(diagram.get()).toHaveScreenshot("change-text-annotation-position.png");
});
});
14 changes: 14 additions & 0 deletions packages/dmn-editor/tests/e2e/drdArtifacts/resizeGroup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,19 @@ test.describe("Resize node - Group", () => {
expect(height).toEqual("200");
expect(width).toEqual("280");
});

test("should reset Group node size", async ({ nodes, groupPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1075");
await groupPropertiesPanel.open();
await nodes.select({ name: DefaultNodeName.GROUP, position: NodePosition.TOP });
await groupPropertiesPanel.setShape({ width: "325", height: "325" });

await groupPropertiesPanel.resetShape();

await nodes.select({ name: DefaultNodeName.GROUP, position: NodePosition.TOP });
const { width, height } = await groupPropertiesPanel.getShape();
expect(width).toEqual("280");
expect(height).toEqual("200");
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -282,5 +282,20 @@ test.describe("Resize node - Text Annotation", () => {
expect(height).toEqual("60");
expect(width).toEqual("200");
});

test("should reset Text Annotation node size", async ({ diagram, nodes, textAnnotationPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1075");
await textAnnotationPropertiesPanel.open();
await nodes.select({ name: DefaultNodeName.TEXT_ANNOTATION, position: NodePosition.TOP });
await textAnnotationPropertiesPanel.setShape({ width: "300", height: "300" });
await textAnnotationPropertiesPanel.resetShape();

await diagram.resetFocus();

await nodes.select({ name: DefaultNodeName.TEXT_ANNOTATION, position: NodePosition.TOP });
const { width, height } = await textAnnotationPropertiesPanel.getShape();
expect(width).toEqual("200");
expect(height).toEqual("60");
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ test.describe("Change Properties - BKM", () => {
});

test("should reset the BKM node font", async ({ nodes, bkmPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1076");
await nodes.select({ name: DefaultNodeName.BKM });
await bkmPropertiesPanel.setFont({
fontSize: "40",
Expand All @@ -101,6 +102,7 @@ test.describe("Change Properties - BKM", () => {
color: "#f12200",
fontFamily: "Verdana",
});
await nodes.select({ name: DefaultNodeName.BKM });
await bkmPropertiesPanel.resetFont();

await expect(nodes.get({ name: DefaultNodeName.BKM })).toHaveScreenshot("reset-bkm-font.png");
Expand All @@ -127,4 +129,11 @@ test.describe("Change Properties - BKM", () => {
"rgba(241, 34, 0, 1)"
);
});

test("should change the BKM node shape - position", async ({ diagram, nodes, bkmPropertiesPanel }) => {
await nodes.select({ name: DefaultNodeName.BKM });
await bkmPropertiesPanel.setPosition({ x: "200", y: "200" });

await expect(diagram.get()).toHaveScreenshot("change-bkm-position.png");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ test.describe("Change Properties - Decision", () => {
});

test("should reset the Decision node font", async ({ nodes, decisionPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1076");
await nodes.select({ name: DefaultNodeName.DECISION });
await decisionPropertiesPanel.setFont({
fontSize: "40",
Expand All @@ -122,6 +123,7 @@ test.describe("Change Properties - Decision", () => {
color: "#f12200",
fontFamily: "Verdana",
});
await nodes.select({ name: DefaultNodeName.DECISION });
await decisionPropertiesPanel.resetFont();

await expect(nodes.get({ name: DefaultNodeName.DECISION })).toHaveScreenshot("reset-decision-font.png");
Expand All @@ -148,4 +150,11 @@ test.describe("Change Properties - Decision", () => {
"rgba(241, 34, 0, 1)"
);
});

test("should change the Decision node shape - position", async ({ diagram, nodes, decisionPropertiesPanel }) => {
await nodes.select({ name: DefaultNodeName.DECISION });
await decisionPropertiesPanel.setPosition({ x: "200", y: "200" });

await expect(diagram.get()).toHaveScreenshot("change-decision-position.png");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ test.describe("Change Properties - Decision Service", () => {
});

test("should reset the Decision Service node font", async ({ nodes, decisionServicePropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1076");
await nodes.select({ name: DefaultNodeName.DECISION_SERVICE, position: NodePosition.TOP });
await decisionServicePropertiesPanel.setFont({
fontSize: "40",
Expand All @@ -111,6 +112,7 @@ test.describe("Change Properties - Decision Service", () => {
color: "#f12200",
fontFamily: "Verdana",
});
await nodes.select({ name: DefaultNodeName.DECISION_SERVICE, position: NodePosition.TOP });
await decisionServicePropertiesPanel.resetFont();

await expect(nodes.get({ name: DefaultNodeName.DECISION_SERVICE })).toHaveScreenshot(
Expand Down Expand Up @@ -143,4 +145,15 @@ test.describe("Change Properties - Decision Service", () => {
nodes.get({ name: DefaultNodeName.DECISION_SERVICE }).locator("..").locator("rect").nth(0)
).toHaveAttribute("stroke", "rgba(241, 34, 0, 1)");
});

test("should change the Decision Service node shape - position", async ({
diagram,
nodes,
decisionServicePropertiesPanel,
}) => {
await nodes.select({ name: DefaultNodeName.DECISION_SERVICE });
await decisionServicePropertiesPanel.setPosition({ x: "200", y: "200" });

await expect(diagram.get()).toHaveScreenshot("change-decision-service-position.png");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ test.describe("Change Properties - Input Data", () => {
});

test("should reset the Input Data node font", async ({ nodes, inputDataPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1076");
await nodes.select({ name: DefaultNodeName.INPUT_DATA });
await inputDataPropertiesPanel.setFont({
fontSize: "40",
Expand All @@ -102,6 +103,7 @@ test.describe("Change Properties - Input Data", () => {
color: "#f12200",
fontFamily: "Verdana",
});
await nodes.select({ name: DefaultNodeName.INPUT_DATA });
await inputDataPropertiesPanel.resetFont();

await expect(nodes.get({ name: DefaultNodeName.INPUT_DATA })).toHaveScreenshot("reset-input-data-font.png");
Expand All @@ -128,4 +130,11 @@ test.describe("Change Properties - Input Data", () => {
"rgba(241, 34, 0, 1)"
);
});

test("should change the Input Data node shape - position", async ({ diagram, nodes, inputDataPropertiesPanel }) => {
await nodes.select({ name: DefaultNodeName.INPUT_DATA });
await inputDataPropertiesPanel.setPosition({ x: "200", y: "200" });

await expect(diagram.get()).toHaveScreenshot("change-input-data-position.png");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ test.describe("Change Properties - Knowledge Source", () => {
});

test("should reset the Knowledge Source node font", async ({ nodes, knowledgeSourcePropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1076");
await nodes.select({ name: DefaultNodeName.KNOWLEDGE_SOURCE });
await knowledgeSourcePropertiesPanel.setFont({
fontSize: "40",
Expand All @@ -117,6 +118,7 @@ test.describe("Change Properties - Knowledge Source", () => {
color: "#f12200",
fontFamily: "Verdana",
});
await nodes.select({ name: DefaultNodeName.KNOWLEDGE_SOURCE });
await knowledgeSourcePropertiesPanel.resetFont();

await expect(nodes.get({ name: DefaultNodeName.KNOWLEDGE_SOURCE })).toHaveScreenshot(
Expand Down Expand Up @@ -149,4 +151,15 @@ test.describe("Change Properties - Knowledge Source", () => {
nodes.get({ name: DefaultNodeName.KNOWLEDGE_SOURCE }).locator("..").locator("path").nth(0)
).toHaveAttribute("stroke", "rgba(241, 34, 0, 1)");
});

test("should change the Knowledge Source node shape - position", async ({
diagram,
nodes,
knowledgeSourcePropertiesPanel,
}) => {
await nodes.select({ name: DefaultNodeName.KNOWLEDGE_SOURCE });
await knowledgeSourcePropertiesPanel.setPosition({ x: "200", y: "200" });

await expect(diagram.get()).toHaveScreenshot("change-knowledge-source-position.png");
});
});
15 changes: 15 additions & 0 deletions packages/dmn-editor/tests/e2e/drgElements/resizeBkm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,20 @@ test.describe("Resize node - BKM", () => {
expect(height).toEqual("80");
expect(width).toEqual("160");
});

test("should reset BKM node size", async ({ diagram, nodes, bkmPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1075");
await bkmPropertiesPanel.open();
await nodes.select({ name: DefaultNodeName.BKM });
await bkmPropertiesPanel.setShape({ width: "300", height: "300" });
await bkmPropertiesPanel.resetShape();

await diagram.resetFocus();

await nodes.select({ name: DefaultNodeName.BKM });
const { width, height } = await bkmPropertiesPanel.getShape();
expect(height).toEqual("80");
expect(width).toEqual("160");
});
});
});
15 changes: 15 additions & 0 deletions packages/dmn-editor/tests/e2e/drgElements/resizeDecision.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,20 @@ test.describe("Resize node - Decision", () => {
expect(height).toEqual("80");
expect(width).toEqual("160");
});

test("should reset Decision node size", async ({ diagram, nodes, decisionPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1075");
await decisionPropertiesPanel.open();
await nodes.select({ name: DefaultNodeName.DECISION });
await decisionPropertiesPanel.setShape({ width: "300", height: "300" });
await decisionPropertiesPanel.resetShape();

await diagram.resetFocus();

await nodes.select({ name: DefaultNodeName.DECISION });
const { width, height } = await decisionPropertiesPanel.getShape();
expect(height).toEqual("80");
expect(width).toEqual("160");
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -282,5 +282,20 @@ test.describe("Resize node - Decision Service", () => {
expect(height).toEqual("280");
expect(width).toEqual("280");
});

test("should reset Decision Service node size", async ({ diagram, nodes, decisionServicePropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1075");
await decisionServicePropertiesPanel.open();
await nodes.select({ name: DefaultNodeName.DECISION_SERVICE, position: NodePosition.TOP });
await decisionServicePropertiesPanel.setShape({ width: "300", height: "300" });
await decisionServicePropertiesPanel.resetShape();

await diagram.resetFocus();

await nodes.select({ name: DefaultNodeName.DECISION_SERVICE, position: NodePosition.TOP });
const { width, height } = await decisionServicePropertiesPanel.getShape();
expect(height).toEqual("280");
expect(width).toEqual("280");
});
});
});
15 changes: 15 additions & 0 deletions packages/dmn-editor/tests/e2e/drgElements/resizeInputData.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,20 @@ test.describe("Resize node - Input Data", () => {
expect(height).toEqual("80");
expect(width).toEqual("160");
});

test("should reset Input Data node size", async ({ diagram, nodes, inputDataPropertiesPanel }) => {
test.skip(true, "https://github.com/apache/incubator-kie-issues/issues/1075");
await inputDataPropertiesPanel.open();
await nodes.select({ name: DefaultNodeName.INPUT_DATA });
await inputDataPropertiesPanel.setShape({ width: "300", height: "300" });
await inputDataPropertiesPanel.resetShape();

await diagram.resetFocus();

await nodes.select({ name: DefaultNodeName.INPUT_DATA });
const { width, height } = await inputDataPropertiesPanel.getShape();
expect(height).toEqual("80");
expect(width).toEqual("160");
});
});
});
Loading

0 comments on commit 1b703d0

Please sign in to comment.