This is an automated email from the ASF dual-hosted git repository.

tenthe pushed a commit to branch 
4438-flaky-opc-ua-edit-test-expands-tree-before-async-reload-completes
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to 
refs/heads/4438-flaky-opc-ua-edit-test-expands-tree-before-async-reload-completes
 by this push:
     new 51c1baafa0 fix(#4438): stabilize OPC UA tree expansion
51c1baafa0 is described below

commit 51c1baafa0cfb5a5458c947908bcc1bd8ae7aa6f
Author: Philipp Zehnder <[email protected]>
AuthorDate: Wed May 6 13:29:58 2026 +0200

    fix(#4438): stabilize OPC UA tree expansion
---
 ui/cypress/support/utils/connect/OpcUaUtils.ts     | 15 +++++---
 .../utils/userInput/TreeStaticPropertyUtils.ts     | 42 ++++++++++++++++++----
 .../opcua/startAndEditOpcAdapters.smoke.spec.ts    |  2 ++
 3 files changed, 48 insertions(+), 11 deletions(-)

diff --git a/ui/cypress/support/utils/connect/OpcUaUtils.ts 
b/ui/cypress/support/utils/connect/OpcUaUtils.ts
index 8faf1e2d47..67d218efb3 100644
--- a/ui/cypress/support/utils/connect/OpcUaUtils.ts
+++ b/ui/cypress/support/utils/connect/OpcUaUtils.ts
@@ -65,8 +65,11 @@ export class OpcUaUtils {
     public static reloadTreeNodeSelection() {
         cy.dataCy('reloading-nodes', { timeout: 10000 }).should('not.exist');
         cy.dataCy('reload-tree-node-selection-btn').click();
-        cy.dataCy('reloading-nodes', { timeout: 10000 }).should('exist');
-        cy.dataCy('reloading-nodes', { timeout: 10000 }).should('not.exist');
+        cy.dataCy('reload-tree-node-selection-btn', { timeout: 10000 }).should(
+            'not.be.disabled',
+        );
+
+        cy.dataCy('expand-', { timeout: 10000 }, true).should('exist');
     }
 
     public static createNodeSelection(...leafNodes: string[]) {
@@ -85,8 +88,12 @@ export class OpcUaUtils {
     }
 
     public static expandNodeSelectionPath() {
-        ['Objects', 'Demo', 'Dynamic'].forEach(node =>
-            TreeStaticPropertyUtils.expandNode(node),
+        TreeStaticPropertyUtils.expandNode('Objects', 'Demo');
+        TreeStaticPropertyUtils.expandNode('Demo', 'Dynamic');
+        TreeStaticPropertyUtils.expandNode(
+            'Dynamic',
+            OpcUaUtils.BOOLEAN_NODE,
+            false,
         );
     }
 
diff --git a/ui/cypress/support/utils/userInput/TreeStaticPropertyUtils.ts 
b/ui/cypress/support/utils/userInput/TreeStaticPropertyUtils.ts
index 55f2a00368..cb315260d2 100644
--- a/ui/cypress/support/utils/userInput/TreeStaticPropertyUtils.ts
+++ b/ui/cypress/support/utils/userInput/TreeStaticPropertyUtils.ts
@@ -79,7 +79,12 @@ export class TreeStaticPropertyUtils {
         if (!treeNode.isTextConfig) {
             // configure tree node
             if (treeNode.children && treeNode.children.length > 0) {
-                TreeStaticPropertyUtils.expandNode(treeNode.name);
+                const firstChild = treeNode.children[0];
+                TreeStaticPropertyUtils.expandNode(
+                    treeNode.name,
+                    firstChild.name,
+                    firstChild.children && firstChild.children.length > 0,
+                );
                 treeNode.children.forEach(child => {
                     this.selectTreeNode(child);
                 });
@@ -95,15 +100,38 @@ export class TreeStaticPropertyUtils {
     /**
      * Expand the node with @param treeNodeName in the tree view
      */
-    public static expandNode(treeNodeName: string) {
-        cy.dataCy('expand-' + treeNodeName).click();
+    public static expandNode(
+        treeNodeName: string,
+        childNodeName?: string,
+        childIsExpandable = true,
+    ) {
+        cy.dataCy('expand-' + treeNodeName, { timeout: 10000 })
+            .scrollIntoView()
+            .click({
+                force: true,
+            });
+
+        if (childNodeName) {
+            TreeStaticPropertyUtils.waitForNode(
+                childNodeName,
+                childIsExpandable,
+            );
+        }
+    }
+
+    public static waitForNode(treeNodeName: string, expandable = true) {
+        const dataCyPrefix = expandable ? 'expand-' : 'tree-node-';
+        cy.dataCy(dataCyPrefix + treeNodeName, { timeout: 10000 })
+            .scrollIntoView()
+            .should('exist');
     }
 
-    /**
-     * Select the node with @param treeNodeName in the tree view
-     */
     public static selectNode(treeNodeName: string) {
-        cy.dataCy('select-' + treeNodeName).click();
+        cy.dataCy('select-' + treeNodeName)
+            .scrollIntoView()
+            .click({
+                force: true,
+            });
     }
 
     /**
diff --git 
a/ui/cypress/tests/connect/opcua/startAndEditOpcAdapters.smoke.spec.ts 
b/ui/cypress/tests/connect/opcua/startAndEditOpcAdapters.smoke.spec.ts
index c24d5a5495..ef41651e1f 100644
--- a/ui/cypress/tests/connect/opcua/startAndEditOpcAdapters.smoke.spec.ts
+++ b/ui/cypress/tests/connect/opcua/startAndEditOpcAdapters.smoke.spec.ts
@@ -80,6 +80,8 @@ const editAdapterTest = (adapterInput: AdapterInput) => {
 
     GeneralUtils.openMenuForRow(adapterInput.adapterName);
     ConnectBtns.editAdapter().click();
+    cy.location('hash', { timeout: 10000 }).should('contain', 
'/connect/edit/');
+    OpcUaUtils.reloadTreeNodeSelection();
 
     // Validate that the selected node hierarchy can still be browsed after 
editing
     OpcUaUtils.expandNodeSelectionPath();

Reply via email to