Skip to content

Conversation

@TamilarasanSF4853
Copy link
Contributor

@TamilarasanSF4853 TamilarasanSF4853 commented Dec 29, 2025

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.

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Dec 29, 2025
@Ahamed-Ali Ahamed-Ali added testing-flakiness area-testing Unit tests, device tests labels Dec 29, 2025
@sheiksyedm sheiksyedm marked this pull request as ready for review December 29, 2025 10:37
Copilot AI review requested due to automatic review settings December 29, 2025 10:37
@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 29, 2025
Copy link
Contributor

Copilot AI left a 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

private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e)
{
#if ANDROID
if (((WebView)sender).Handler?.PlatformView is Android.Webkit.WebView androidWebView)
Copy link

Copilot AI Dec 29, 2025

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.

Suggested change
if (((WebView)sender).Handler?.PlatformView is Android.Webkit.WebView androidWebView)
if (((WebView)sender).Handler?.PlatformView is Android.Webkit.WebView)

Copilot uses AI. Check for mistakes.
webView.Navigated += (s, e) =>
{
#if ANDROID
if (((WebView)s).Handler?.PlatformView is Android.Webkit.WebView androidWebView)
Copy link

Copilot AI Dec 29, 2025

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.

Suggested change
if (((WebView)s).Handler?.PlatformView is Android.Webkit.WebView androidWebView)
if (((WebView)s).Handler?.PlatformView is Android.Webkit.WebView)

Copilot uses AI. Check for mistakes.
@PureWeen
Copy link
Member

/rebase

@PureWeen PureWeen merged commit cb9c7cd into dotnet:main Dec 30, 2025
158 of 161 checks passed
StephaneDelcroix pushed a commit that referenced this pull request Jan 5, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-testing Unit tests, device tests community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration testing-flakiness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants