Skip to content

Commit

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

* Updated test

* Changes to ensure other tests

* Revert changes

* Updated test
  • Loading branch information
jsuarezruiz authored Dec 14, 2023
1 parent a19fbb7 commit 33f5d20
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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.Issue18754">
<ScrollView>
<VerticalStackLayout>
<Label
AutomationId="WaitForStubControl"
Text="1. Attempt to enter any text into the editor below." />
<Label
Text="2. The test fails if the editor displays the input." />
<Editor
AutomationId="ReadOnlyEditor"
IsReadOnly="True"
Text="" />
<Label
Text="3. Attempt to edit the text in the editor below." />
<Label
Text="4. The test fails if the editor displays the input." />
<Editor
AutomationId="FilledReadOnlyEditor"
IsReadOnly="True"
Text="Try to edit this." />
</VerticalStackLayout>
</ScrollView>
</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, "D9", "[D9] Editor IsReadOnly works", PlatformAffected.All)]
public partial class Issue18754 : ContentPage
{
public Issue18754()
{
InitializeComponent();
}
}
}
6 changes: 5 additions & 1 deletion src/Controls/tests/UITests/Tests/Issues/Issue18675.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ public Issue186751(TestDevice device) : base(device)
public override string Issue => "Editor IsReadOnly property prevent from modifying the text";

[Test]
public void EditorIsReadOnlyPreventModify()
public async Task EditorIsReadOnlyPreventModify()
{
App.WaitForElement("WaitForStubControl");

// 1.The test fails if the placeholder text in the editor below is missing.
App.Click("IsReadOnlyEditor");

// Delay for the Editor underline on Android to return from
// the selected state to normal state.
await Task.Delay(500);

// 2. The test fails if the placeholder text in the editor below is not blue.
VerifyScreenshot();
}
Expand Down
34 changes: 34 additions & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue18754.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

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

public override string Issue => "[D9] Editor IsReadOnly works";

[Test]
public void Issue18754Test()
{
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Mac, TestDevice.Windows },
"Currently IsKeyboardShown is not implemented.");

App.WaitForElement("WaitForStubControl");

// 1. Attempt to enter any text into the editor below.
App.Click("ReadOnlyEditor");

// 2. The test fails if the editor displays the input.
Assert.IsFalse(App.IsKeyboardShown());

// 3. Attempt to edit the text in the editor below.
App.Click("FilledReadOnlyEditor");

// 4. The test fails if the editor displays the input.
Assert.IsFalse(App.IsKeyboardShown());
}
}
}

0 comments on commit 33f5d20

Please sign in to comment.