Skip to content

Commit

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

* Updated test
  • Loading branch information
jsuarezruiz authored Nov 13, 2023
1 parent 8d029d4 commit 2fb3603
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?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.Issue18647">
<VerticalStackLayout>
<Label
AutomationId="WaitForStubControl"
Text="1. Input the string 'aBcDeFg' into the editor below." />
<Label
Text="2. The test fails if the editor below does not display the string 'aBcDeFg' exactly (case-sensitive)." />
<Editor
AutomationId="NoneTextTransformEditor"
Text=""
TextTransform="None" />
<Label
Text="3. Input the string 'aBcDeFg' into the editor below." />
<Label
Text="4. The test fails if the editor below does not display the string 'abcdefg' exactly (case-sensitive)." />
<Editor
AutomationId="LowercaseTextTransformEditor"
Text=""
TextTransform="Lowercase" />
<Label
Text="5. Input the string 'aBcDeFg' into the editor below." />
<Label
Text="6. The test fails if the editor below does not display the string 'ABCDEFG' exactly (case-sensitive)." />
<Editor
AutomationId="UppercaseTextTransformEditor"
Text=""
TextTransform="Uppercase" />
<Label
Text="7. The test fails if the editor below does not display the string 'abcdefg' exactly (case-sensitive)." />
<Editor
AutomationId="FilledLowercaseTextTransformEditor"
Text="aBcDeFg"
TextTransform="Lowercase" />
<Label
Text="8. The test fails if the editor below does not display the string 'ABCDEFG' exactly (case-sensitive)." />
<Editor
AutomationId="FilledUppercaseTextTransformEditor"
Text="aBcDeFg"
TextTransform="Uppercase" />
</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, "D4", "Editor TextTransform property works as expected", PlatformAffected.All)]
public partial class Issue18647 : ContentPage
{
public Issue18647()
{
InitializeComponent();
}
}
}
52 changes: 52 additions & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue18647.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.AppiumTests.Issues
{
public class Issue18647 : _IssuesUITest
{

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

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

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

// 1. Input the string 'aBcDeFg' into the editor below.
App.EnterText("NoneTextTransformEditor", "aBcDeFg");

// 2. The test fails if the editor below does not display the string 'aBcDeFg' exactly (case-sensitive).
var result2 = App.FindElement("NoneTextTransformEditor").GetText()?.Trim();
Assert.AreEqual("aBcDeFg", result2);

// 3. Input the string 'aBcDeFg' into the editor below.
App.EnterText("LowercaseTextTransformEditor", "aBcDeFg");

// 4. The test fails if the editor below does not display the string 'abcdefg' exactly (case-sensitive).
var result4 = App.FindElement("LowercaseTextTransformEditor").GetText()?.Trim();
Assert.AreEqual("abcdefg", result4);

// 5. Input the string 'aBcDeFg' into the editor below.
App.EnterText("UppercaseTextTransformEditor", "aBcDeFg");

// 6. The test fails if the editor below does not display the string 'ABCDEFG' exactly (case-sensitive).
var result6 = App.FindElement("UppercaseTextTransformEditor").GetText()?.Trim();
Assert.AreEqual("ABCDEFG", result6);

// 7. The test fails if the editor below does not display the string 'abcdefg' exactly (case-sensitive).
var result7 = App.FindElement("FilledLowercaseTextTransformEditor").GetText()?.Trim();
Assert.AreEqual("abcdefg", result7);

// 8. The test fails if the editor below does not display the string 'ABCDEFG' exactly (case-sensitive).
var result8 = App.FindElement("FilledUppercaseTextTransformEditor").GetText()?.Trim();

Assert.AreEqual("ABCDEFG", result8);
}
}
}

0 comments on commit 2fb3603

Please sign in to comment.