- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.9k
[Testing] Fix for flaky test(PullToRefreshWorksWhenEnabled) in CI #31625
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
Conversation
| /azp run MAUI-UITests-public | 
| Azure Pipelines successfully started running 1 pipeline(s). | 
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.
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
| catch (Exception) | ||
| { | ||
| // Refresh not completed yet, will retry | ||
| } | 
    
      
    
      Copilot
AI
    
    
    
      Sep 16, 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.
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.
| 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 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.