Skip to content

Commit 33f5d20

Browse files
authored
[Testing] Added UI Test for manual test D9 (dotnet#18762)
* Added UI Test * Updated test * Changes to ensure other tests * Revert changes * Updated test
1 parent a19fbb7 commit 33f5d20

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
x:Class="Maui.Controls.Sample.Issues.Issue18754">
5+
<ScrollView>
6+
<VerticalStackLayout>
7+
<Label
8+
AutomationId="WaitForStubControl"
9+
Text="1. Attempt to enter any text into the editor below." />
10+
<Label
11+
Text="2. The test fails if the editor displays the input." />
12+
<Editor
13+
AutomationId="ReadOnlyEditor"
14+
IsReadOnly="True"
15+
Text="" />
16+
<Label
17+
Text="3. Attempt to edit the text in the editor below." />
18+
<Label
19+
Text="4. The test fails if the editor displays the input." />
20+
<Editor
21+
AutomationId="FilledReadOnlyEditor"
22+
IsReadOnly="True"
23+
Text="Try to edit this." />
24+
</VerticalStackLayout>
25+
</ScrollView>
26+
</ContentPage>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.Maui.Controls;
2+
using Microsoft.Maui.Controls.Xaml;
3+
4+
namespace Maui.Controls.Sample.Issues
5+
{
6+
[XamlCompilation(XamlCompilationOptions.Compile)]
7+
[Issue(IssueTracker.ManualTest, "D9", "[D9] Editor IsReadOnly works", PlatformAffected.All)]
8+
public partial class Issue18754 : ContentPage
9+
{
10+
public Issue18754()
11+
{
12+
InitializeComponent();
13+
}
14+
}
15+
}

src/Controls/tests/UITests/Tests/Issues/Issue18675.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ public Issue186751(TestDevice device) : base(device)
1313
public override string Issue => "Editor IsReadOnly property prevent from modifying the text";
1414

1515
[Test]
16-
public void EditorIsReadOnlyPreventModify()
16+
public async Task EditorIsReadOnlyPreventModify()
1717
{
1818
App.WaitForElement("WaitForStubControl");
1919

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

23+
// Delay for the Editor underline on Android to return from
24+
// the selected state to normal state.
25+
await Task.Delay(500);
26+
2327
// 2. The test fails if the placeholder text in the editor below is not blue.
2428
VerifyScreenshot();
2529
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using NUnit.Framework;
2+
using UITest.Appium;
3+
using UITest.Core;
4+
5+
namespace Microsoft.Maui.AppiumTests.Issues
6+
{
7+
public class Issue18754 : _IssuesUITest
8+
{
9+
public Issue18754(TestDevice device) : base(device) { }
10+
11+
public override string Issue => "[D9] Editor IsReadOnly works";
12+
13+
[Test]
14+
public void Issue18754Test()
15+
{
16+
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Mac, TestDevice.Windows },
17+
"Currently IsKeyboardShown is not implemented.");
18+
19+
App.WaitForElement("WaitForStubControl");
20+
21+
// 1. Attempt to enter any text into the editor below.
22+
App.Click("ReadOnlyEditor");
23+
24+
// 2. The test fails if the editor displays the input.
25+
Assert.IsFalse(App.IsKeyboardShown());
26+
27+
// 3. Attempt to edit the text in the editor below.
28+
App.Click("FilledReadOnlyEditor");
29+
30+
// 4. The test fails if the editor displays the input.
31+
Assert.IsFalse(App.IsKeyboardShown());
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)