Skip to content

Commit

Permalink
Added a UiTest (#20439)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaflo committed Feb 14, 2024
1 parent 15ffcd8 commit d6fd5d8
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue20439"
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues">
<ShellContent
Title="Home">
<ContentPage>
<StackLayout VerticalOptions="Center">
<Entry AutomationId="entry" Text="Tap here"/>
<Button AutomationId="button" Text="Open the input page" Clicked="Button_Clicked"/>
</StackLayout>
</ContentPage>
</ShellContent>

<ShellContent
Title="Text input page">
<ContentPage>
<Editor VerticalOptions="Center"
AutomationId="editor"
HeightRequest="100"
Text="Potential auto correcting words: -- :-) ... omw \n" />
</ContentPage>
</ShellContent>
</Shell>
@@ -0,0 +1,20 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 20439, "[iOS] Double dash in Entry or Editor crashes the app", PlatformAffected.iOS)]
public partial class Issue20439 : Shell
{
public Issue20439()
{
InitializeComponent();
}

void Button_Clicked(object sender, System.EventArgs e)
{
CurrentItem = Items[1];
}
}
}
28 changes: 28 additions & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue20439.cs
@@ -0,0 +1,28 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.AppiumTests.Issues
{
public class Issue20439 : _IssuesUITest
{
public override string Issue => "[iOS] Double dash in Entry or Editor crashes the app";

public Issue20439(TestDevice device) : base(device)
{
}

[Test]
public void ErrorShouldNotBeThrown()
{
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows });

_ = App.WaitForElement("entry");
App.Click("entry");
App.Click("button");

// The test passes if no crash is observed
App.FindElement("editor");
}
}
}

0 comments on commit d6fd5d8

Please sign in to comment.