From 7c00b6a229f8840b541cc48f0dc4ff6495186a02 Mon Sep 17 00:00:00 2001 From: Rahul Barwal Date: Tue, 24 Jun 2025 10:57:35 +0530 Subject: [PATCH] test: fix Regression/ClientSide/ActionExecution/FrameworkFunctions_NavigateToFunctions_spec.ts (#41015) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Problem After creating a widget, the page URL was updated. If the widget was subsequently removed, navigating back from an external site (e.g., google.com) caused the app to fail in locating the widget, resulting in out page selector being unable to open. Root cause 1. Redundant URL assignment persisted after widget deletion, leading to navigation errors and an inconsistent application state. 2. Additionally, on the fourth spec when we were adding a new action on the button click, it already had a on click action defined which was pointing to navigate to google. com and the new navigator we were adding was getting up and down on top of that. So basically sometimes it was preferring first navigation and sometimes it was preferring second navigation. Solution 1. This PR handles the removal of unnecessary URL assignment in the navigation test, simplifying the test case and improving code clarity and maintainability. 2. In this PR, we remove the first navigation by applying the onClick property in a JS mode. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.JS" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: a42d60a18efca0b824fbd11127ce2b7f23c043cb > Cypress dashboard. > Tags: `@tag.JS` > Spec: >
Tue, 24 Jun 2025 04:12:33 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **Tests** - Updated a navigation test case to remove an unnecessary URL assignment step. - Modified navigation verification to use a direct JavaScript expression for improved accuracy. - Cleaned up formatting by removing a trailing blank line between test cases. --- ...eworkFunctions_NavigateToFunctions_spec.ts | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_NavigateToFunctions_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_NavigateToFunctions_spec.ts index 6e481ba700..b950bccbf8 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_NavigateToFunctions_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_NavigateToFunctions_spec.ts @@ -119,9 +119,7 @@ describe( it("2. To verify add a widget navigation using URL containing widgetID", () => { EditorNavigation.SelectEntityByName("Page2", EntityType.Page); entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 200, 600); - cy.url().then((url) => { - pageTwoUrl = url; - }); + EditorNavigation.SelectEntityByName("Page1", EntityType.Page); EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); propPane.ToggleJSMode("onClick", false); @@ -253,7 +251,6 @@ describe( EditorNavigation.SelectEntityByName("Page1", EntityType.Page); EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); }); - it("4. To verify navigation to a hidden page in same as well a new window", () => { agHelper.RefreshPage(); PageList.AddNewPage(); @@ -268,15 +265,14 @@ describe( }); EditorNavigation.SelectEntityByName("Page1", EntityType.Page); EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); - propPane.ToggleJSMode("onClick", false); - propPane.SelectPlatformFunction("onClick", "Navigate to"); - propPane.SelectActionByTitleAndValue("Navigate to", "Select page"); - agHelper.GetNClick(propPane._navigateToType("URL")); - agHelper.TypeText( - propPane._actionSelectorFieldByLabel("Enter URL"), - pageTwoUrl, + + propPane.ToggleJSMode("onClick", true); + propPane.EnterJSContext( + "onClick", + `{{navigateTo('${pageTwoUrl}', {}, 'SAME_WINDOW');}}`, + true, + false, ); - agHelper.GetNClick(propPane._actionSelectorPopupClose); agHelper.ClickButton("Submit"); agHelper.AssertURL(pageTwoUrl); EditorNavigation.SelectEntityByName("Page1", EntityType.Page);