test: fix Regression/ClientSide/ActionExecution/FrameworkFunctions_NavigateToFunctions_spec.ts (#41015)
## Description <ins>Problem</ins> 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. <ins>Root cause</ins> 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. <ins>Solution</ins> 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" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/15840445845> > Commit: a42d60a18efca0b824fbd11127ce2b7f23c043cb > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=15840445845&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.JS` > Spec: > <hr>Tue, 24 Jun 2025 04:12:33 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
325b62be28
commit
7c00b6a229
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user