-
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: analysing flaky Switch Branch #39302
base: release
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request updates the test specification file by replacing a reference to a JS editor indentation test with one for Git branch switching. Additionally, it adjusts the status of widget tests by commenting out one line and uncommenting its counterpart. These modifications refocus the limited test suite toward Git-related scenarios. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
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/13361864664. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13361864664.
|
/ci-test-limit-count run_count=50 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13375245014. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13375245014.
|
/ci-test-limit-count run_count=50 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13393334444. |
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: 1
🔭 Outside diff range comments (1)
app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js (1)
94-95
: 🛠️ Refactor suggestionRemove explicit waits and use proper assertions.
Using
cy.wait()
is against Cypress best practices. Replace these with proper assertions or commands that automatically wait.Replace the waits with appropriate assertions:
-// eslint-disable-next-line cypress/no-unnecessary-waiting -cy.wait(2000); +cy.get('@apiResponse').should('exist');Also applies to: 112-113, 173-173
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js
(2 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/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js
🧠 Learnings (1)
app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js (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/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js (1)
131-131
: LGTM! Improved navigation method.The change to
NavigateToPage
is more appropriate for this use case.
cy.get(".t--page-switch-tab") | ||
.contains("ParentPage1") | ||
.click({ force: true }); | ||
agHelper.WaitUntilEleAppear(".t--widget-tablewidgetv2"); |
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.
🛠️ Refactor suggestion
Avoid force clicking and use data- attributes for selectors.*
The current implementation uses force click and CSS class selectors which could be brittle.
Apply this diff to improve the test reliability:
-cy.get(".t--page-switch-tab")
- .contains("ParentPage1")
- .click({ force: true });
-agHelper.WaitUntilEleAppear(".t--widget-tablewidgetv2");
+cy.get('[data-testid="t--page-switch-tab"]')
+ .contains("ParentPage1")
+ .should('be.visible')
+ .click();
+cy.get('[data-testid="t--widget-tablewidgetv2"]')
+ .should('be.visible');
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
cy.get(".t--page-switch-tab") | |
.contains("ParentPage1") | |
.click({ force: true }); | |
agHelper.WaitUntilEleAppear(".t--widget-tablewidgetv2"); | |
cy.get('[data-testid="t--page-switch-tab"]') | |
.contains("ParentPage1") | |
.should('be.visible') | |
.click(); | |
cy.get('[data-testid="t--widget-tablewidgetv2"]') | |
.should('be.visible'); |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13393334444.
|
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
🧹 Nitpick comments (1)
app/client/cypress/support/Objects/CommonLocators.ts (1)
358-358
: LGTM! Consider using data-testid for better test stability.The spinner locator is a good addition for handling loading states in tests. However, consider using a data-testid attribute instead of the Blueprint class for better test stability, as CSS classes might change during UI framework updates.
- _spinnerHead = ".bp3-spinner-head"; + _spinnerHead = "[data-testid='t--spinner-head']";
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js
(3 hunks)app/client/cypress/support/Objects/CommonLocators.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js
🧰 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/Objects/CommonLocators.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: client-lint / client-lint
- GitHub Check: client-prettier / prettier-check
- GitHub Check: client-build / client-build
/ci-test-limit-count run_count=50 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13420171827. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13420171827.
|
/ci-test-limit-count run_count=50 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13433014768. |
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/PageList.ts (2)
11-15
: 🛠️ Refactor suggestionRefactor selectors to use data-testid attributes.
The current selectors use string concatenation and CSS classes. According to our guidelines, we should use data-testid attributes for more reliable test selection.
Example refactor:
private locators = { - pageListItem: (pageName: string) => - `.t--entity.page:contains('${pageName}')`, - newButton: ".pages .t--entity-add-btn", - newPageOption: ".ads-v2-menu__menu-item-children", - switcher: `.t--pages-switcher`, + pageListItem: (pageName: string) => + `[data-testid="page-item-${pageName}"]`, + newButton: "[data-testid=add-page-button]", + newPageOption: "[data-testid=page-option-menu]", + switcher: "[data-testid=pages-switcher]", };
110-110
:⚠️ Potential issueRemove hardcoded waits and use proper assertions.
Using hardcoded waits (cy.wait) can make tests flaky. Instead, use Cypress's built-in retry-ability with assertions.
Replace with:
- cy.wait(2000); + cy.get('.t--context-menu-container').should('be.visible'); - cy.wait("@deletePage") + cy.intercept('DELETE', '**/api/v1/pages/*').as('deletePage'); + cy.get('@deletePage').should('have.property', 'response.body.responseMeta.status', 200);Also applies to: 113-113
🧹 Nitpick comments (1)
app/client/cypress/support/Pages/PageList.ts (1)
11-12
: Sanitize page name input in selectors.String concatenation in selectors could lead to XSS if the page name contains malicious content. Consider sanitizing the input or using a safer selector strategy.
private locators = { pageListItem: (pageName: string) => - `.t--entity.page:contains('${pageName}')`, + `[data-testid="page-item-${encodeURIComponent(pageName)}"]`, };
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js
(4 hunks)app/client/cypress/support/Pages/PageList.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js
🧰 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/PageList.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: client-lint / client-lint
- GitHub Check: client-unit-tests / client-unit-tests
- GitHub Check: client-prettier / prettier-check
- GitHub Check: client-build / client-build
🔇 Additional comments (1)
app/client/cypress/support/Pages/PageList.ts (1)
73-73
:❓ Verification inconclusive
Investigate why force click is necessary.
Adding
force: true
might mask underlying issues. Consider investigating why the element needs to be force-clicked:
- Is the element truly clickable?
- Is there an overlay blocking it?
- Is the element properly visible in the viewport?
🏁 Script executed:
#!/bin/bash # Search for other force clicks in Cypress tests rg -l "force: true" "app/client/cypress"Length of output: 25245
Investigate the Necessity of Force Click on the Switcher Element
The usage offorce: true
in this click command mirrors a broader pattern across many Cypress tests in the project. While it can be acceptable in certain cases to bypass minor UI inconsistencies, it often indicates an underlying issue that should be addressed. Please verify the following for this specific element:
- Is the switcher genuinely clickable without forcing the action?
- Could an overlay or another UI element be obstructing interaction?
- Is the element fully visible in the viewport as expected?
Reassessing these points will help ensure that we’re not masking deeper issues with our tests.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13433014768.
|
/ci-test-limit-count run_count=15 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/13438394490. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13438394490.
|
Summary by CodeRabbit
ShowList
method to ensure it functions regardless of element state.Warning
Tests have not run on the HEAD c641ba7 yet
Thu, 20 Feb 2025 15:09:20 UTC