Split 36171 into multiple tests and add more helpful assertion messages

This commit is contained in:
E.Z. Hart 2018-01-17 10:39:02 -07:00
Родитель 38f244aa49
Коммит fa21576e26
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 1196DD903A2F7606
1 изменённых файлов: 20 добавлений и 9 удалений

Просмотреть файл

@ -3,16 +3,22 @@ using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.Forms.Core.UITests;
using NUnit.Framework;
using Xamarin.UITest.Queries;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.Editor)]
[Category(UITestCategories.Entry)]
#endif
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Bugzilla, 36171, "WinRT Entry UI not updating on TextChanged",
PlatformAffected.WinPhone | PlatformAffected.WinRT)]
public class Bugzilla36171 : TestContentPage // or TestMasterDetailPage, etc ...
public class Bugzilla36171 : TestContentPage
{
protected override void Init ()
{
@ -78,33 +84,38 @@ namespace Xamarin.Forms.Controls.Issues
RunningApp.EnterText ("123A");
var entry = RunningApp.Query (q => q.Text("123"));
Assert.That(entry.Length >= 1);
Assert.That(entry.Length, Is.GreaterThanOrEqualTo(1), "The entry text should be '123'.");
var failedEntry = RunningApp.Query (q => q.Text("123A"));
Assert.That(failedEntry.Length == 0);
Assert.That(failedEntry.Length, Is.EqualTo(0), "The entry text should only be '123'.");
RunningApp.EnterText ("4");
var entry2 = RunningApp.Query (q => q.Text("1234"));
Assert.That(entry2.Length >= 1);
RunningApp.ClearText("36171Entry");
Assert.That(entry2.Length, Is.GreaterThanOrEqualTo(1), "The entry text should now be '1234'.");
}
[Test]
#if __MACOS__
[Ignore("Missing UITest for focus")]
#endif
public void EditorTextDoesNotDisplayNonnumericInput ()
{
RunningApp.WaitForElement ("Start Editor");
RunningApp.Tap ("Start Editor");
RunningApp.EnterText ("123A");
var editor = RunningApp.Query (q => q.Text("123"));
Assert.That(editor.Length >= 1);
Assert.That(editor.Length, Is.GreaterThanOrEqualTo(1), "The editor text should be '123'.");
var failedEditor = RunningApp.Query (q => q.Text("123A"));
Assert.That(failedEditor.Length == 0);
Assert.That(failedEditor.Length, Is.EqualTo(0), "The editor text should only be '123'.");
RunningApp.EnterText ("4");
var editor2 = RunningApp.Query (q => q.Text("1234"));
Assert.That(editor2.Length >= 1);
Assert.That(editor2.Length, Is.GreaterThanOrEqualTo(1), "The editor text should now be '1234'.");
}
#endif
}