-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Testing] Fix for flaky UITests in CI - 7 #33313
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
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 addresses flaky UI tests in CI by fixing cookie handling on Android WebView and improving test reliability. The key changes include adding explicit cookie flush calls on Android to ensure cookies are persisted to storage before assertions, updating a test URL for better reliability, and adding test interactions to improve test stability.
Key changes:
- Added
CookieManager.Flush()calls in Android WebView navigation event handlers to ensure cookies are written to persistent storage before validation - Updated test URL from Microsoft Learn to the main dotnet.microsoft.com domain for improved reliability
- Enhanced Entry feature test with additional UI element interaction before screenshot verification
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/Controls/tests/TestCases.HostApp/Issues/Issue12134.cs |
Added Android-specific cookie flush logic in WebView navigation handler to ensure cookies are persisted before validation |
src/Controls/tests/TestCases.HostApp/Issues/Issue18452.cs |
Updated test URL from Microsoft Learn to dotnet.microsoft.com and added cookie flush logic for Android |
src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/EntryFeatureTests.cs |
Added wait and tap interactions with TextChangedLabel before screenshot verification in vertical alignment test |
src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/EntryFeatureTests.cs
Show resolved
Hide resolved
| private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e) | ||
| { | ||
| #if ANDROID | ||
| if (((WebView)sender).Handler?.PlatformView is Android.Webkit.WebView androidWebView) |
Copilot
AI
Dec 29, 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.
The variable androidWebView is declared but never used. Consider removing this unused variable from the pattern matching expression. The cookieManager?.Flush() call doesn't require the androidWebView variable since it accesses CookieManager.Instance directly.
| if (((WebView)sender).Handler?.PlatformView is Android.Webkit.WebView androidWebView) | |
| if (((WebView)sender).Handler?.PlatformView is Android.Webkit.WebView) |
| webView.Navigated += (s, e) => | ||
| { | ||
| #if ANDROID | ||
| if (((WebView)s).Handler?.PlatformView is Android.Webkit.WebView androidWebView) |
Copilot
AI
Dec 29, 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.
The variable androidWebView is declared but never used. Consider removing this unused variable from the pattern matching expression. The cookieManager?.Flush() call doesn't require the androidWebView variable since it accesses CookieManager.Instance directly.
| if (((WebView)s).Handler?.PlatformView is Android.Webkit.WebView androidWebView) | |
| if (((WebView)s).Handler?.PlatformView is Android.Webkit.WebView) |
|
/rebase |
This reverts commit 75f1c36.
d48da5b to
bae075a
Compare
This pull request introduces a platform-specific adjustment to the `VerifyVerticalTextAlignmentBasedOnCharacterSpacing` test to improve its reliability on Windows. The main change ensures that the test interacts with the UI in a way that accounts for the behavior of the Entry control cursor on Windows. Platform-specific test reliability: * Updated the `VerifyVerticalTextAlignmentBasedOnCharacterSpacing` test in `EntryFeatureTests.cs` to tap the `TextChangedLabel` on Windows after applying changes, ensuring the Entry control cursor does not interfere with screenshot verification.
This pull request introduces a platform-specific adjustment to the
VerifyVerticalTextAlignmentBasedOnCharacterSpacingtest to improve its reliability on Windows. The main change ensures that the test interacts with the UI in a way that accounts for the behavior of the Entry control cursor on Windows.Platform-specific test reliability:
VerifyVerticalTextAlignmentBasedOnCharacterSpacingtest inEntryFeatureTests.csto tap theTextChangedLabelon Windows after applying changes, ensuring the Entry control cursor does not interfere with screenshot verification.