summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-SearchBarUITests.cs
blob: d9461cf694f530a8e7b53205ba35a97d96120089 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using System.Threading;

namespace Xamarin.Forms.Core.UITests
{
	[TestFixture]
	[Category ("SearchBar")]
	internal class SearchBarGalleryTests : BaseTestFixture
	{
		// TODO: Enter text and try searching
		// TODO: Port to new conventions

		public SearchBarGalleryTests ()
		{
			ShouldResetPerFixture = false;
		}

		protected override void NavigateToGallery ()
		{
			App.NavigateToGallery (GalleryQueries.SearchBarGalleryLegacy);
		}
	
		[Test]
		[Category ("ManualReview")]
		[Description ("Enter query into each SearchBar")]
		public void SearchBarGalleryEnterSearchText ()
		{
//			SearchBarGalleryAllElementsPresent ();
//			for (var i = 0; i < 3; i++) {
//				App.ScrollDownForElement (PlatformQueries.SearchBarWithIndex (i), 5);
//				App.Tap (PlatformQueries.SearchBarWithIndex (i));
//				App.EnterText (PlatformQueries.SearchBarWithIndex (i), "Search: " + i);
//				App.Screenshot ("Keyboard should be shown");
//				App.PressEnter ();
//				App.WaitForElement (q => q.Marked ("Search: " + i));
//				App.Screenshot (string.Format("Keyboard should be dismissed - Label should have changed to 'Search: {0}'", i));
//			}

//			App.Tap (q => q.Button ("More SearchBars"));
//			App.WaitForElement (q => q.Marked ("Search Query 2"));

//			SearchBarGalleryAllElementsPresentPageTwo ();

//			// Disabled keyboard
//			App.Tap (PlatformQueries.SearchBarWithIndex (0));
//			App.Screenshot ("Should not see keyboard for disabled SearchBar");

//			App.Tap (PlatformQueries.SearchBarWithIndex (1));
//			App.Screenshot ("Should not see keyboard for disabled SearchBar");
//			App.EnterText (PlatformQueries.SearchBarWithIndex (1), "Entered transparent");
//			App.PressEnter ();
//			App.WaitForElement (q => q.Marked ("Entered transparent"));
//			App.Screenshot ("Entered query for tranparent SearchBar");
		}
			
//		[Test]
//		[Category ("ManualReview")]
//		[Description ("Enable disable keyboard, Issues #1182, #1237")]
//		public void SearchBarGalleryEnableDisableSearchBar () 
//		{
//			App.Tap (q => q.Button ("More SearchBars"));
//			App.WaitForElement (q => q.Marked ("Search Query 2"));

//			SearchBarGalleryAllElementsPresentPageTwo ();

//			App.Tap (PlatformQueries.SearchBarWithIndex (0));
//			App.Screenshot ("SearchBar should not be focused, keyboard should not be shown");

//			App.Tap (q => q.Button ("Toggle enabled"));
//			App.Tap (PlatformQueries.SearchBarWithIndex (0));
//			App.EnterText (PlatformQueries.SearchBarWithIndex (0), "Now Enabled");
//			App.PressEnter ();
//			App.ScrollDownForElement (q => q.Marked ("Now Enabled"), 2);
//			App.Screenshot ("Enabled and abled to query");

//			App.Tap (q => q.Button ("Toggle enabled"));
//			App.Screenshot ("Disabled again");

//			App.ScrollUpForElement (PlatformQueries.SearchBarWithIndex (0), 2);
//			App.Tap (PlatformQueries.SearchBarWithIndex (0));
//			App.Screenshot ("SearchBar should not be focused, keyboard should not be shown after diabling once again");
//		}

//		[Test]
////		[Category ("Single")]
//		[Description ("Test the TextChanged event")]
//		public void SearchBarGalleryTextChangedEventTest ()
//		{
//			SearchBarGalleryAllElementsPresent ();

//			App.EnterText (PlatformQueries.SearchBarWithIndex (0), "A");
//			App.Screenshot ("Entered three characters in noPlaceholder search bar");
//			var labelText = App.GetTextForQuery (PlatformQueries.LabelWithText ("1"));
//			Assert.AreEqual ("1", labelText);

//			App.EnterText (PlatformQueries.SearchBarWithIndex (1), "B");
//			App.Screenshot ("Entered three characters in normal search bar");
//			labelText = App.GetTextForQuery (PlatformQueries.LabelWithText ("2"));
//			Assert.AreEqual ("2", labelText);

//			App.EnterText (PlatformQueries.SearchBarWithIndex (2), "C");
//			App.Screenshot ("Entered three characters in activation search bar");
//			labelText = App.GetTextForQuery (PlatformQueries.LabelWithText ("3"));
//			Assert.AreEqual ("3", labelText);

//		}

///*******************************************************/
///**************** Landscape tests **********************/
///*******************************************************/
//		[Test]
//		[Category ("ManualReview")]
//		[Description ("Enable disable keyboard, Issues #1182, #1237 - landscape")]
//		public void SearchBarGalleryEnableDisableSearchBarLandscape () 
//		{
//			App.SetOrientationLandscape ();
//			App.Screenshot ("Rotated to Landscape");
//			SearchBarGalleryEnableDisableSearchBar ();
//			App.SetOrientationPortrait ();
//			App.Screenshot ("Rotated to Portrait");
//		}

//		[Test]
//		[Category ("ManualReview")]
//		[Description ("Enter query into each SearchBar - Landscape")]
//		public void SearchBarGalleryEnterSearchTextLandscape ()
//		{
//			App.SetOrientationLandscape ();
//			App.Screenshot ("Rotated to Landscape");
//			SearchBarGalleryEnterSearchText ();
//			App.SetOrientationPortrait ();
//			App.Screenshot ("Rotated to Portrait");
//		}

//		void SearchBarGalleryAllElementsPresent ()
//		{
//			var searchBars = App.Query (PlatformQueries.SearchBars);
//			Assert.AreEqual (3, searchBars.Length);

//			App.ScrollDownForElement (q => q.Marked ("Search Query"), 5);

//			App.ScrollUp ();
//			App.Screenshot ("All SearchBars present");
//		}



//		void SearchBarGalleryAllElementsPresentPageTwo ()
//		{
//			App.ScrollDownForElement (q => q.Marked ("Search Query 2"), 5);
//			App.ScrollDownForElement (q => q.Button ("Toggle enabled"), 5);

//			App.ScrollUp ();
//			App.Screenshot ("All SearchBars present - Page 2");
//		}

	}
}