Skip to content

Commit

Permalink
[Testing] Added UI Test for manual test D3 (#18649)
Browse files Browse the repository at this point in the history
* Added UI Test

* Fix incorrect manual test identifier

* More changes
  • Loading branch information
jsuarezruiz committed Nov 9, 2023
1 parent a7aa020 commit 8e933a7
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue18645">
<VerticalStackLayout>
<Label
AutomationId="WaitForStubControl"
Text="1. Input characters in the editor until it won't accept more input." />
<Label
Text="2. The test fails if the maximum number of characters is more or less than 5 characters." />
<Editor
AutomationId="IssueEditor"
MaxLength="5" />
</VerticalStackLayout>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.ManualTest, "D3", "Editor MaxLength property works as expected", PlatformAffected.All)]
public partial class Issue18645 : ContentPage
{
public Issue18645()
{
InitializeComponent();
}
}
}
31 changes: 31 additions & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue18645.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.AppiumTests.Issues
{
public class Issue18645 : _IssuesUITest
{
public Issue18645(TestDevice device) : base(device)
{
}

public override string Issue => "Editor MaxLength property works as expected";

[Test]
public void EditorMaxLengthWorks()
{
App.WaitForElement("WaitForStubControl");

// 1. Input characters in the editor until it won't accept more input.
App.EnterText("IssueEditor", "123456789");

// 2. The test fails if the maximum number of characters is more
// or less than 5 characters.
var editorText = App.FindElement("IssueEditor").GetText();

// MaxLines = 5
Assert.AreEqual("12345", editorText);
}
}
}

0 comments on commit 8e933a7

Please sign in to comment.