forked from apache/incubator-kie-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
draft decisionPropertiesPanel.spec.ts
- Loading branch information
Showing
3 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { Page } from "@playwright/test"; | ||
import { DataType } from "./jsonModel"; | ||
|
||
export class PropertiesPanel { | ||
constructor(public page: Page) {} | ||
|
||
public async open() { | ||
await this.page.getByTitle("Properties panel").click(); | ||
} | ||
|
||
public async changeNodeName(args: { newName: string }) { | ||
await this.page.getByPlaceholder("Enter a name...").fill(args.newName); | ||
await this.page.keyboard.press("Enter"); | ||
} | ||
|
||
public async changeNodeDataType(args: { newDataType: DataType }) { | ||
await this.page.getByPlaceholder("Select a data type...").click(); | ||
await this.page.getByRole("option").getByText(args.newDataType, { exact: true }).click(); | ||
} | ||
|
||
public async changeNodeDescription(args: { newDescription: string }) { | ||
await this.page.getByPlaceholder("Enter a description...").fill(args.newDescription); | ||
await this.page.keyboard.press("Enter"); | ||
} | ||
|
||
public async changeNodeQuestion(args: { newQuestion: string }) { | ||
await this.page.getByPlaceholder("Enter a question...").fill(args.newQuestion); | ||
await this.page.keyboard.press("Enter"); | ||
} | ||
|
||
public async changeNodeAllowedAnswers(args: { newAllowedAnswers: string }) { | ||
await this.page.getByPlaceholder("Enter allowed answers...").fill(args.newAllowedAnswers); | ||
await this.page.keyboard.press("Enter"); | ||
} | ||
|
||
public async addDocumentationLink(args: { linkText: string; linkHref: string }) { | ||
await this.page.getByTitle("Add documentation link").click(); | ||
await this.page | ||
.locator(".kie-dmn-editor--documentation-link--row") | ||
.getByPlaceholder("Enter a title...") | ||
.fill(args.linkText); | ||
await this.page.locator(".kie-dmn-editor--documentation-link--row").getByPlaceholder("http://").fill(args.linkHref); | ||
await this.page.keyboard.press("Enter"); | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
packages/dmn-editor/tests/e2e/drgElements/decisionPropertiesPanel.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { test, expect } from "../__fixtures__/base"; | ||
import { DataType } from "../__fixtures__/jsonModel"; | ||
import { DefaultNodeName, NodeType } from "../__fixtures__/nodes"; | ||
|
||
test.beforeEach(async ({ editor }) => { | ||
await editor.open(); | ||
}); | ||
|
||
test.describe.only("Change Properties - Decision", () => { | ||
test.beforeEach(async ({ palette, nodes, propertiesPanel }) => { | ||
await palette.dragNewNode({ type: NodeType.DECISION, targetPosition: { x: 100, y: 100 } }); | ||
await nodes.select({ name: DefaultNodeName.DECISION }); | ||
await propertiesPanel.open(); | ||
}); | ||
|
||
test("should change the Decision node name", async ({ nodes, propertiesPanel }) => { | ||
await propertiesPanel.changeNodeName({ newName: "Renamed Decision" }); | ||
|
||
await expect(nodes.get({ name: "Renamed Decision" })).toBeVisible(); | ||
}); | ||
|
||
test("should change the Decision node data type", async ({ nodes, propertiesPanel }) => { | ||
await propertiesPanel.changeNodeDataType({ newDataType: DataType.Number }); | ||
|
||
await nodes.hover({ name: DefaultNodeName.DECISION }); | ||
await expect(nodes.get({ name: DefaultNodeName.DECISION }).getByPlaceholder("Select a data type...")).toHaveValue( | ||
DataType.Number | ||
); | ||
}); | ||
|
||
test("should change the Decision node description", async ({ nodes, propertiesPanel }) => { | ||
await propertiesPanel.changeNodeDescription({ newDescription: "New Decision Description" }); | ||
|
||
// assert uisng jsonModel? assert using reopening properties panel? assert using screenshot? | ||
}); | ||
|
||
test("should change the Decision node question", async ({ nodes, propertiesPanel }) => { | ||
await propertiesPanel.changeNodeQuestion({ newQuestion: "New Decision Question" }); | ||
|
||
// assert uisng jsonModel? assert using reopening properties panel? assert using screenshot? | ||
}); | ||
|
||
test("should change the Decision node answers", async ({ nodes, propertiesPanel }) => { | ||
await propertiesPanel.changeNodeAllowedAnswers({ newAllowedAnswers: "New Allowed Answers" }); | ||
|
||
// assert uisng jsonModel? assert using reopening properties panel? assert using screenshot? | ||
}); | ||
|
||
test("should change the Decision node documentation links", async ({ nodes, propertiesPanel }) => { | ||
await propertiesPanel.addDocumentationLink({ linkText: "Link Texts", linkHref: "http://link.test.com" }); | ||
|
||
// assert uisng jsonModel? assert using reopening properties panel? assert using screenshot? | ||
}); | ||
|
||
test("should change the Decision node font", async ({ nodes, propertiesPanel }) => { | ||
// TODO | ||
}); | ||
test("should change the Decision node shape", async ({ nodes, propertiesPanel }) => { | ||
// TODO | ||
}); | ||
}); |