Skip to content

Commit

Permalink
test: fix failing gitsync tests (#34214)
Browse files Browse the repository at this point in the history
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: appsmithorg/appsmith-ee#4413

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## 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.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
NandanAnantharamu authored Jun 13, 2024
1 parent f73b9a4 commit 1a0889e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
11 changes: 7 additions & 4 deletions app/client/cypress/support/Pages/GitSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 1a0889e

Please sign in to comment.