diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/MergeViaRemote_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/MergeViaRemote_spec.ts index 9042c3ca0787..469bafcda094 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/MergeViaRemote_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/MergeViaRemote_spec.ts @@ -5,26 +5,12 @@ import { } from "../../../../../support/Pages/EditorNavigation"; import PageList from "../../../../../support/Pages/PageList"; -let tempBranch = "tempBranch", - tempBranch0 = "tempBranch0", - tempBranch1 = "tempBranch1", - tempBranch2 = "tempBranch2", - tempBranch3 = "tempBranch3"; - -const buttonNameMainBranch = "buttonMainBranch"; -const buttonNameMainBranchEdited = "buttonMainBranchEdited"; -const buttonNameTemp0Branch = "buttonTemp0Branch"; -const buttonNameTempBranch1 = "buttonTempBranch1"; +let tempBranch2 = "tempBranch2"; const mainBranch = "master"; - -const inputNameTempBranch3 = "inputNameTempBranch3"; -const inputNameTempBranch31 = "inputNameTempBranch31"; - const cleanUrlBranch = "feat/clean_url"; - let applicationId: any; -let applicationName: any; let repoName: any; +let newPageName: string; describe( "Git sync: Merge changes via remote", @@ -49,7 +35,6 @@ describe( cy.get("@guid").then((uid: any) => { cy.get("@workspaceName").then((workspaceName: any) => { _.homePage.CreateAppInWorkspace(workspaceName, uid); - applicationName = uid; cy.get("@applicationId").then( (currentAppId) => (applicationId = currentAppId), ); @@ -62,17 +47,15 @@ describe( }); it("1. Supports merging head to base branch", function () { - //cy.switchGitBranch(mainBranch); _.gitSync.CreateGitBranch(tempBranch2, true); PageLeftPane.switchSegment(PagePaneSegment.UI); - cy.Createpage("NewPage"); - cy.commitAndPush(); - cy.merge(mainBranch); - _.gitSync.CloseOpsModal(); - cy.wait(4000); - cy.switchGitBranch(mainBranch); - cy.wait(4000); // wait for switch branch - cy.contains("NewPage"); + PageList.AddNewPage("New blank page")?.then((pageName) => { + newPageName = pageName.toString(); + _.gitSync.CommitAndPush(); + _.gitSync.MergeToMaster(); + _.gitSync.SwitchGitBranch(mainBranch); + PageList.assertPresence(newPageName); + }); }); it("2. Clicking '+' icon on bottom bar should open deploy popup", function () { @@ -86,8 +69,7 @@ describe( }); it("3. Checks clean url updates across branches", () => { - PageList.DeletePage("NewPage"); - cy.wait(1000); + PageList.DeletePage(newPageName); let legacyPathname = ""; let newPathname = ""; // question to qa can we remove this assertion @@ -96,7 +78,8 @@ describe( }).as("appAndPages"); cy.reload(); cy.wait("@getConsolidatedData").then((intercept2) => { - const { application, pages } = intercept2.response.body.data.pages.data; + const { application, pages } = + intercept2?.response?.body?.data?.pages?.data; const defaultPage = pages.find((p) => p.isDefault); legacyPathname = `/applications/${application.baseId}/pages/${defaultPage.baseId}`; newPathname = `/app/${application.slug}/${defaultPage.slug}-${defaultPage.baseId}`; @@ -116,7 +99,7 @@ describe( expect(location.pathname).includes(legacyPathname); }); - cy.switchGitBranch(mainBranch); + _.gitSync.SwitchGitBranch(mainBranch); cy.get(".t--upgrade").click({ force: true });