-
Notifications
You must be signed in to change notification settings - Fork 23
feat!: Add generic click() method to all component testers (#1940) #2012
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implements a Clickable mixin interface that provides click functionality to all component testers via ComponentTester base class. Changes: - Add Clickable interface with default implementations for click(), middleClick(), and rightClick() methods - ComponentTester now implements Clickable, making click methods available to all testers - Remove duplicate click implementations from ButtonTester, HtmlClickContainer, and NativeDetailsTester - Add navigate() method to AnchorTester and RouterLinkTester that returns the navigated view - Override click() in navigation testers to call navigate() internally (returns void for interface compliance) - Add comprehensive tests for the new click functionality - Update existing tests to use navigate() when return value is needed The solution allows all component testers to have consistent click functionality while preserving special behaviors for components that need custom handling (Checkbox, RadioButton, SideNav). 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
mcollovati
reviewed
Sep 30, 2025
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.
ClickHandler
is a public interface, so we cannot remove it because it might have been used in user projects.
We need to restore and deprecate, suggesting the usage of Clickable
instead.
mcollovati
reviewed
Sep 30, 2025
...stbench-unit-shared/src/main/java/com/vaadin/flow/component/html/testbench/AnchorTester.java
Show resolved
Hide resolved
mcollovati
reviewed
Sep 30, 2025
...stbench-unit-shared/src/main/java/com/vaadin/flow/component/routerlink/RouterLinkTester.java
Show resolved
Hide resolved
mcollovati
reviewed
Sep 30, 2025
vaadin-testbench-unit-shared/src/main/java/com/vaadin/testbench/unit/ComponentTester.java
Show resolved
Hide resolved
mcollovati
reviewed
Oct 1, 2025
vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ClickableTest.java
Show resolved
Hide resolved
Updated testClick_customComponent to use getEventBus().addListener() instead of element.addEventListener() for more reliable event handling that works with ComponentUtil.fireEvent(). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Fixed type inference issue in testClick_customComponent by using raw ComponentEventListener type with @SuppressWarnings annotation. The generic type inference was causing compilation failures in CI. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
mcollovati
reviewed
Oct 1, 2025
vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ClickableTest.java
Outdated
Show resolved
Hide resolved
Replaced getEventBus().addListener() with ComponentUtil.addListener() for a cleaner implementation in testClick_customComponent. This is the recommended approach and avoids the need for @SuppressWarnings. Note: Explicit cast to ComponentEventListener is still required due to Java's type inference limitations with lambda expressions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
mcollovati
approved these changes
Oct 1, 2025
32 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements a Clickable mixin interface that provides click functionality to all component testers via ComponentTester base class.
Changes:
click
return type needs to migrate tonavigate
)The solution allows all component testers to have consistent click functionality while preserving special behaviors for components that need custom handling (Checkbox, RadioButton, SideNav).