ljmotta commented on code in PR #2158:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2158#discussion_r1489583486


##########
packages/dmn-editor/tests/e2e/connections/betweenTwoExistingNodes.spec.ts:
##########
@@ -0,0 +1,191 @@
+/*
+ * 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 "@playwright/test";
+import { env } from "../../../env";
+
+test.beforeEach(async ({ page }, testInfo) => {
+  await page.goto(
+    
`http://localhost:${env.dmnEditor.storybook.port}/iframe.html?args=&id=example-dmndevwebapp--empty-model&viewMode=story`
+  );
+});
+
+test.describe("Connect two existing nodes", () => {
+  test("InputData -> Decision", async ({ page }) => {
+    // Add two nodes
+    await page
+      .getByTitle("Decision", { exact: true })
+      .dragTo(page.getByTestId("rf__wrapper"), { targetPosition: { x: 100, y: 
100 } });
+    await page
+      .getByTitle("Input Data", { exact: true })
+      .dragTo(page.getByTestId("rf__wrapper"), { targetPosition: { x: 100, y: 
300 } });
+
+    // Connect these nodes
+    // await page.getByText("New Input Data").hover();
+    await 
page.getByTitle("edge_informationRequirement").locator("visible=true").dragTo(page.getByText("New
 Decision"));
+
+    expect(await page.screenshot()).toMatchSnapshot();
+  });

Review Comment:
   > should we somehow avoid using coordinates where we want to drag the nodes? 
I mean targetPosition, should it be somehow automatically computed?
   
   This souldn't be a problem, the `targetPosition` isn't the same for all 
tests so it requires to be explicity set.
   
   > any idea how to avoid using `rf__wrapper` locator ? it was the only id, 
that I find for dragging elements into react flow panel.
   
   As I could test here, I couldn't generate a better locator as well. This 
`data-testid` is generated by the React Flow, so if it changes, our tests will 
break. Taking this into account, it's better to manually add an `data-testid`, 
WDYT? 
   
   > hover() seems to be problematic, on some tests it timeouts, in some not, 
do you have any experience with hover(), is there some
   
   I dindn't have such problem, only with locators. Maybe the hover couldn't 
find the correct locator?
   
   > the current test suite is to check, each connection type can be created, 
each (most important) combinations, of nodes can be connected, Decision 
Services missing for now. Want to see what do you think about the tests. Do you 
have in mind how to check connection was created, other that doing a screenshot 
in the end of the test? In older kie tests suites we were checking produced 
DMN/XML file.
   
   The ideal is to check the XML and the Model as both should be in sync. We 
can use the screenshot, and we could use a selector to check if the correct 
type of node was rendered on the screen.
   
   > if we go with screenshots/snapshots, should we eliminate their amount? 
currently each test has specific screenshot per browser
   
   No, we should have screenshot for each browser.
   
   > and if you check screenshots, you will notice two interesting points: all 
tests do the same, most of them cause 'Undo' button tells us there is one 
operation to undo. However some tests did screenshot where this undo count is 
still 0:
   
   It's probably related to an `useEffect` on the dev webapp component. But 
remember, that header isn't part of the editor, it's part of the dev webapp, 
and shouldn't be on our tests!
   
   > and second point is, I am not able to connect existing node with existing 
text annotation, see:
   Interesting. We need to investigate, I could manually add, but maybe we need 
to do something different on the test?



-- 
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]

Reply via email to