summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/TabbedPageTests.cs
blob: fb3b7373ff5c8f91b418ffaf52bd0e2bc11c86f9 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

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

namespace Xamarin.Forms.Controls
{
	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.None, 0,"TabbedPage nav tests", PlatformAffected.All)]
	public class TabbedPageTests : TestTabbedPage
	{
		protected override void Init ()
		{
			var popButton1 = new Button () { Text = "Pop", BackgroundColor = Color.Blue };
			popButton1.Clicked += (s, a) => Navigation.PopModalAsync ();

			var popButton2 = new Button () { Text = "Pop 2", BackgroundColor = Color.Blue };
			popButton2.Clicked += (s, a) => Navigation.PopModalAsync ();

			Children.Add (new ContentPage () { Title = "Page 1", Content = popButton1 });
			Children.Add (new ContentPage () { Title = "Page 2", Content = popButton2 });
		}

#if UITEST
		[Test]
		public void TabbedPageWithModalIssueTestsAllElementsPresent ()
		{
			RunningApp.WaitForElement (q => q.Marked ("Page 1"));
			RunningApp.WaitForElement (q => q.Marked ("Page 2"));
			RunningApp.WaitForElement (q => q.Button ("Pop"));

			RunningApp.Screenshot ("All elements present");
		}

		[Test]
		public void TabbedPageWithModalIssueTestsPopFromFirstTab ()
		{
			RunningApp.Tap (q => q.Button ("Pop"));
			RunningApp.WaitForElement (q => q.Marked ("Bug Repro's"));

			RunningApp.Screenshot ("Popped from first tab");
		}

		[Test]
		public void TabbedPageWithModalIssueTestsPopFromSecondTab ()
		{
			RunningApp.Tap (q => q.Marked ("Page 2"));
			RunningApp.WaitForElement (q => q.Button ("Pop 2"));
			RunningApp.Screenshot ("On second tab");

			RunningApp.Tap (q => q.Button ("Pop 2"));
			RunningApp.WaitForElement (q => q.Marked ("Bug Repro's"));
			RunningApp.Screenshot ("Popped from second tab");
		}
#endif
	}
}