diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitWithAutoLayout/conversion_of_git_connected_apps_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Git/GitWithAutoLayout/conversion_of_git_connected_apps_spec.js index 764f4cc11a..0761810cf6 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitWithAutoLayout/conversion_of_git_connected_apps_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitWithAutoLayout/conversion_of_git_connected_apps_spec.js @@ -1,4 +1,11 @@ -import * as _ from "../../../../../support/Objects/ObjectsCore"; +import { + homePage, + agHelper, + autoLayout, + gitSync, + entityExplorer, + draggableWidgets, +} from "../../../../../support/Objects/ObjectsCore"; let parentBranchKey = "ParentBranch", childBranchKey = "ChildBranch"; @@ -6,77 +13,73 @@ let parentBranchKey = "ParentBranch", let repoName; describe("Git sync:", function () { before(() => { - _.homePage.NavigateToHome(); - _.agHelper.GenerateUUID(); + homePage.NavigateToHome(); + agHelper.GenerateUUID(); cy.get("@guid").then((uid) => { - _.homePage.CreateNewWorkspace("AutoLayoutGit" + uid); - _.homePage.CreateAppInWorkspace("AutoLayoutGit" + uid); + homePage.CreateNewWorkspace("AutoLayoutGit" + uid); + homePage.CreateAppInWorkspace("AutoLayoutGit" + uid); }); - _.gitSync.CreateNConnectToGit(); + gitSync.CreateNConnectToGit(); cy.get("@gitRepoName").then((repName) => { repoName = repName; }); cy.wait(3000); - _.gitSync.CreateGitBranch(parentBranchKey, true); + gitSync.CreateGitBranch(parentBranchKey, true); cy.get("@gitbranchName").then((branName) => { parentBranchKey = branName; }); - _.gitSync.CreateGitBranch(childBranchKey, true); + gitSync.CreateGitBranch(childBranchKey, true); cy.get("@gitbranchName").then((branName) => { childBranchKey = branName; }); }); it("1. when snapshot is restored from a page created before Conversion, it should refresh in the same page", () => { - _.entityExplorer.DragDropWidgetNVerify( - _.draggableWidgets.CONTAINER, - 100, - 100, - ); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.CONTAINER, 100, 100); - _.entityExplorer.AddNewPage("New blank page"); + entityExplorer.AddNewPage("New blank page"); - _.autoLayout.ConvertToAutoLayoutAndVerify(); + autoLayout.ConvertToAutoLayoutAndVerify(); - _.autoLayout.UseSnapshotFromBanner(); + autoLayout.UseSnapshotFromBanner(); - _.entityExplorer.VerifyIsCurrentPage("Page2"); + entityExplorer.VerifyIsCurrentPage("Page2"); - _.entityExplorer.SelectEntityByName("Page1", "Pages"); + entityExplorer.SelectEntityByName("Page1", "Pages"); - cy.wait(1000); + agHelper.Sleep(); - _.entityExplorer.ActionContextMenuByEntityName("Page2"); + entityExplorer.ActionContextMenuByEntityName("Page2"); }); - //Skipped these tests as they seemed to have regressed again, will enable them once it is fixed. #22956 - it.skip("2. when snapshot is restored from a page created after Conversion, it should redirected to home page", () => { - _.autoLayout.ConvertToAutoLayoutAndVerify(); + it("2. when snapshot is restored from a page created after Conversion, it should redirected to home page", () => { + autoLayout.ConvertToAutoLayoutAndVerify(); - _.entityExplorer.AddNewPage("New blank page"); + entityExplorer.AddNewPage("New blank page"); - _.autoLayout.UseSnapshotFromBanner(); + autoLayout.UseSnapshotFromBanner(); - _.entityExplorer.VerifyIsCurrentPage("Page1"); + entityExplorer.VerifyIsCurrentPage("Page1"); }); - //Skipped these tests as they seemed to have regressed again, will enable them once it is fixed. #22956 - it.skip("3. Switch to parentBranch and when snapshot is restored from a page created after Conversion, it should redirected to home page", () => { + it("3. Switch to parentBranch and when snapshot is restored from a page created after Conversion, it should redirected to home page", () => { cy.switchGitBranch(parentBranchKey); - _.autoLayout.ConvertToAutoLayoutAndVerify(); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.CONTAINER, 100, 100); - _.entityExplorer.AddNewPage("New blank page"); + autoLayout.ConvertToAutoLayoutAndVerify(); - _.autoLayout.useSnapshotFromBanner(); + entityExplorer.AddNewPage("New blank page"); - _.entityExplorer.VerifyIsCurrentPage("Page1"); + autoLayout.UseSnapshotFromBanner(); + + entityExplorer.VerifyIsCurrentPage("Page1"); }); after(() => { - _.gitSync.DeleteTestGithubRepo(repoName); + gitSync.DeleteTestGithubRepo(repoName); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoLayout_Widgets_Copy_Paste_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoLayout_Widgets_Copy_Paste_spec.ts index 06b46e3b2a..d897321fe0 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoLayout_Widgets_Copy_Paste_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoLayout_Widgets_Copy_Paste_spec.ts @@ -1,183 +1,179 @@ -import * as _ from "../../../../support/Objects/ObjectsCore"; +import { + autoLayout, + agHelper, + locators, + draggableWidgets, +} from "../../../../support/Objects/ObjectsCore"; describe("Copy paste widget related tests for Auto layout", () => { const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl"; before(() => { - _.autoLayout.ConvertToAutoLayoutAndVerify(false); - cy.wait(2000); + autoLayout.ConvertToAutoLayoutAndVerify(false); + agHelper.Sleep(2000); cy.fixture("autoLayoutCopyPaste").then((val) => { - _.agHelper.AddDsl(val); + agHelper.AddDsl(val); }); }); it("1. Should paste at the bottom of the canvas that contains the selected widget", () => { - _.agHelper.GetNClick( - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), - 0, - ); - _.agHelper.AssertElementLength(_.locators._selectedWidget, 1); + agHelper.GetNClick(locators._widgetInDeployed(draggableWidgets.BUTTON), 0); + agHelper.AssertElementLength(locators._selectedWidget, 1); //copying first button in first layer, which is center aligned - _.agHelper.GetElement("body").type(`{${modifierKey}}{c}`); - _.agHelper.GetElement(_.locators._toastMsg).contains("Copied"); + agHelper.GetElement("body").type(`{${modifierKey}}{c}`); + agHelper.GetElement(locators._toastMsg).contains("Copied"); //paste - _.agHelper.GetElement("body").type(`{${modifierKey}}{v}`); + agHelper.GetElement("body").type(`{${modifierKey}}{v}`); cy.wait(1000); //verify button widget pastes inside the container, in layer index 3 and is center aligned - _.autoLayout.VerifyIfChildWidgetPositionInFlexContainer( - _.locators._widgetInDeployed(_.draggableWidgets.CONTAINER), - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), + autoLayout.VerifyIfChildWidgetPositionInFlexContainer( + locators._widgetInDeployed(draggableWidgets.CONTAINER), + locators._widgetInDeployed(draggableWidgets.BUTTON), 3, "CENTER", ); //unselect all widgets - _.agHelper.GetNClick(_.locators._selectionCanvas("0"), 0, true); + agHelper.GetNClick(locators._selectionCanvas("0"), 0, true); }); it("2. Should paste at the bottom of the canvas of the selected Container", () => { - _.agHelper.GetNClick( - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), - 1, - ); - _.agHelper.AssertElementLength(_.locators._selectedWidget, 1); + agHelper.GetNClick(locators._widgetInDeployed(draggableWidgets.BUTTON), 1); + agHelper.AssertElementLength(locators._selectedWidget, 1); //copying second button in first layer, which is end aligned - _.agHelper.GetElement("body").type(`{${modifierKey}}{c}`); - _.agHelper.GetElement(_.locators._toastMsg).contains("Copied"); + agHelper.GetElement("body").type(`{${modifierKey}}{c}`); + agHelper.GetElement(locators._toastMsg).contains("Copied"); - _.agHelper.GetNClick( - _.locators._widgetInDeployed(_.draggableWidgets.CONTAINER), + agHelper.GetNClick( + locators._widgetInDeployed(draggableWidgets.CONTAINER), 0, ); //paste - _.agHelper.GetElement("body").type(`{${modifierKey}}{v}`); - cy.wait(1000); + agHelper.GetElement("body").type(`{${modifierKey}}{v}`); + agHelper.Sleep(1000); //verify button widget pastes inside selected the container, in layer index 4 and is end aligned - _.autoLayout.VerifyIfChildWidgetPositionInFlexContainer( - _.locators._widgetInDeployed(_.draggableWidgets.CONTAINER), - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), + autoLayout.VerifyIfChildWidgetPositionInFlexContainer( + locators._widgetInDeployed(draggableWidgets.CONTAINER), + locators._widgetInDeployed(draggableWidgets.BUTTON), 4, "END", ); //unselect all widgets - _.agHelper.GetNClick(_.locators._selectionCanvas("0"), 0, true); + agHelper.GetNClick(locators._selectionCanvas("0"), 0, true); }); it("3. Should paste at the bottom of the main canvas when no widget is selected", () => { - _.agHelper.GetNClick( - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), - 0, - ); - _.agHelper.AssertElementLength(_.locators._selectedWidget, 1); + agHelper.GetNClick(locators._widgetInDeployed(draggableWidgets.BUTTON), 0); + agHelper.AssertElementLength(locators._selectedWidget, 1); //copying first button in first layer, which is center aligned - _.agHelper.GetElement("body").type(`{${modifierKey}}{c}`); - _.agHelper.GetElement(_.locators._toastMsg).contains("Copied"); + agHelper.GetElement("body").type(`{${modifierKey}}{c}`); + agHelper.GetElement(locators._toastMsg).contains("Copied"); //unselect all widgets - _.agHelper.GetNClick(_.locators._selectionCanvas("0"), 0, true); + agHelper.GetNClick(locators._selectionCanvas("0"), 0, true); - _.agHelper.AssertElementLength(_.locators._selectedWidget, 0); + agHelper.AssertElementLength(locators._selectedWidget, 0); //paste - _.agHelper.GetElement("body").type(`{${modifierKey}}{v}`); - cy.wait(1000); + agHelper.GetElement("body").type(`{${modifierKey}}{v}`); + agHelper.Sleep(); //verify button widget pastes in main canvas, in layer index 1 and is center aligned - _.autoLayout.VerifyIfChildWidgetPositionInFlexContainer( - _.locators._appsmithWidget("0"), - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), + autoLayout.VerifyIfChildWidgetPositionInFlexContainer( + locators._appsmithWidget("0"), + locators._widgetInDeployed(draggableWidgets.BUTTON), 1, "CENTER", ); //unselect all widgets - _.agHelper.GetNClick(_.locators._selectionCanvas("0"), 0, true); + agHelper.GetNClick(locators._selectionCanvas("0"), 0, true); }); it("4. Should paste widgets in copied orientation, when multiple widgets are copied", () => { //Select and copy widgets in, // button in layer index 0, end aligned - _.agHelper.GetNClick( - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), + agHelper.GetNClick( + locators._widgetInDeployed(draggableWidgets.BUTTON), 1, false, 500, true, ); // button in layer index 1, start aligned - _.agHelper.GetNClick( - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), + agHelper.GetNClick( + locators._widgetInDeployed(draggableWidgets.BUTTON), 2, false, 500, true, ); // icon button in layer index 1, end aligned - _.agHelper.GetNClick( - _.locators._widgetInDeployed(_.draggableWidgets.ICONBUTTON), + agHelper.GetNClick( + locators._widgetInDeployed(draggableWidgets.ICONBUTTON), 0, false, 500, true, ); // button in layer index 2, center aligned - _.agHelper.GetNClick( - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), + agHelper.GetNClick( + locators._widgetInDeployed(draggableWidgets.BUTTON), 3, false, 500, true, ); - _.agHelper.AssertElementLength(_.locators._selectedWidget, 4); - _.agHelper.GetElement("body").type(`{${modifierKey}}{c}`); - _.agHelper.GetElement(_.locators._toastMsg).contains("Copied"); + agHelper.AssertElementLength(locators._selectedWidget, 4); + agHelper.GetElement("body").type(`{${modifierKey}}{c}`); + agHelper.GetElement(locators._toastMsg).contains("Copied"); //unselect all widgets - _.agHelper.GetNClick(_.locators._selectionCanvas("0"), 0, true); + agHelper.GetNClick(locators._selectionCanvas("0"), 0, true); - _.agHelper.AssertElementLength(_.locators._selectedWidget, 0); + agHelper.AssertElementLength(locators._selectedWidget, 0); //paste - _.agHelper.GetElement("body").type(`{${modifierKey}}{v}`); - cy.wait(1000); + agHelper.GetElement("body").type(`{${modifierKey}}{v}`); + agHelper.Sleep(); //verify widgets paste in copied orientation, // button in layer index 2, end aligned - _.autoLayout.VerifyIfChildWidgetPositionInFlexContainer( - _.locators._appsmithWidget("0"), - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), + autoLayout.VerifyIfChildWidgetPositionInFlexContainer( + locators._appsmithWidget("0"), + locators._widgetInDeployed(draggableWidgets.BUTTON), 2, "END", ); // button in layer index 3, start aligned - _.autoLayout.VerifyIfChildWidgetPositionInFlexContainer( - _.locators._appsmithWidget("0"), - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), + autoLayout.VerifyIfChildWidgetPositionInFlexContainer( + locators._appsmithWidget("0"), + locators._widgetInDeployed(draggableWidgets.BUTTON), 3, "START", ); // icon button in layer index 3, center aligned - _.autoLayout.VerifyIfChildWidgetPositionInFlexContainer( - _.locators._appsmithWidget("0"), - _.locators._widgetInDeployed(_.draggableWidgets.ICONBUTTON), + autoLayout.VerifyIfChildWidgetPositionInFlexContainer( + locators._appsmithWidget("0"), + locators._widgetInDeployed(draggableWidgets.ICONBUTTON), 3, "CENTER", ); // button in layer index 4, center aligned - _.autoLayout.VerifyIfChildWidgetPositionInFlexContainer( - _.locators._appsmithWidget("0"), - _.locators._widgetInDeployed(_.draggableWidgets.BUTTON), + autoLayout.VerifyIfChildWidgetPositionInFlexContainer( + locators._appsmithWidget("0"), + locators._widgetInDeployed(draggableWidgets.BUTTON), 4, "CENTER", ); //unselect all widgets - _.agHelper.GetNClick(_.locators._selectionCanvas("0"), 0, true); + agHelper.GetNClick(locators._selectionCanvas("0"), 0, true); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_AutoLayout_Validation_BasicSpec.js b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_AutoLayout_Validation_BasicSpec.js index 92d307dade..0c43ac1d68 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_AutoLayout_Validation_BasicSpec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_AutoLayout_Validation_BasicSpec.js @@ -224,6 +224,7 @@ describe("Auto conversion algorithm usecases for auto-layout", function () { canvasTypeWidgets.forEach((canvasWidget, index) => { _.entityExplorer.DragDropWidgetNVerify(canvasWidget, x, y); + //Logic to add widgets without overlapping each other on the canvas if (index % 2 === 0) { x += 400; } else { diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Mobile_Validation_Spec.js b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Mobile_Validation_Spec.js index f9adee09a2..ada45d80be 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Mobile_Validation_Spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Mobile_Validation_Spec.js @@ -1,11 +1,11 @@ -import * as _ from "../../../../support/Objects/ObjectsCore"; +import { agHelper, autoLayout } from "../../../../support/Objects/ObjectsCore"; let testHeight; describe("Auto conversion algorithm usecases for fixed Layout", function () { it("1. Validate basic conversion algorithm usecases fixed layout usecase Mobile", function () { cy.fixture("conversionFrAutoLayoutDsl").then((val) => { - _.agHelper.AddDsl(val); + agHelper.AddDsl(val); }); cy.wait(5000); //for dsl to settle //cy.openPropertyPane("containerwidget"); @@ -28,7 +28,7 @@ describe("Auto conversion algorithm usecases for fixed Layout", function () { cy.log(dheight); cy.wait(3000); - _.autoLayout.ConvertToAutoLayoutAndVerify(); + autoLayout.ConvertToAutoLayoutAndVerify(); cy.get(".t--widget-audiorecorderwidget") .invoke("css", "height") @@ -43,9 +43,7 @@ describe("Auto conversion algorithm usecases for fixed Layout", function () { expect(bheight).to.not.equal(b1height); expect(dheight).to.not.equal(d1height); - _.autoLayout.ConvertToFixedLayoutAndVerify( - "MOBILE", - ); + autoLayout.ConvertToFixedLayoutAndVerify("MOBILE"); cy.get(".t--widget-audiorecorderwidget") .invoke("css", "height") diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionFlow_Corner_Cases_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionFlow_Corner_Cases_spec.ts index 7baf7e9404..3bcf39160b 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionFlow_Corner_Cases_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionFlow_Corner_Cases_spec.ts @@ -60,17 +60,19 @@ describe("Handle Cases while conversion", () => { it("5. #23367 when app imports pages from a template, it should convert without any errors before refreshing the page after load", () => { _.entityExplorer.AddNewPage("Add page from template"); - _.agHelper.GetElement(template.templateDialogBox).should("be.visible"); - _.agHelper.GetElement("//h1[text()='Marketing Dashboard']").click(); + _.agHelper.AssertElementVisible(template.templateDialogBox); + _.agHelper.GetNClick("//h1[text()='Marketing Dashboard']"); cy.wait(10000); // for templates page to load fully - _.agHelper.GetElement(template.selectCheckbox).first().click(); + _.agHelper.GetNClick(template.selectCheckbox); cy.wait(1000); - _.agHelper.GetElement(template.selectCheckbox).eq(1).click(); - _.agHelper.GetElement(template.templateViewForkButton).click(); + _.agHelper.GetNClick(template.selectCheckbox, 1); + _.agHelper.GetNClick(template.templateViewForkButton); cy.wait(5000); - _.agHelper - .GetElement(widgetLocators.toastAction, 40000) - .should("contain", "template added successfully"); + _.agHelper.AssertContains( + "template added successfully", + "exist", + widgetLocators.toastAction, + ); _.autoLayout.ConvertToAutoLayoutAndVerify(); }); diff --git a/app/client/cypress/support/Pages/AutoLayout.ts b/app/client/cypress/support/Pages/AutoLayout.ts index 5a5e57d0c6..0876db7497 100644 --- a/app/client/cypress/support/Pages/AutoLayout.ts +++ b/app/client/cypress/support/Pages/AutoLayout.ts @@ -56,7 +56,7 @@ export class AutoLayout { } this.agHelper.GetNClick(this.refreshAppDialogButton, 0, true); - cy.wait(2000); + this.agHelper.Sleep(2000); this.VerifyIsAutoLayout(); } diff --git a/app/client/cypress/support/Pages/EntityExplorer.ts b/app/client/cypress/support/Pages/EntityExplorer.ts index ea82f89084..a22cdc67b0 100644 --- a/app/client/cypress/support/Pages/EntityExplorer.ts +++ b/app/client/cypress/support/Pages/EntityExplorer.ts @@ -44,8 +44,8 @@ export class EntityExplorer { private _moreOptionsPopover = "//*[local-name()='g' and @id='Icon/Outline/more-vertical']"; private _pageClone = ".single-select >div:contains('Clone')"; - private getPageLocator = (pageName: string) => - `.t--entity-name:contains(${pageName})`; + private _pageNameDiv = (pageName: string) => + `.t--entity.page:contains('${pageName}')`; private _visibleTextSpan = (spanText: string) => "//span[text()='" + spanText + "']"; _createNewPopup = ".bp3-overlay-content"; @@ -363,9 +363,8 @@ export class EntityExplorer { } public VerifyIsCurrentPage(pageName: string) { - cy.get(`.t--entity.page:contains('${pageName}')`).should( - "have.class", - "activePage", - ); + this.agHelper + .GetElement(this._pageNameDiv(pageName)) + .should("have.class", "activePage"); } }