Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: updated test for delete branch #38992

Open
wants to merge 2 commits into
base: release
Choose a base branch
from

Conversation

NandanAnantharamu
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu commented Feb 4, 2025

Summary by CodeRabbit

  • Tests
    • Updated branch management test scenarios to enhance verification of branch creation, commit, and deletion behavior.
    • Revised test suite configuration to focus on critical branch management validations while temporarily excluding certain widget-related tests.
    • Improved synchronization in branch creation tests to reduce flakiness by ensuring UI elements are properly loaded before assertions.

Warning

Tests have not run on the HEAD 57c0d64 yet


Wed, 05 Feb 2025 07:03:20 UTC

Copy link
Contributor

coderabbitai bot commented Feb 4, 2025

Walkthrough

This pull request updates the test case in the Git synchronization suite by adding a third parameter (false) to the CreateGitBranch method in the Git branch deletion test. Additionally, the list of test specifications in the limited test configuration file has been modified by replacing a reference to one test file with another and by commenting out previously active widget tests.

Changes

File Path Change Summary
app/.../GitSync/DeleteBranch_spec.js Modified the method call in the test case to include a new parameter: gitSync.CreateGitBranch("", true, false); reflects the updated method signature in Git branch operations.
app/.../limited-tests.txt Replaced test spec reference from JSEditorIndent_spec.js to DeleteBranch_spec.js and commented out the widget tests line, adjusting the set of tests for limited runs.
app/.../GitSync.ts Added a line to wait for the button spinner to disappear in CreateGitBranch method, enhancing synchronization in UI interactions.

Sequence Diagram(s)

sequenceDiagram
    participant T as Test Runner
    participant G as GitSync
    participant R as Repository

    T->>G: CreateGitBranch("", true, false)
    G->>R: Create new branch (applying flag: false)
    T->>R: Commit data in new branch
    T->>R: Delete branch
    T->>R: Verify master branch data
Loading

Possibly related PRs

Suggested labels

Bug, ok-to-test

Suggested reviewers

  • ApekshaBhosale
  • sagar-qa007

Poem

In the realm of code, a branch takes flight,
With a new flag added to make it right.
Commit and delete in a graceful dance,
Tests run smooth at every chance.
Cheers to clean code and debugging delight! 🎉🌿

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count= 50

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test labels Feb 4, 2025
Copy link

github-actions bot commented Feb 4, 2025

Copy link

github-actions bot commented Feb 4, 2025

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13127515232.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

***** Repeat Run Summary ***** Total Tests with repeat: 4 Total Passed: 3 Total Failed: 0 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=50 update_snapshot=true cypress/e2e/Regression/ClientSide/Git/GitSync/DeleteBranch_spec.js

Copy link

github-actions bot commented Feb 4, 2025

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=50

Copy link

github-actions bot commented Feb 4, 2025

Copy link

github-actions bot commented Feb 4, 2025

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13141011924.
Cypress dashboard url: Click here!
All Cypress tests have passed 🎉🎉🎉

***** Repeat Run Summary ***** Total Tests with repeat: 200 Total Passed: 125 Total Failed: 25 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=50

Copy link

github-actions bot commented Feb 5, 2025

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (2)
app/client/cypress/support/Pages/GitSync.ts (2)

347-347: Replace hardcoded waits with Cypress built-in retry-ability.

Using cy.wait() and agHelper.Sleep() makes tests slower and potentially flaky. Instead, use Cypress's built-in retry-ability with assertions.

-    cy.wait(1000);
+    this.agHelper.WaitUntilEleAppear(this.locators.branchItem);

-    this.agHelper.Sleep(2000);
+    this.agHelper.WaitUntilEleDisappear(this.commonLocators._btnSpinner);

Also applies to: 385-385


29-29: Replace XPath selectors with data-testid attributes.

Using XPath selectors is against Cypress best practices as they are brittle and slower than data-testid selectors.

-    connectModalCloseBtn:
-      "//div[@data-testid='t--git-connect-modal']//button[@aria-label='Close']",
+    connectModalCloseBtn: "[data-testid='t--git-connect-modal-close']",

-    disconnectModalCloseBtn:
-      "//div[@data-testid='t--git-disconnect-modal']//button[@aria-label='Close']",
+    disconnectModalCloseBtn: "[data-testid='t--git-disconnect-modal-close']",

-    settingsModalCloseBtn:
-      "//div[@data-testid='t--git-settings-modal']//button[@aria-label='Close']",
+    settingsModalCloseBtn: "[data-testid='t--git-settings-modal-close']",

-    opsModalCloseBtn:
-      "//div[@data-testid='t--git-ops-modal']//button[@aria-label='Close']",
+    opsModalCloseBtn: "[data-testid='t--git-ops-modal-close']",

Also applies to: 41-41, 58-58, 65-65

🧹 Nitpick comments (1)
app/client/cypress/support/Pages/GitSync.ts (1)

414-414: Use constants for assertion messages.

Hardcoded strings in assertions make maintenance difficult and are prone to typos. Move these to a constants file.

+// Create a new file: app/client/cypress/support/Constants/GitMessages.ts
+export const GIT_MESSAGES = {
+  INITIAL_COMMIT: "Initial commit",
+  MERGED_SUCCESSFULLY: "Merged successfully",
+  DISCARD_CHANGES_WARNING: "Discarding changes cannot be undone",
+  DISCARDED_SUCCESSFULLY: "Discarded changes successfully",
+};

-    this.agHelper.TypeText(this.locators.opsCommitInput, "Initial commit");
+    this.agHelper.TypeText(this.locators.opsCommitInput, GIT_MESSAGES.INITIAL_COMMIT);

-    this.agHelper.AssertContains("Merged successfully", "be.visible");
+    this.agHelper.AssertContains(GIT_MESSAGES.MERGED_SUCCESSFULLY, "be.visible");

-    this.agHelper.AssertContains("Discarding changes cannot be undone");
+    this.agHelper.AssertContains(GIT_MESSAGES.DISCARD_CHANGES_WARNING);

-    this.agHelper.AssertContains("Discarded changes successfully");
+    this.agHelper.AssertContains(GIT_MESSAGES.DISCARDED_SUCCESSFULLY);

Also applies to: 477-477, 493-493, 499-499

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f12d21d and 57c0d64.

📒 Files selected for processing (1)
  • app/client/cypress/support/Pages/GitSync.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`app/client/cypress/**/**.*`: Review the following e2e test ...

app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
  • app/client/cypress/support/Pages/GitSync.ts
📓 Learnings (1)
app/client/cypress/support/Pages/GitSync.ts (1)
Learnt from: brayn003
PR: appsmithorg/appsmith#38635
File: app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/MergeViaRemote_spec.ts:102-102
Timestamp: 2025-01-13T15:14:12.806Z
Learning: In Cypress Git sync tests, explicit assertions after _.gitSync.SwitchGitBranch() are not required as the helper method likely handles the verification internally.
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (1)
app/client/cypress/support/Pages/GitSync.ts (1)

290-290: LGTM! Added wait improves test stability.

The added wait for spinner to disappear helps prevent flaky tests by ensuring UI is ready before proceeding.

Copy link

github-actions bot commented Feb 5, 2025

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13151990277.
Cypress dashboard url: Click here!
All Cypress tests have passed 🎉🎉🎉

***** Repeat Run Summary ***** Total Tests with repeat: 200 Total Passed: 126 Total Failed: 24 Total Skipped: 0 *****************************

Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Feb 12, 2025
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=50

Copy link

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13321716466.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

***** Repeat Run Summary ***** Total Tests with repeat: 200 Total Passed: 127 Total Failed: 23 Total Skipped: 0 *****************************

@github-actions github-actions bot removed the Stale label Feb 14, 2025
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=50

Copy link

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13428792836.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

***** Repeat Run Summary ***** Total Tests with repeat: 200 Total Passed: 122 Total Failed: 28 Total Skipped: 0 *****************************

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant