Add UITest for issue 1763 (#5907)
authorpuppetSpace <mobscene_dude@hotmail.com>
Mon, 22 Apr 2019 21:05:54 +0000 (23:05 +0200)
committerE.Z. Hart <hartez@users.noreply.github.com>
Mon, 22 Apr 2019 21:05:54 +0000 (15:05 -0600)
* Add UITest for issue 1763

* Removed restriction for Windows Only. Also added the PreserveAttribute on the classes the test used.

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Controls/ContactsPage.cs
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1763.cs

index 60e9f09..e046324 100644 (file)
@@ -12,6 +12,7 @@ using Xamarin.Forms.Internals;
 
 namespace Xamarin.Forms.Controls
 {
+       [Preserve(AllMembers = true)]
        public class ContactsPage : ContentPage
        {
                public ContactsPage()
@@ -48,6 +49,7 @@ namespace Xamarin.Forms.Controls
                }
        }
 
+       [Preserve(AllMembers = true)]
        public class ContactViewModel : ViewModelBase2
        {
                string _name;
@@ -66,6 +68,7 @@ namespace Xamarin.Forms.Controls
                }
        }
 
+       [Preserve(AllMembers = true)]
        public class Group<TItem> : ObservableCollection<TItem>
        {
                public Group(string name, IEnumerable<TItem> items)
@@ -78,6 +81,7 @@ namespace Xamarin.Forms.Controls
                public string Name { get; set; }
        }
 
+       [Preserve(AllMembers = true)]
        public class ViewModelBase2 : INotifyPropertyChanged
        {
                public event PropertyChangedEventHandler PropertyChanged;
index 85e8ad1..b4b1d3f 100644 (file)
@@ -6,21 +6,41 @@ using System.Linq;
 using System.Runtime.CompilerServices;
 using System.Text;
 using System.Threading.Tasks;
-
 using Xamarin.Forms.CustomAttributes;
 using Xamarin.Forms.Internals;
 
+#if UITEST
+using NUnit.Framework;
+#endif
+
 namespace Xamarin.Forms.Controls.Issues
 {
        [Preserve (AllMembers=true)]
        [Issue (IssueTracker.Github, 1763, "First item of grouped ListView not firing .ItemTapped", PlatformAffected.WinPhone, NavigationBehavior.PushAsync)]
-       public class Issue1763 : TabbedPage
+       public class Issue1763 : TestTabbedPage
        {
                public Issue1763 ()
                {
+               
+               }
+
+               protected override void Init()
+               {
                        Title = "Contacts";
+                       Children.Add(new ContactsPage());
+               }
 
-                       Children.Add (new ContactsPage ());
+#if UITEST
+               [Test]
+               public void TestIssue1763ItemTappedFiring()
+               {
+                       RunningApp.WaitForElement(q => q.Marked("Contacts"));
+                       RunningApp.Tap(q => q.Marked("Egor1"));
+                       RunningApp.WaitForElement(q => q.Marked("Tapped a List item"));
+                       RunningApp.Tap(q => q.Marked("Destruction"));
+                       RunningApp.WaitForElement(q => q.Marked("Contacts"));
                }
+#endif
+
        }
 }