summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.iOS.UITests/Tests/AutomationIDUITests.cs
blob: 7746bafab6d34a740642e3cee7c3f0ab15faef20 (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
´╗┐using NUnit.Framework;
using Xamarin.UITest;
using System;
using System.Threading;
using Xamarin.UITest.Queries;

namespace Xamarin.Forms.Core.UITests
{
	[TestFixture]
	[Category ("AutomationID")]
	internal class AutomationIDUITests : BaseTestFixture
	{
		protected override void NavigateToGallery ()
		{
			App.NavigateToGallery (GalleryQueries.AutomationIDGallery);
		}

		[Test]
		public void Test1 ()
		{
			App.Tap (c => c.Marked ("btnTest1"));
			App.WaitForElement (c => c.Marked ("scrollMain"));
			App.WaitForElement (c => c.Marked ("stckMain"));
			App.WaitForElement (c => c.Marked ("actHello"));
			App.WaitForElement (c => c.Marked ("bxvHello"));
			App.Tap (c => c.Marked ("btnHello"));
			App.WaitForElement (c => c.Marked ("dtPicker"));
			App.WaitForElement (c => c.Marked ("tPicker"));
	
			var label = App.Query ("lblHello") [0];
			Assert.AreEqual (label.Text, "Hello Label");

			var editor = App.Query ("editorHello") [0];
			Assert.AreEqual (editor.Text, "Hello Editor");

			var entry = App.Query ("entryHello") [0];
			Assert.AreEqual (entry.Text, "Hello Entry");
				
			App.Tap (c => c.Marked ("popModal"));
		}


		[Test]
		public void Test2 ()
		{
			App.Tap (c => c.Marked ("btnTest2"));
			App.WaitForElement (c => c.Marked ("imgHello"));
			App.WaitForElement (c => c.Marked ("lstView"));
			App.WaitForElement (c => c.Marked ("pickerHello"));
			App.WaitForElement (c => c.Marked ("progressHello"));
			App.ScrollDownTo (c => c.Marked ("progressHello"));
			App.WaitForElement (c => c.Marked ("srbHello"));
			App.WaitForElement (c => c.Marked ("sliHello"));
			App.WaitForElement (c => c.Marked ("stepperHello"));
			App.WaitForElement (c => c.Marked ("switchHello"));
			//App.WaitForElement (c => c.Marked ("webviewHello"));
			App.Tap (c => c.Marked ("popModal"));
		}

		[Test]
		[Ignore("only works on ios")] 
		public void TestToolbarItem ()
		{
			App.Tap (c => c.Marked ("tbItemHello"));
			App.WaitForElement (x => x.Marked ("Hello"));
			App.Tap (c => c.Marked ("ok"));
			App.Tap (c => c.Marked ("tbItemHello2"));
			App.WaitForElement (x => x.Marked ("Hello2"));
			App.Tap (c => c.Marked ("ok"));
		}
	}
}