summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UITests.Shared/Tests/DisplayAlertUITests.cs
blob: ce935dc94101aaf59767e2ebcc7071b3b264c2c8 (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
using NUnit.Framework;

namespace Xamarin.Forms.Core.UITests
{
	[TestFixture]
	[Category(UITestCategories.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"));
		}
	}
}