[Testing] Fix for flaky test(PullToRefreshWorksWhenEnabled) in CI#31625
Merged
PureWeen merged 1 commit intodotnet:net10.0from Sep 16, 2025
Merged
[Testing] Fix for flaky test(PullToRefreshWorksWhenEnabled) in CI#31625PureWeen merged 1 commit intodotnet:net10.0from
PureWeen merged 1 commit intodotnet:net10.0from
Conversation
Contributor
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves the reliability of a flaky UI test for pull-to-refresh functionality by adding retry logic and more precise gesture parameters. The test was failing intermittently in CI due to timing issues and unreliable gesture recognition.
Key Changes
- Added retry loop with up to 3 attempts for pull-to-refresh gesture
- Enhanced gesture parameters with specific scroll strategy, swipe percentage, and speed
- Improved error handling with try-catch block around verification steps
Comment on lines
+134
to
+137
| catch (Exception) | ||
| { | ||
| // Refresh not completed yet, will retry | ||
| } |
There was a problem hiding this comment.
Catching all exceptions with a generic Exception handler can mask important errors. Consider catching specific exceptions related to timeout or element not found scenarios, or at minimum log the exception details for debugging purposes.
Suggested change
| catch (Exception) | |
| { | |
| // Refresh not completed yet, will retry | |
| } | |
| catch (WebDriverTimeoutException ex) | |
| { | |
| // Refresh not completed yet, will retry | |
| TestContext.WriteLine($"Timeout waiting for refresh: {ex.Message}"); | |
| } | |
| catch (NoSuchElementException ex) | |
| { | |
| // Element not found, will retry | |
| TestContext.WriteLine($"Element not found during refresh: {ex.Message}"); | |
| } | |
| catch (Exception ex) | |
| { | |
| // Unexpected exception, log details | |
| TestContext.WriteLine($"Unexpected exception during refresh: {ex}"); | |
| } |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This pull request improves the reliability of the pull-to-refresh test in
Issue30690.csby adding retry logic and more robust verification for the refresh completion. The main change is to ensure the test does not fail due to transient issues with the pull gesture or UI timing.Test robustness improvements:
ScrollStrategy.Gesture, a high swipe percentage, and a defined swipe speed for more consistent interaction.