-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] Stabilize flaky tests related to mouse movement #16906
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
[java] Stabilize flaky tests related to mouse movement #16906
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||||||
4ef79e6 to
0e93740
Compare
1. Reset mouse pointer to (0,0) before each test
2. Wait until the next page gets loaded after click
3. Extract a reusable method for checking background color which is tolerant to browsers ("rgb in Chrome" vs "rgbs in Firefox").
0e93740 to
da93508
Compare
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||
User description
🔄 Types of changes
PR Type
Bug fix, Tests
Description
Reset mouse pointer to (0,0) before each test to eliminate flakiness
Extract reusable
fuzzyMatchingOfCoordinates()andcolor()methods toWaitingConditionsReplace browser-specific color assertions with tolerance-aware
color()methodRemove flaky test annotations and improve mouse tracker HTML page structure
Update coordinate assertions to match actual mouse positions after reset
Diagram Walkthrough
File Walkthrough
WaitingConditions.java
Add reusable fuzzy coordinate and color matching conditionsjava/test/org/openqa/selenium/WaitingConditions.java
fuzzyMatchingOfCoordinates()method with 10-pixel tolerance forcoordinate matching
color()method supporting both RGB and RGBA color formats forcross-browser compatibility
ColorsandExpectedConditionsutilitiesmouse_interaction.html
Add mouse tracking and click event loggingcommon/src/web/mouse_interaction.html
#bottomdiv
DefaultMouseTest.java
Stabilize mouse tests with pointer reset and reusable conditionsjava/test/org/openqa/selenium/bidi/input/DefaultMouseTest.java
resetMousePointer()method called in@BeforeEachto positionmouse at (0,0)
fuzzyMatchingOfCoordinates()andcolor()calls fromWaitingConditions@NeedsFreshDriverand@Ignoreannotations from flaky teststestMoveToLocation()to wait for page load before assertionstestMoveRelativeToBody()to expect correct coordinates afterreset
color()method for browsertolerance
MOUSE_TRACKERdimension constantDefaultMouseTest.java
Stabilize mouse tests with pointer reset and reusable conditionsjava/test/org/openqa/selenium/interactions/DefaultMouseTest.java
resetMousePointer()method in@BeforeEachto position mouse at(0,0)
fuzzyMatchingOfCoordinates()implementation withWaitingConditionsversion@NeedsFreshDriverand@Ignoreannotations from flaky teststestMoveToLocation()to wait for page load before assertionstestMoveRelativeToBody()to expect correct coordinates afterreset
color()method for browsertolerance
PenPointerTest.java
Stabilize pen pointer tests with reset and reusable conditionsjava/test/org/openqa/selenium/interactions/PenPointerTest.java
resetMousePointer()method to position pen pointer at (0,0)fuzzyMatchingOfCoordinates()toWaitingConditionsfuzzyPositionMatching()with reusablecolor()method@NeedsFreshDriverand@Ignoreannotations from flaky teststestMoveRelativeToBody()to use reset and expect correctcoordinates
assertThatExceptionOfType()withassertThatThrownBy()formodern assertions
BasicMouseInterfaceTest.cs
Update expected coordinates after mouse resetdotnet/test/common/Interactions/BasicMouseInterfaceTest.cs
MoveRelativeToBody()test to expect coordinates (50, 100)instead of (40, 20)
mousePositionTracker.html
Refactor mouse tracker page for reliable coordinate trackingcommon/src/web/mousePositionTracker.html
positioning
positioning
lang="en"attribute and<title>elementbox-sizing: border-boxfor consistent dimensions