Conversation
WalkthroughThis pull request updates the error handling in the Cypress test cases for a button widget binding with a Text widget employing Google reCAPTCHA. The changes modify how toast messages are checked: the previous direct assertion is replaced with a validation method. Additionally, the method for waiting for toast disappearance is updated to validate the toast's content before waiting until all toast messages are cleared. Method signatures in the support file have been updated accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as TestCase
participant Helper as agHelper
Test->>Helper: ValidateToastMessage("Google reCAPTCHA token generation failed!")
alt Toast is present
Helper-->>Test: Toast validated
end
Test->>Helper: ValidateToastMessage(testdata.errorMsg)
Test->>Helper: WaitUntilAllToastsDisappear()
Helper-->>Test: Confirmation received
Suggested labels
Suggested reviewers
Poem
Tip 🌐 Web search-backed reviews and chat
📜 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 (7)
🪧 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
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (2)
app/client/cypress/e2e/Regression/ClientSide/Binding/Button_Text_WithRecaptcha_spec.js (2)
43-43: Remove all instances of_.agHelper.Sleep().Using
Sleep()makes tests flaky and slower. Replace with appropriate Cypress wait commands or assertions.Replace the Sleep() calls with proper Cypress commands:
- _.agHelper.Sleep(); + _.agHelper.WaitUntilAllToastsDisappear(); + _.agHelper.WaitForNetworkCall('POST'); // If waiting for API responseAlso applies to: 53-53, 62-62, 76-76
19-20: Replace CSS selectors with data- attributes.*Using CSS selectors like
widgetInCanvas("textwidget") + " span"is fragile. Use data-* attributes instead.Update the selectors to use data attributes:
- _.locators._widgetInCanvas("textwidget") + " span" + _.locators._dataAttribute("widget-text-content")Also applies to: 28-29, 45-46, 54-56, 85-86, 93-94
🧹 Nitpick comments (1)
app/client/cypress/e2e/Regression/ClientSide/Binding/Button_Text_WithRecaptcha_spec.js (1)
77-91: Refactor complex conditional logic.The body check with multiple conditions makes the test hard to maintain. Consider extracting this into a helper function.
Consider refactoring to:
- cy.get("body").then(($ele) => { - if ( - $ele.find( - _.locators._specificToast( - "Google reCAPTCHA token generation failed!", - ), - ).length || - $ele - .find(_.locators._widgetInCanvas("textwidget") + " span") - .text() == "" - ) { - _.agHelper.WaitUntilAllToastsDisappear(); - _.agHelper.ClickButton("Submit"); - } - }); + _.agHelper.RetryUntilSuccess(() => { + _.agHelper.ClickButton("Submit"); + _.agHelper.ValidateTextNotEmpty(_.locators._dataAttribute("widget-text-content")); + });
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/client/cypress/e2e/Regression/ClientSide/Binding/Button_Text_WithRecaptcha_spec.js(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/Binding/Button_Text_WithRecaptcha_spec.js (1)
Pattern 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.
⏰ 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/e2e/Regression/ClientSide/Binding/Button_Text_WithRecaptcha_spec.js (1)
101-102: LGTM! Improved toast message handling.The changes to use
ValidateToastMessagefollowed byWaitUntilAllToastsDisappearimprove test reliability by properly validating toast content before waiting for disappearance.Also applies to: 113-114, 121-122
|
/ci-test-limit-count run_count=20 update_snapshot=false specs_to_run=cypress/e2e/Regression/ClientSide/Binding/Button_Text_WithRecaptcha_spec.js |
|
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13129606515. |
## Description Verify toast before disapper. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Binding" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/13129952231> > Commit: e0a07d1 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13129952231&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Binding` > Spec: > <hr>Tue, 04 Feb 2025 08:41:43 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Tests** - Enhanced error notification handling for Google reCAPTCHA failures to ensure users receive consistent and reliable feedback. - Improved the process for validating that error messages display correctly and clear as expected during failure scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
Verify toast before disapper.
Fixes #
Issue Numberor
Fixes
Issue URLWarning
If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.
Automation
/ok-to-test tags="@tag.Binding"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13129952231
Commit: e0a07d1
Cypress dashboard.
Tags:
@tag.BindingSpec:
Tue, 04 Feb 2025 08:41:43 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit