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] Added UI Test for manual test D3 #18649

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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>
@@ -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
@@ -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);
}
}
}