Skip to content

Commit fcdaf3a

Browse files
kubaflojfversluis
authored andcommitted
Added a UI test
1 parent 2e4f6cc commit fcdaf3a

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System.Windows.Input;
2+
3+
namespace Maui.Controls.Sample.Issues;
4+
5+
[Issue(IssueTracker.Github, 17783, "Pasting long text when the editor has a max length does nothing", PlatformAffected.All)]
6+
public partial class Issue17783 : ContentPage
7+
{
8+
public Issue17783()
9+
{
10+
var stackLayout = new VerticalStackLayout();
11+
12+
var entry = new Entry
13+
{
14+
AutomationId = "Entry",
15+
MaxLength = 5
16+
};
17+
18+
var editor = new Editor
19+
{
20+
AutomationId = "Editor",
21+
MaxLength = 5
22+
};
23+
24+
var pasteToEntryButton = new Button
25+
{
26+
Text = "Paste to entry",
27+
AutomationId = "PasteToEntryButton"
28+
};
29+
pasteToEntryButton.Clicked += (s, e) => entry.Text = "Hello, Maui!";
30+
31+
var pasteToEditorButton = new Button
32+
{
33+
Text = "Paste to editor",
34+
AutomationId = "PasteToEditorButton"
35+
};
36+
pasteToEditorButton.Clicked += (s, e) => editor.Text = "Hello, Maui!";
37+
38+
stackLayout.Children.Add(entry);
39+
stackLayout.Children.Add(editor);
40+
stackLayout.Children.Add(pasteToEntryButton);
41+
stackLayout.Children.Add(pasteToEditorButton);
42+
43+
Content = stackLayout;
44+
}
45+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using NUnit.Framework;
2+
using UITest.Appium;
3+
using UITest.Core;
4+
5+
namespace Microsoft.Maui.TestCases.Tests.Issues
6+
{
7+
public class Issue17783 : _IssuesUITest
8+
{
9+
public Issue17783(TestDevice testDevice) : base(testDevice)
10+
{
11+
}
12+
13+
public override string Issue => "Pasting long text when the editor has a max length does nothing";
14+
15+
[Test]
16+
[Category(UITestCategories.Editor)]
17+
[Category(UITestCategories.Entry)]
18+
public void TextShouldBeCut()
19+
{
20+
App.WaitForElement("PasteToEntryButton");
21+
App.Click("PasteToEntryButton");
22+
App.Click("PasteToEditorButton");
23+
var entryText = App.FindElement("Entry").GetText;
24+
var editorText = App.FindElement("Editor").GetText;
25+
26+
Assert.That(entryText, Is.EqualTo("Hello"));
27+
Assert.That(editorText, Is.EqualTo("Hello"));
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)