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 RootPageListView = PlatformQueries.RootPageListView; public static Func GalleryListView = PlatformQueries.GalleryListView; public static Func ButtonWithText (string text) { return q => q.Button (text); } public static Func ElementWithText (string text) { return q => q.Marked (text); } public static Func All () { return q => q.All (); } #endregion #region Platform queries public static Func NavigationBarBackButton () { return PlatformQueries.NavigationBarBackButton; } public static Func PageWithoutNavigationBar () { return PlatformQueries.PageWithoutNavigationBar; } public static Func Root () { return PlatformQueries.Root; } public static Func EntryCellWithPlaceholder (string placeholder) { return PlatformQueries.EntryCellWithPlaceholder (placeholder); } public static Func 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; } } }