summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue465.cs
blob: 80028b5995fd62d241e06f27938987a29aa07b91 (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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
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.Issues
{
	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.Github, 465, "Change in Navigation.PushModal", PlatformAffected.All)]
	public class Issue465 : TestTabbedPage
	{
		protected override async void Init ()
		{
			Children.Add (
				new ContentPage {
					Content = new Label {
						Text = "I was popppppped"
					}
				}
			);

			await Navigation.PushModalAsync (new ModalPage ());
		}
			
		[Preserve (AllMembers = true)]
		public class ModalPage : ContentPage
		{
			public ModalPage ()
			{
				var popButton = new Button {
					Text = "Pop this page"
				};
				popButton.Clicked += (s, e) => Navigation.PopModalAsync ();

				Content = popButton;
			}
		}

#if UITEST
		[Test]
		public void Issue465TestsPushPopModal ()
		{
			RunningApp.WaitForElement (q => q.Button ("Pop this page"));
			RunningApp.Screenshot ("All elements exist");

			RunningApp.Tap (q => q.Button ("Pop this page"));
			RunningApp.WaitForElement (q => q.Marked ("I was popppppped"));
			RunningApp.Screenshot ("Popped modal successful");
		}
#endif
	}
}