summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.iOS.UITests/Queries.cs
blob: e1c00ee92cac08e45e139a45ae6c6641a07f4581 (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
´╗┐using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

using Xamarin.UITest;
using Xamarin.UITest.Queries;

namespace Xamarin.Forms.Core.UITests
{	
	internal static class GalleryQueries
	{
		public const string AutomationIDGallery = "* marked:'AutomationID Gallery'";
		public const string ActivityIndicatorGallery = "* marked:'ActivityIndicator Gallery'";
		public const string BoxViewGallery = "* marked:'BoxView Gallery'";
		public const string ButtonGallery = "* marked:'Button Gallery'";
		public const string ContextActionsListGallery = "* marked:'ContextActions List Gallery'";
		public const string ContextActionsTableGallery = "* marked:'ContextActions Table Gallery'";
		public const string DatePickerGallery = "* marked:'DatePicker Gallery'";
		public const string EditorGallery = "* marked:'Editor Gallery'";
		public const string EntryGallery = "* marked:'Entry Gallery'";
		public const string FrameGallery = "* marked:'Frame Gallery'";
		public const string ImageGallery = "* marked:'Image Gallery'";
		public const string LabelGallery = "* marked:'Label Gallery'";
		public const string ListViewGallery = "* marked:'ListView Gallery'";
		public const string OpenGLViewGallery = "* marked:'OpenGLView Gallery'";
		public const string PickerGallery = "* marked:'Picker Gallery'";
		public const string ProgressBarGallery = "* marked:'ProgressBar Gallery'";
		public const string ScrollViewGallery = "* marked:'ScrollView Gallery'";
		public const string ScrollViewGalleryHorizontal = "* marked:'ScrollView Gallery Horizontal'";
		public const string SearchBarGallery = "* marked:'SearchBar Gallery'";
		public const string SliderGallery = "* marked:'Slider Gallery'";
		public const string StepperGallery = "* marked:'Stepper Gallery'";
		public const string SwitchGallery = "* marked:'Switch Gallery'";
		public const string TableViewGallery = "* marked:'TableView Gallery'";
		public const string TimePickerGallery = "* marked:'TimePicker Gallery'";
		public const string WebViewGallery = "* marked:'WebView Gallery'";
		public const string ToolbarItemGallery = "* marked:'ToolbarItems Gallery'";
		public const string DisplayAlertGallery = "* marked:'DisplayAlert Gallery'";
		public const string ActionSheetGallery = "* marked:'ActionSheet Gallery'";
		public const string RootPagesGallery = "* marked:'RootPages Gallery'";

		public const string AppearingGallery = "* marked:'Appearing Gallery'";

		// Legacy galleries
		public const string CellsGalleryLegacy = "* marked:'Cells Gallery - Legacy'";
		public const string UnevenListGalleryLegacy = "* marked:'UnevenList Gallery - Legacy'";
	}

	internal static class Queries
	{
		#region Shared queries 
		public static Func<AppQuery, AppQuery> RootPageListView = PlatformQueries.RootPageListView; 
		public static Func<AppQuery, AppQuery> GalleryListView = PlatformQueries.GalleryListView; 

		public static Func<AppQuery, AppQuery> ButtonWithText (string text)
		{
			return q => q.Button (text);
		}

		public static Func<AppQuery, AppQuery> ElementWithText (string text)
		{
			return q => q.Marked (text);
		}

		public static Func<AppQuery, AppQuery> All ()
		{
			return q => q.All ();
		}

		#endregion

		#region Platform queries

		public static Func<AppQuery, AppQuery> NavigationBarBackButton ()
		{
			return PlatformQueries.NavigationBarBackButton;
		}

		public static Func<AppQuery, AppQuery> PageWithoutNavigationBar ()
		{
			return PlatformQueries.PageWithoutNavigationBar;
		}

		public static Func<AppQuery, AppQuery> Root ()
		{
			return PlatformQueries.Root;
		}

		public static Func<AppQuery, AppQuery> EntryCellWithPlaceholder (string placeholder)
		{
			return PlatformQueries.EntryCellWithPlaceholder (placeholder);
		} 

		public static Func<AppQuery, AppQuery> EntryCellWithText (string placeholder)
		{
			return PlatformQueries.EntryCellWithText (placeholder);
		} 

		#endregion

	}

	internal static class Views
	{
		public static readonly string ActivityIndicator = PlatformViews.ActivityIndicator;
		public static readonly string BoxView = PlatformViews.BoxView;
		public static readonly string Button = PlatformViews.Button;
		public static readonly string DatePicker = PlatformViews.DatePicker;
		public static readonly string Editor = PlatformViews.Editor;
		public static readonly string Entry = PlatformViews.Entry;
		public static readonly string Frame = PlatformViews.Frame;
		public static readonly string Image = PlatformViews.Image;
		public static readonly string Label = PlatformViews.Label;
		public static readonly string ListView = PlatformViews.ListView;
		public static readonly string OpenGLView = PlatformViews.OpenGLView;
		public static readonly string Picker = PlatformViews.Picker;
		public static readonly string ProgressBar = PlatformViews.ProgressBar;
		public static readonly string SearchBar = PlatformViews.SearchBar;
		public static readonly string Slider = PlatformViews.Slider;
		public static readonly string Stepper = PlatformViews.Stepper;
		public static readonly string Switch = PlatformViews.Switch;
		public static readonly string TableView = PlatformViews.TableView;
		public static readonly string TimePicker = PlatformViews.TimePicker;
		public static readonly string WebView = PlatformViews.WebView;
	}

	internal static class Rects
	{
		public static AppRect RootViewRect (this IApp app)
		{
			return app.Query (q => q.Raw ("* index:0"))[0].Rect;
		}
	}
}