summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/TabbedPageWithList.cs
blob: d9a70dbdacf7772dd25adb2fe87485f6224fd3db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using NUnit.Framework;
using Xamarin.UITest;
#endif


namespace Xamarin.Forms.Controls.Issues
{
	[Preserve (AllMembers = true)]
	public class TabbedPageWithListName {
		public string Name { get; set; }
	}

	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.None, 0, "TabbedPage with list", PlatformAffected.All)]
	public class TabbedPageWithList : TestTabbedPage
	{
		protected override void Init ()
		{
			Title = "Tabbed Page with List";
			Children.Add (new ContentPage { Title = "Tab Two" });
			Children.Add (new ListViewTest ());
		}

#if UITEST
		[Test]
		public void TabbedPageWithListViewIssueTestsAllElementsPresent ()
		{
			RunningApp.WaitForElement (q => q.Marked ("Tab Two"));
			RunningApp.WaitForElement (q => q.Marked ("List Page"));
			RunningApp.Screenshot ("All elements present");
		}

		[Test]
		public void TabbedPageWithListViewIssueTestsNavigateToAndVerifyListView ()
		{
			RunningApp.Tap (q => q.Marked ("List Page"));

			RunningApp.WaitForElement (q => q.Marked ("Jason"));
			RunningApp.WaitForElement (q => q.Marked ("Ermau"));
			RunningApp.WaitForElement (q => q.Marked ("Seth"));

			RunningApp.Screenshot ("ListView correct");
		}
#endif

		public class ListViewTest : ContentPage
		{
			public ListViewTest ()
			{
				Title = "List Page";

				var items = new[] {
					new TabbedPageWithListName () { Name = "Jason" },
					new TabbedPageWithListName () { Name = "Ermau" },
					new TabbedPageWithListName () { Name = "Seth" }
				};

				var cellTemplate = new DataTemplate (typeof(TextCell));
				cellTemplate.SetBinding (TextCell.TextProperty, "Name");

				Content = new ListView () {
					ItemTemplate = cellTemplate,
					ItemsSource = items
				};
			}
		}
	}
}