jomarko commented on code in PR #2239: URL: https://github.com/apache/incubator-kie-tools/pull/2239#discussion_r1567547913
########## packages/dmn-editor/tests/e2e/__fixtures__/propertiesPanel/decisionPropertiesPanel.ts: ########## @@ -0,0 +1,140 @@ +/* + * 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 { ShapeProperties } from "./parts/shapeProperties"; +import { PropertiesPanelBase } from "./propertiesPanelBase"; +import { Diagram } from "../diagram"; +import { FontProperties } from "./parts/fontProperties"; +import { DocumentationProperties } from "./parts/documentationProperties"; +import { DescriptionProperties } from "./parts/descriptionProperties"; +import { DataTypeProperties } from "./parts/dataTypeProperties"; +import { DataType } from "../jsonModel"; +import { NameProperties } from "./parts/nameProperties"; + +export class DecisionPropertiesPanel extends PropertiesPanelBase { + private nameProperties: NameProperties; + private dataTypeProperties: DataTypeProperties; + private descriptionProperties: DescriptionProperties; + private documentationProperties: DocumentationProperties; + private fontProperties: FontProperties; + private shapeProperties: ShapeProperties; + + constructor(public diagram: Diagram, public page: Page) { + super(diagram, page); + this.nameProperties = new NameProperties(this.panel(), page); + this.dataTypeProperties = new DataTypeProperties(this.panel(), page); + this.descriptionProperties = new DescriptionProperties(this.panel(), diagram); + this.documentationProperties = new DocumentationProperties(this.panel(), page); + this.fontProperties = new FontProperties(this.panel(), diagram); + this.shapeProperties = new ShapeProperties(this.panel()); + } + + public async setName(args: { newName: string }) { + await this.nameProperties.setName({ ...args }); + } + + public async getName() { + return await this.nameProperties.getName(); + } + + public async setDataType(args: { newDataType: DataType }) { + await this.dataTypeProperties.setDataType({ ...args }); + } + + public async setDescription(args: { newDescription: string }) { + await this.descriptionProperties.setDescription({ ...args }); + } + + public async getDescription() { + return await this.descriptionProperties.getDescription(); + } + + public async addDocumentationLink(args: { linkText: string; linkHref: string }) { + await this.documentationProperties.addDocumentationLink({ ...args }); + } + + public async getDocumentationLinks() { + return await this.documentationProperties.getDocumentationLinks(); + } + + public async setQuestion(args: { newQuestion: string }) { + await this.panel().getByPlaceholder("Enter a question...").fill(args.newQuestion); + // commit changes by click to the diagram + await this.diagram.resetFocus(); + } + + public async getQuestion() { + return await this.panel().getByPlaceholder("Enter a question...").inputValue(); + } + + public async setAllowedAnswers(args: { newAllowedAnswers: string }) { + await this.panel().getByPlaceholder("Enter allowed answers...").fill(args.newAllowedAnswers); + // commit changes by click to the diagram + await this.diagram.resetFocus(); Review Comment: Here I think we are in a different situation. I do not think in this PR we are doing a workaround due to a bug. I agree what we spot in `Add Edge -*` tests is an issue we should address. However, here, `allowed answers` property of the decision node is a multiline text area that I can not be committed simply by pressing enter key. That works only for text inputs - single line inputs. So decided to click into the canvas, to commit the changes. I am not interested much, where to the canvas the click is done, that is why I used the existing `diagram.resetFocus()` fixture. Should I implement committing the multiline text area in some better/smarter way? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
