-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
base: release
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request updates the test case in the Git synchronization suite by adding a third parameter ( Changes
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
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip 🌐 Web search-backed reviews and chat
✨ Finishing Touches
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
/ci-test-limit-count run_count= 50 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13127515232. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13127515232.
|
/ci-test-limit-count run_count=50 update_snapshot=true cypress/e2e/Regression/ClientSide/Git/GitSync/DeleteBranch_spec.js |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13128757044. |
/ci-test-limit-count run_count=50 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13141011924. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13141011924.
|
/ci-test-limit-count run_count=50 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13151990277. |
There was a problem hiding this 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()
andagHelper.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
📒 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.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13151990277.
|
This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected. |
/ci-test-limit-count run_count=50 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13321716466. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13321716466.
|
/ci-test-limit-count run_count=50 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13428792836. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13428792836.
|
Summary by CodeRabbit
Warning
Tests have not run on the HEAD 57c0d64 yet
Wed, 05 Feb 2025 07:03:20 UTC