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

fix: table save row button onclick function #35412

Merged
merged 16 commits into from
Aug 8, 2024

Conversation

AmanAgarwal041
Copy link
Contributor

@AmanAgarwal041 AmanAgarwal041 commented Aug 5, 2024

Description

The onClick method was attached to both button and parent child : https://github.com/appsmithorg/appsmith/blob/release/app/client/src/widgets/ButtonWidget/component/index.tsx#L204-L232
Hence, whenever we clicked on the button using the UI, since there was a check of loading state inside the onclick handler it was not triggering twice as before running the onclick of parent it was updating the reference value of loading inside it.
But if we trigger the button click using cypress or the document.querySelector from console, it used to execute the addnewrow action twice, thereby creating two rows. Hence added a stopPropagation function in the onclick handler, which restricts the onclick to propagate to the parent.

Fixes #35146

EE runs - https://github.com/appsmithorg/appsmith-ee/pull/4818
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.Widget, @tag.Datasource, @tag.Binding"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10301142371
Commit: 40a81cb
Cypress dashboard.
Tags: @tag.Widget, @tag.Datasource, @tag.Binding
Spec:


Thu, 08 Aug 2024 12:44:05 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Improved user experience by refining the click event handling in the Add New Row banner, preventing unintended interactions.
  • Tests

    • Enhanced the Cypress test suite for the Table Widget, improving organization and readability while ensuring accurate verification of the one-click binding feature.
    • Updated limited tests to include multiple components related to ClientSide functionality, ensuring more comprehensive testing coverage.
    • Added a check for the filterable property of the table widget in Cypress tests, enhancing test robustness and accuracy.
    • Improved the locator method for the "filterable" input in tests to enhance maintainability and resilience to UI changes.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Walkthrough

The recent modifications enhance the Cypress test suite for the Table widget's one-click binding feature and the filterable property of the table widget. By improving test organization, readability, and robustness of interactions, these updates ensure comprehensive test coverage while maintaining the core functionality. This facilitates easier maintenance and greater reliability of the test code.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ClientSide/.../mysql_spec.ts, app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts Enhanced test readability and structure; added checks for the filterable property before interactions.
app/client/cypress/limited-tests.txt Updated test paths, replacing Fork_Template_spec.js with new relevant specifications.

Assessment against linked issues

Objective Addressed Explanation
Fix flakiness of tests (e.g., mysql_spec.ts) (#35146)
Improve event handling in UI components (#35146) Unclear if all interactions are fully tested.

Poem

In code we weave a tapestry bright,
With tests that dance in the morning light.
Clicks no longer roam, they stay in their lane,
Enhancements made, our efforts not in vain.
Clarity reigns in every line,
For user joy, our stars align! ✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@github-actions github-actions bot added cypress-flaky-fix This label is auto-added when a PR which only has Cypress fixes are merged to release Integrations Product Issues related to a specific integration Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Stability Pod For all issues/tasks to be prioritized under Stability pod Task A simple Todo labels Aug 5, 2024
@AmanAgarwal041 AmanAgarwal041 added the ok-to-test Required label for CI label Aug 5, 2024
@github-actions github-actions bot added the Bug Something isn't working label Aug 5, 2024
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c888543 and 336caf3.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/mysql_spec.ts (1 hunks)
  • app/client/src/widgets/TableWidgetV2/component/header/banner/AddNewRowBanner.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/mysql_spec.ts
Additional comments not posted (1)
app/client/src/widgets/TableWidgetV2/component/header/banner/AddNewRowBanner.tsx (1)

72-73: Good job! Preventing event propagation is crucial in complex UIs.

The addition of event.stopPropagation() in the onClick handler ensures that the click event does not bubble up to parent elements, which can prevent unintended behaviors and improve the user experience.

@AmanAgarwal041
Copy link
Contributor Author

/ci-test-limit

Copy link

github-actions bot commented Aug 5, 2024

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 336caf3 and 264aa60.

Files selected for processing (1)
  • app/client/cypress/limited-tests.txt (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/cypress/limited-tests.txt

Copy link

github-actions bot commented Aug 5, 2024

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

@AmanAgarwal041
Copy link
Contributor Author

/ci-test-limit

Copy link

github-actions bot commented Aug 5, 2024

Copy link

github-actions bot commented Aug 5, 2024

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

@AmanAgarwal041
Copy link
Contributor Author

/ci-test-limit

Copy link

github-actions bot commented Aug 5, 2024

Copy link

github-actions bot commented Aug 5, 2024

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

@AmanAgarwal041 AmanAgarwal041 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Aug 5, 2024
Copy link
Contributor

@ApekshaBhosale ApekshaBhosale left a comment

Choose a reason for hiding this comment

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

remove all static wait ie agHelper.Sleep and the execute this spec multiple times on EE and CE that will give you clear idea if removing static wait has removed all flakiness. @AmanAgarwal041

@AmanAgarwal041
Copy link
Contributor Author

/ci-test-limit runId=10285287321

1 similar comment
@AmanAgarwal041
Copy link
Contributor Author

/ci-test-limit runId=10285287321

Copy link

github-actions bot commented Aug 7, 2024

Copy link

github-actions bot commented Aug 7, 2024

Copy link

github-actions bot commented Aug 7, 2024

Copy link

github-actions bot commented Aug 7, 2024

@AmanAgarwal041 AmanAgarwal041 removed the ok-to-test Required label for CI label Aug 7, 2024
Copy link

github-actions bot commented Aug 7, 2024

Copy link

github-actions bot commented Aug 7, 2024

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

Copy link

github-actions bot commented Aug 7, 2024

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

Copy link

github-actions bot commented Aug 7, 2024

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

Copy link

github-actions bot commented Aug 7, 2024

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

Copy link

github-actions bot commented Aug 7, 2024

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

@AmanAgarwal041 AmanAgarwal041 added the ok-to-test Required label for CI label Aug 7, 2024
@AmanAgarwal041
Copy link
Contributor Author

@AmanAgarwal041 AmanAgarwal041 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Aug 8, 2024
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6a02827 and 40a81cb.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts
Additional context used
Learnings (1)
Common learnings
Learnt from: sagar-qa007
PR: appsmithorg/appsmith#35412
File: app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/mysql_spec.ts:99-99
Timestamp: 2024-08-06T05:59:19.000Z
Learning: In Cypress tests within the `app/client/cypress` directory, avoid using `agHelper.Sleep`, `this.Sleep`, and other related sleep functions to prevent non-deterministic behaviors and ensure tests are more reliable and maintainable. Instead, use Cypress methods like `cy.get()`, `cy.contains()`, and `cy.intercept()` to wait for specific conditions.

@AmanAgarwal041 AmanAgarwal041 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Aug 8, 2024
@AmanAgarwal041 AmanAgarwal041 merged commit f0059fe into release Aug 8, 2024
44 checks passed
@AmanAgarwal041 AmanAgarwal041 deleted the fix/35146-table-one-click branch August 8, 2024 13:16
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working cypress-flaky-fix This label is auto-added when a PR which only has Cypress fixes are merged to release Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Product Issues related to a specific integration ok-to-test Required label for CI Query & JS Pod Issues related to the query & JS Pod Stability Pod For all issues/tasks to be prioritized under Stability pod Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Fix flakiness of cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/mysql_spec.ts
4 participants