From f84fab4588c63103edec496e1a6d9dd6eb3cef63 Mon Sep 17 00:00:00 2001 From: Ione Souza Junior Date: Thu, 21 Feb 2019 22:08:31 -0300 Subject: [PATCH] Add UI test to B41600 (#5174) --- .../Bugzilla41600.cs | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41600.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41600.cs index 21b3df2..ef8c5c3 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41600.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41600.cs @@ -13,6 +13,11 @@ namespace Xamarin.Forms.Controls.Issues [Issue(IssueTracker.Bugzilla, 41600, "[Android] Invalid item param value for ScrollTo throws an error", PlatformAffected.Android)] public class Bugzilla41600 : TestContentPage { + const string _btnScrollToNonExistentItem = "btnScrollToNonExistentItem"; + const string _btnScrollToExistentItem = "btnScrollToExistentItem"; + const string _firstListItem = "0"; + const string _middleListItem = "15"; + protected override void Init() { var items = new List(); @@ -30,6 +35,7 @@ namespace Xamarin.Forms.Controls.Issues listView, new Button { + AutomationId = _btnScrollToNonExistentItem, Text = "Click for ScrollTo (should do nothing)", Command = new Command(() => { @@ -38,14 +44,32 @@ namespace Xamarin.Forms.Controls.Issues }, new Button { + AutomationId = _btnScrollToExistentItem, Text = "Click for ScrollTo (should go to 15)", Command = new Command(() => { - listView.ScrollTo(items[15], ScrollToPosition.Start, false); + listView.ScrollTo(_middleListItem, ScrollToPosition.Start, false); }) } } }; } + +#if UITEST && __ANDROID__ + [Test] + public void Bugzilla41600Test() + { + RunningApp.WaitForElement(_btnScrollToNonExistentItem); + RunningApp.WaitForElement(_btnScrollToExistentItem); + + RunningApp.Tap(_btnScrollToNonExistentItem); + RunningApp.WaitForElement(_firstListItem); + RunningApp.WaitForNoElement(_middleListItem); + + RunningApp.Tap(_btnScrollToExistentItem); + RunningApp.WaitForNoElement(_firstListItem); + RunningApp.WaitForElement(_middleListItem); + } +#endif } } \ No newline at end of file -- 2.7.4