From 1a0889e035d66b090c29c556574139d21e436938 Mon Sep 17 00:00:00 2001 From: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com> Date: Thu, 13 Jun 2024 14:05:22 +0530 Subject: [PATCH] test: fix failing gitsync tests (#34214) RCA: Test was failing because of hard wait Also the dropdown element which was being clicked was failing Solution: Removed hard waits and replaced with intercept Updated locator and better method to fix tests EE PR: https://github.com/appsmithorg/appsmith-ee/pull/4413 ## Summary by CodeRabbit - **Refactor** - Updated the method for merging changes to the master branch in Git sync tests for improved reliability. - **Tests** - Revised Cypress test configurations and spec names for better organization and clarity. - Enhanced the `CheckMergeConflicts` method to improve test accuracy and reliability by including element visibility checks and network status assertions. --- .../ClientSide/Git/GitSync/GitSyncedApps_spec.js | 3 +-- app/client/cypress/support/Pages/GitSync.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncedApps_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncedApps_spec.js index d46899e99e22..0204615ef1eb 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncedApps_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncedApps_spec.js @@ -400,8 +400,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () { cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); cy.get(gitSyncLocators.commitButton).click(); cy.get(gitSyncLocators.closeGitSyncModal).click(); - cy.merge(mainBranch); - agHelper.GetNClick(gitSyncLocators.closeGitSyncModal); + gitSync.MergeToMaster(); cy.latestDeployPreview(); // verify page is hidden on deploy mode agHelper.AssertContains("Child_Page Copy", "not.exist"); diff --git a/app/client/cypress/support/Pages/GitSync.ts b/app/client/cypress/support/Pages/GitSync.ts index 96daa07f7a48..54896b16d570 100644 --- a/app/client/cypress/support/Pages/GitSync.ts +++ b/app/client/cypress/support/Pages/GitSync.ts @@ -37,6 +37,8 @@ export class GitSync { private mergeCTA = "[data-testid=t--git-merge-button]"; public _mergeBranchDropdownDestination = ".t--merge-branch-dropdown-destination"; + public _mergeBranchDropdownmenu = + ".t--merge-branch-dropdown-destination .rc-select-selection-search-input"; public _dropdownmenu = ".rc-select-item-option-content"; private _openRepoButton = "[data-testid=t--git-repo-button]"; public _commitButton = ".t--commit-button"; @@ -380,11 +382,12 @@ export class GitSync { CheckMergeConflicts(destinationBranch: string) { this.agHelper.AssertElementExist(this._bottomBarPull); this.agHelper.GetNClick(this._bottomBarMergeButton); - cy.wait(2000); - this.agHelper.GetNClick(this._mergeBranchDropdownDestination); - // cy.get(commonLocators.dropdownmenu).contains(destinationBranch).click(); + this.agHelper.WaitUntilEleAppear(this._mergeBranchDropdownmenu); + this.agHelper.WaitUntilEleDisappear(this._mergeLoader); + this.assertHelper.AssertNetworkStatus("@getBranch", 200); + this.agHelper.GetNClick(this._mergeBranchDropdownmenu, 0, true); + this.agHelper.WaitUntilEleAppear(this._dropdownmenu); this.agHelper.GetNClickByContains(this._dropdownmenu, destinationBranch); - this.agHelper.AssertElementAbsence(this._checkMergeability, 35000); }