rajalakshmys-27 commented on code in PR #3556: URL: https://github.com/apache/incubator-kie-tools/pull/3556#discussion_r3228728253
########## packages/bpmn-editor/tests-e2e/__fixtures__/propertiesPanel/intermediateEventPropertiesPanel.ts: ########## @@ -0,0 +1,241 @@ +/* + * 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 { expect, Page } from "@playwright/test"; +import { PropertiesPanelBase } from "./propertiesPanelBase"; +import { Diagram } from "../diagram"; +import { Nodes } from "../nodes"; +import { NameProperties } from "./parts/nameProperties"; +import { DocumentationProperties } from "./parts/documentationProperties"; + +export class IntermediateEventPropertiesPanel extends PropertiesPanelBase { + private nameProperties: NameProperties; + private documentationProperties: DocumentationProperties; + + constructor( + public diagram: Diagram, + public page: Page, + public nodes: Nodes + ) { + super(diagram, page); + this.nameProperties = new NameProperties(this.panel(), page); + this.documentationProperties = new DocumentationProperties(this.panel(), page); + } + + public async setName(args: { newName: string }) { + await this.nameProperties.setName({ ...args }); + } + + public async getName(): Promise<string> { + return await this.nameProperties.getName(); + } + + public async setDocumentation(args: { newDocumentation: string }) { + await this.documentationProperties.setDocumentation({ ...args }); + } + + public async getDocumentation(): Promise<string> { + return await this.documentationProperties.getDocumentation(); + } + + public async selectEventDefinition(args: { eventType: string }) { + const catchEvent = this.page.getByTestId("kie-tools--bpmn-editor--node-intermediate-catch-event"); + const throwEvent = this.page.getByTestId("kie-tools--bpmn-editor--node-intermediate-throw-event"); + + const selectedNode = (await catchEvent.count()) > 0 ? catchEvent.first() : throwEvent.first(); + + await expect(selectedNode).toBeVisible({ timeout: 5000 }); + + await this.nodes.morphNode({ + nodeLocator: selectedNode, + targetMorphType: args.eventType, + }); + } + + public async setTimerDefinition(args: { type: "date" | "duration" | "cycle"; value: string }) { + if (args.type === "duration") { + await this.panel().getByLabel("Fire once after duration").click(); + const valueInput = this.panel().getByPlaceholder("Enter duration or expression #{expression}"); + await valueInput.fill(args.value); + } else if (args.type === "cycle") { + await this.panel().getByLabel("Fire multiple times").click(); + const valueInput = this.panel().getByPlaceholder("Enter time cycle or expression #{expression}"); + await valueInput.fill(args.value); + } else { + await this.panel().getByLabel("Fire at a specific date").click(); + const valueInput = this.panel().getByPlaceholder("Enter date value or expression #{expression}"); + await valueInput.fill(args.value); + } + + await this.page.keyboard.press("Enter"); + } + + public async setMessageDefinition(args: { messageName: string }) { + await this.selectEventDefinition({ eventType: "Message" }); + + await this.panel().getByRole("combobox").first().click(); + await this.page.keyboard.type(args.messageName); + + const createOption = this.page.getByText(`Create Message "${args.messageName}"`, { exact: true }); + if (await createOption.isVisible().catch(() => false)) { + await createOption.click(); + } else { + await this.page.getByRole("option", { name: args.messageName, exact: true }).click(); + } + } + + public async setSignalDefinition(args: { + signalName: string; + scope?: "default" | "processInstance" | "project" | "external"; + }) { + await this.selectEventDefinition({ eventType: "Signal" }); + + await this.panel().getByRole("combobox").first().click(); + await this.page.keyboard.type(args.signalName); + + const createOption = this.page.getByText(`Create Signal "${args.signalName}"`, { exact: true }); + if (await createOption.isVisible().catch(() => false)) { + await createOption.click(); + } else { + await this.page.getByRole("option", { name: args.signalName, exact: true }).click(); + } + + if (args.scope) { + const scopeSelect = this.panel().locator("select").first(); + await scopeSelect.waitFor({ state: "visible", timeout: 10000 }); Review Comment: Resolved! -- 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]
