Skip to content
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

[Testing] Fix flaky UITests failing sometimes 3 #27277

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Maui.Controls.Sample
{
public class NoCaretEntry : Entry
{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;

namespace Maui.Controls.Sample
{
public class NoCaretEntryHandler
{
public static void RemoveCaret()
{
Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping(nameof(NoCaretEntry), (handler, view) =>
{
if (view is NoCaretEntry)
{
#if ANDROID
handler.PlatformView.SetCursorVisible(false);
#elif IOS
handler.PlatformView.TintColor = UIKit.UIColor.Clear;
#endif
}
});
}
}
}
5 changes: 3 additions & 2 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue21109.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue21109"
xmlns:local="clr-namespace:Maui.Controls.Sample"
xmlns:controls="clr-namespace:Maui.Controls.Sample.Issues">
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Label
AutomationId="WaitForStubControl"
Text="ReturnType (Search)" />
<Entry
<local:NoCaretEntry
AutomationId="SearchEntry"
ReturnType="Search" />
<Label
Text="Update the ReturnType just typing" />
<Entry
<local:NoCaretEntry
x:Name="ReturnTypeEntry"
AutomationId="ReturnTypeEntry"
TextChanged="OnReturnTypeEntryTextChanged"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/tests/TestCases.HostApp/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected override Window CreateWindow(IActivationState activationState)
#endif

#endif

NoCaretEntryHandler.RemoveCaret();

return window;
}
Expand Down
Loading