using System; using Xamarin.UITest; using Xamarin.UITest.iOS; using Xamarin.UITest.Queries; using NUnit.Framework; using System.Threading; namespace Xamarin.Forms.UITests { public class AndroidUiTestType { public AndroidUiTestType () { } } public static class PlatformQueries { public static Func AbsoluteGalleryBackground = q => q.Raw ("view:'Xamarin_Forms_Platform_iOS_BoxRenderer' parent view index:0"); public static Func ActivityIndicators = q => q.Raw ("ActivityIndicatorView"); public static Func Back = q => q.Raw ("view:'UINavigationItemButtonView'"); public static Func BoxRendererQuery = q => q.Raw ("view:'Xamarin_Forms_Platform_iOS_BoxRenderer'"); public static Func Cells = q => q.Raw ("TableViewCell"); public static Func DismissPickerCustom = q => q.Marked ("Done"); public static Func DismissPickerNormal = q => q.Marked ("Done"); public static Func Entrys = q => q.Raw ("TextField"); public static Func Editors = q => q.Raw ("TextView"); public static Func Frames = q => q.Raw ("view:'Xamarin_Forms_Platform_iOS_FrameRenderer'"); public static Func Images = q => q.Raw ("view:'Xamarin_Forms_Platform_iOS_ImageRenderer'"); public static Func ImageView = q => q.Raw ("ImageView"); public static Func Labels = q => q.Raw ("Label"); public static Func LabelRenderers = q => q.Raw ("view:'Xamarin_Forms_Platform_iOS_LabelRenderer'"); public static Func List = q => q.Raw ("TableView"); public static Func Map = q => q.Raw ("view:'MKMapView'"); public static Func MapPins = q => q.Raw ("all view:'MKPinAnnotationView'"); public static Func NavigationBar = q => q.Raw ("NavigationBar"); public static Func NumberPicker = q => q.Raw ("PickerTableView"); public static Func ProgressBar = q => q.Raw ("ProgressView"); public static Func SearchBars = q => q.Raw ("SearchBar"); public static Func Sliders = q => q.Raw ("Slider"); public static Func Steppers = q => q.Raw ("Stepper"); public static Func Switch = q => q.Raw ("Switch"); public static Func Tables = q => q.Raw ("TableView"); public static Func ThreeXThreeGridCell = q => q.Raw ("view marked:'a block 3x3' parent view:'Xamarin_Forms_Platform_iOS_LabelRenderer'"); public static Func SpanningThreeRows = q => q.Raw ("view marked:'Spanning 3 rows' parent view:'Xamarin_Forms_Platform_iOS_LabelRenderer'"); public static Func EntryWithPlaceholder (string text) { return q => q.Raw (string.Format ("TextField placeholder:'{0}'", text)); } public static Func EntryWithText (string text) { return q => q.Raw (string.Format ("TextField text:'{0}'", text)); } public static Func EntryCellWithPlaceholder (string text) { return q => q.Raw (string.Format ("TextField placeholder:'{0}'", text)); } public static Func EntryCellWithText (string text) { return q => q.Raw (string.Format ("TextField text:'{0}'", text)); } public static Func EditorsWithText (string text) { return q => q.Raw (string.Format ("TextView text:'{0}'", text)); } public static Func EntryWithIndex (int index) { return q => q.Raw (string.Format ("TextField index:{0}", index)); } public static Func SearchBarWithIndex (int index) { return q => q.Raw (string.Format ("SearchBar index:{0}", index)); } public static Func LabelWithIndex (int index) { return q => q.Raw (string.Format ("Label index:{0}", index)); } public static Func LabelWithText (string text) { return q => q.Raw (string.Format ("Label text:'{0}'", text)); } public static Func LabelWithId (string id) { return q => q.Raw (string.Format ("Label id:'{0}'", id)); } public static Func PickerEntryWithIndex (int index) { return q => q.Raw (string.Format ("TextField index:{0}", index)); } public static Func PickerEntryWithPlaceholder (string placeholder) { return q => q.Raw (string.Format ("TextField placeholder:'{0}'", placeholder)); } public static Func PickerEntryWithText (string text) { return q => q.Raw (string.Format ("TextField text:'{0}'", text)); } public static Func SwitchWithIndex (int index) { return q => q.Raw (string.Format ("Switch index:{0}", index)); } public static Func StepperWithIndex (int index) { return q => q.Raw (string.Format ("Stepper index:{0}", index)); } public static AppResult DetailPage (this iOSApp app) { if (app.Query (q => q.Raw ("view:'UILayoutContainerView'")).Length == 3) { // iPad SplitView Landscape return app.Query (q => q.Raw ("view:'UILayoutContainerView'"))[2]; } return app.Query (q => q.Raw ("*"))[0]; } } }