diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32886.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue32886.cs index b9f5498ed4d3..a58195201963 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue32886.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32886.cs @@ -3,6 +3,8 @@ namespace Maui.Controls.Sample.Issues; [Issue(IssueTracker.Github, 32886, "[Android, iOS, Mac] Entry ClearButton not visible on dark theme", PlatformAffected.Android | PlatformAffected.iOS | PlatformAffected.macOS)] public class Issue32886 : TestContentPage { + Label _themeLabel; + protected override void Init() { Title = "Issue32886"; @@ -25,9 +27,18 @@ protected override void Init() }; button.Clicked += Button_Clicked; + _themeLabel = new Label + { + Text = "Light", + AutomationId = "ThemeLabel", + HeightRequest = 0, + Opacity = 0 + }; + var layout = new VerticalStackLayout(); layout.Children.Add(entry); layout.Children.Add(button); + layout.Children.Add(_themeLabel); Content = layout; @@ -39,7 +50,9 @@ private void Button_Clicked(object sender, EventArgs e) { if (Application.Current is not null) { - Application.Current.UserAppTheme = Application.Current.UserAppTheme != AppTheme.Dark ? AppTheme.Dark : AppTheme.Light; + var newTheme = Application.Current.UserAppTheme != AppTheme.Dark ? AppTheme.Dark : AppTheme.Light; + Application.Current.UserAppTheme = newTheme; + _themeLabel.Text = newTheme == AppTheme.Dark ? "Dark" : "Light"; } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32886.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32886.cs index 9cadff37384f..a18ef47da308 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32886.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32886.cs @@ -40,6 +40,10 @@ public void EntryClearButtonShouldBeVisibleOnDarkTheme() { App.WaitForElement("TestEntry"); App.Tap("ThemeButton"); + + // Wait for the theme change to propagate through the UI + App.WaitForTextToBePresentInElement("ThemeLabel", "Dark"); + #if WINDOWS // On Windows, the clear button isn't visible when Entry loses focus, so manually focused to check its icon color. App.Tap("TestEntry"); #endif @@ -47,9 +51,9 @@ public void EntryClearButtonShouldBeVisibleOnDarkTheme() #if IOS // On iOS, the virtual keyboard appears inconsistent with keyboard characters casing, can cause flaky test results. As this test verifying only the entry clear button color, crop the bottom portion of the screenshot to exclude the keyboard. // Using DismissKeyboard() would unfocus the control in iOS, so we're using cropping instead to maintain focus during testing. - VerifyScreenshot(cropBottom: 1550); + VerifyScreenshot(cropBottom: 1550, retryTimeout: TimeSpan.FromSeconds(3)); #else - VerifyScreenshot(); + VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(3)); #endif } } \ No newline at end of file