summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.iOS.UITests/Tests/DisplayAlertUITests.cs
blob: be0e4997a8330273bf2e5bba75db1d78295f6136 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
using NUnit.Framework;
using Xamarin.UITest;
using System;
using System.Threading;


namespace Xamarin.Forms.Core.UITests
{
	[TestFixture]
	[Category ("DisplayAlert")]
	internal class DisplayAlertUITests : BaseTestFixture
	{

		protected override void NavigateToGallery ()
		{
			App.NavigateToGallery (GalleryQueries.DisplayAlertGallery);
		}

		[Test]
		public void TestWithCancelButton ()
		{
		
			App.Tap (c => c.Marked ("Alert Override1"));
			App.Screenshot ("Display Alert");
			App.WaitForElement (c => c.Marked ("TheAlertTitle"));
			App.WaitForElement (c => c.Marked ("TheAlertMessage"));
			App.WaitForElement (c => c.Marked ("TheCancelButton"));
			App.Screenshot ("Display Alert Closed");
			App.Tap (c => c.Marked ("TheCancelButton"));
			App.WaitForNoElement (c => c.Marked ("TheAlertTitle"));
		}

		[Test]
		public void TestWithCancelAndOkButton ()
		{
			App.Tap (c => c.Marked ("Alert Override2"));
			App.Screenshot ("Display Alert");
			App.WaitForElement (c => c.Marked ("TheAlertTitle"));
			App.WaitForElement (c => c.Marked ("TheAlertMessage"));
			App.WaitForElement (c => c.Marked ("TheAcceptButton"));
			App.WaitForElement (c => c.Marked ("TheCancelButton"));
			App.Tap (c => c.Marked ("TheCancelButton"));
			App.Screenshot ("Display Alert Closed");
			App.WaitForNoElement (c => c.Marked ("TheAlertTitle"));
		}

		[Test]
		public void TestOkAndCancelResults ()
		{
			App.Tap (c => c.Marked ("Alert Override2"));
			App.Screenshot ("Display Alert");
			App.WaitForElement (c => c.Marked ("TheCancelButton"));
			App.Tap (c => c.Marked ("TheCancelButton"));
			App.Screenshot ("Display Alert Closed with cancel");
			App.WaitForElement (c => c.Marked ("Result: False"));
			App.Tap (c => c.Marked ("test2"));
			App.Screenshot ("Display Alert");
			App.WaitForElement (c => c.Marked ("TheAcceptButton"));
			App.Tap (c => c.Marked ("TheAcceptButton"));
			App.Screenshot ("Display Alert Closed with True");
			App.WaitForElement (c => c.Marked ("Result: True"));
		}
			
//		[Test]
//		public void TestRotation ()
//		{
//			App.SetOrientationLandscape ();
//
//			//App.Tap (c => c.Marked ("Alert Override1"));
//			// 27-01-2015 14:30:02.125 -08:00 - 28524 - Tapping first element (2 total) matching Marked("Alert Override1") at coordinates [ 512, 113 ]. 
//
//			App.TapCoordinates (665, 512);
//
//			App.WaitForElement (c => c.Marked ("TheAlertTitle"));
//
//			App.Screenshot ("Display Alert After Rotation");
//			App.WaitForElement (c => c.Marked ("TheAlertTitle"));
//			App.Tap (c => c.Marked("TheCancelButton"));
//			App.WaitForNoElement (c => c.Marked("TheCancelButton"));
//			App.SetOrientationPortrait ();
//
//		}

	}
}