Skip to content

Commit

Permalink
Test navigation to same page and queryParams update
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhrathod01 committed Apr 8, 2024
1 parent 14e63a8 commit 634477b
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { WIDGETSKIT } from "../../../../locators/WidgetLocators";
import {
agHelper,
dataSources,
Expand All @@ -10,16 +11,17 @@ import {
import EditorNavigation, {
EntityType,
} from "../../../../support/Pages/EditorNavigation";
import PageList from "../../../../support/Pages/PageList";

describe("Navigate To feature", { tags: ["@tag.JS"] }, () => {
it("1. Navigates to page name clicked from the page name tab of navigate to", () => {
PageList.AddNewPage(); // page 2
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 500, 600);
EditorNavigation.SelectEntityByName("Text1", EntityType.Widget);
propPane.TypeTextIntoField("Text", "{{appsmith.URL.queryParams.test}}");
entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 300, 300);
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
propPane.SelectPlatformFunction("onClick", "Navigate to");
dataSources.ValidateNSelectDropdown("Choose page", "Select page", "Page2");
dataSources.ValidateNSelectDropdown("Choose page", "Select page", "Page1");
propPane.UpdatePropertyFieldValue(
"Query params",
`{{
Expand All @@ -30,21 +32,23 @@ describe("Navigate To feature", { tags: ["@tag.JS"] }, () => {
);
agHelper.GetNClick(propPane._actionSelectorPopupClose);
agHelper.ClickButton("Submit");

agHelper.GetNAssertElementText(
WIDGETSKIT.textWidgetContainer,
"123",
"have.text",
0,
);

cy.url().should("include", "a=b").and("include", "test=123");
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.BUTTON));
agHelper.WaitUntilEleAppear(
locators._widgetInDeployed(draggableWidgets.BUTTON),
);
agHelper.ClickButton("Submit");
agHelper.GetNAssertContains(
locators._emptyPageTxt,
"This page seems to be blank",
);
cy.url().then(($url) => {
cy.log("deploy url is" + $url);
expect($url).to.contain("test=123");
});
//cy.location().its('href').should('include', 'test=123')//both are same
});
});

0 comments on commit 634477b

Please sign in to comment.