diff options
Diffstat (limited to 'Xamarin.Forms.Core.iOS.UITests/Tests/ActionSheetUITests.cs')
-rw-r--r-- | Xamarin.Forms.Core.iOS.UITests/Tests/ActionSheetUITests.cs | 164 |
1 files changed, 80 insertions, 84 deletions
diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/ActionSheetUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/ActionSheetUITests.cs index 0f74d6de..88d280e5 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/ActionSheetUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/ActionSheetUITests.cs @@ -1,7 +1,4 @@ using NUnit.Framework; -using Xamarin.UITest; -using System; -using System.Threading; using Xamarin.UITest.Queries; namespace Xamarin.Forms.Core.UITests @@ -12,158 +9,157 @@ namespace Xamarin.Forms.Core.UITests { AppRect screenSize; - public ActionSheetUITests () + protected override void NavigateToGallery() { - + App.NavigateToGallery(GalleryQueries.ActionSheetGallery); } - protected override void NavigateToGallery () - { - App.NavigateToGallery (GalleryQueries.ActionSheetGallery); - } - - static void CheckExtras () + static void CheckExtras() { App.WaitForElement(c => c.Marked("Extra One")); App.WaitForElement(c => c.Marked("Extra Six")); } - protected override void TestSetup () + protected override void TestSetup() { - base.TestSetup (); - screenSize = App.Query (q => q.Marked ("ActionSheetPage"))[0].Rect; + base.TestSetup(); +#if !__MACOS__ + screenSize = App.Query(q => q.Marked("ActionSheetPage"))[0].Rect; +#endif } [Test] - public void TestDisplayActionSheet () + public void TestDisplayActionSheet() { - ScrollAndTap ("ActionSheet Extras"); - CheckExtras (); - App.Tap (c => c.Marked ("Extra One")); + ScrollAndTap("ActionSheet Extras"); + CheckExtras(); + App.Tap(c => c.Marked("Extra One")); } - + [Test] - public void TestDisplayActionSheetCancel () + public void TestDisplayActionSheetCancel() { - ScrollAndTap ("ActionSheet Cancel"); + ScrollAndTap("ActionSheet Cancel"); // iPad does not have a Cancel button for action sheet - if (App.Query (q => q.Marked ("Cancel")).Length > 0) - App.Tap (c => c.Marked ("Cancel")); + if (App.Query(q => q.Marked("Cancel")).Length > 0) + App.Tap(c => c.Marked("Cancel")); else - App.TapCoordinates (20, screenSize.Height / 2); + App.TapCoordinates(20, screenSize.Height / 2); } [Test] - public void TestDisplayActionSheetCancelDestruction () + public void TestDisplayActionSheetCancelDestruction() { - ScrollAndTap ("ActionSheet Cancel Destruction"); - App.WaitForNoElement (c => c.Marked ("Extra One")); - App.WaitForElement (c => c.Marked ("Destruction")); - if (App.Query (q => q.Marked ("Cancel")).Length > 0) - App.Tap (c => c.Marked ("Cancel")); + ScrollAndTap("ActionSheet Cancel Destruction"); + App.WaitForNoElement(c => c.Marked("Extra One")); + App.WaitForElement(c => c.Marked("Destruction")); + if (App.Query(q => q.Marked("Cancel")).Length > 0) + App.Tap(c => c.Marked("Cancel")); else - App.TapCoordinates (20, screenSize.Height / 2); + App.TapCoordinates(20, screenSize.Height / 2); } [Test] - public void TestDisplayActionSheetCancelExtras () + public void TestDisplayActionSheetCancelExtras() { - ScrollAndTap ("ActionSheet Cancel Extras"); - CheckExtras (); - if (App.Query (q => q.Marked ("Cancel")).Length > 0) - App.Tap (c => c.Marked ("Cancel")); + ScrollAndTap("ActionSheet Cancel Extras"); + CheckExtras(); + if (App.Query(q => q.Marked("Cancel")).Length > 0) + App.Tap(c => c.Marked("Cancel")); else - App.TapCoordinates (20, screenSize.Height / 2); + App.TapCoordinates(20, screenSize.Height / 2); } [Test] - public void TestDisplayActionSheetCancelExtrasDestruction () + public void TestDisplayActionSheetCancelExtrasDestruction() { - ScrollAndTap ("ActionSheet Cancel Destruction Extras"); - CheckExtras (); - App.WaitForElement (c => c.Marked ("Destruction")); - if (App.Query (q => q.Marked ("Cancel")).Length > 0) - App.Tap (c => c.Marked ("Cancel")); + ScrollAndTap("ActionSheet Cancel Destruction Extras"); + CheckExtras(); + App.WaitForElement(c => c.Marked("Destruction")); + if (App.Query(q => q.Marked("Cancel")).Length > 0) + App.Tap(c => c.Marked("Cancel")); else - App.TapCoordinates (20, screenSize.Height / 2); + App.TapCoordinates(20, screenSize.Height / 2); } [Test] - public void TestDisplayActionSheetDestruction () + public void TestDisplayActionSheetDestruction() { - ScrollAndTap ("ActionSheet Destruction"); - App.WaitForNoElement (c => c.Marked ("Extra One")); - App.Tap (c => c.Marked ("Destruction")); + ScrollAndTap("ActionSheet Destruction"); + App.WaitForNoElement(c => c.Marked("Extra One")); + App.Tap(c => c.Marked("Destruction")); } [Test] - public void TestDisplayActionSheetDestructionExtras () + public void TestDisplayActionSheetDestructionExtras() { - ScrollAndTap ("ActionSheet Destruction Extras"); - CheckExtras (); - App.Tap (c => c.Marked ("Extra One")); + ScrollAndTap("ActionSheet Destruction Extras"); + CheckExtras(); + App.Tap(c => c.Marked("Extra One")); } [Test] - public void TestDisplayActionSheetTitleCancel () + public void TestDisplayActionSheetTitleCancel() { - ScrollAndTap ("ActionSheet Title Cancel"); - App.WaitForElement (c => c.Marked ("Title")); - if (App.Query (q => q.Marked ("Cancel")).Length > 0) - App.Tap (c => c.Marked ("Cancel")); + ScrollAndTap("ActionSheet Title Cancel"); + App.WaitForElement(c => c.Marked("Title")); + if (App.Query(q => q.Marked("Cancel")).Length > 0) + App.Tap(c => c.Marked("Cancel")); else - App.TapCoordinates (20, screenSize.Height / 2); + App.TapCoordinates(20, screenSize.Height / 2); } [Test] - public void TestDisplayActionSheetTitleCancelDestruction () + public void TestDisplayActionSheetTitleCancelDestruction() { - ScrollAndTap ("ActionSheet Title Cancel Destruction"); - App.WaitForElement (c => c.Marked ("Title")); - App.WaitForNoElement (c => c.Marked ("Extra One")); - App.Tap (c => c.Marked ("Destruction")); + ScrollAndTap("ActionSheet Title Cancel Destruction"); + App.WaitForElement(c => c.Marked("Title")); + App.WaitForNoElement(c => c.Marked("Extra One")); + App.Tap(c => c.Marked("Destruction")); } [Test] - public void TestDisplayActionSheetTitleCancelDestructionExtras () + public void TestDisplayActionSheetTitleCancelDestructionExtras() { - ScrollAndTap ("ActionSheet Title Cancel Destruction Extras"); - App.WaitForElement (c => c.Marked ("Title")); - CheckExtras (); - App.Tap (c => c.Marked ("Destruction")); + ScrollAndTap("ActionSheet Title Cancel Destruction Extras"); + App.WaitForElement(c => c.Marked("Title")); + CheckExtras(); + App.Tap(c => c.Marked("Destruction")); } [Test] - public void TestDisplayActionSheetTitleDestruction () + public void TestDisplayActionSheetTitleDestruction() { - ScrollAndTap ("ActionSheet Title Destruction"); - App.WaitForElement (c => c.Marked ("Title")); - App.WaitForNoElement (c => c.Marked ("Extra One")); - App.Tap (c => c.Marked ("Destruction")); + ScrollAndTap("ActionSheet Title Destruction"); + App.WaitForElement(c => c.Marked("Title")); + App.WaitForNoElement(c => c.Marked("Extra One")); + App.Tap(c => c.Marked("Destruction")); } [Test] - public void TestDisplayActionSheetTitleDestructionExtras () + public void TestDisplayActionSheetTitleDestructionExtras() { - ScrollAndTap ("ActionSheet Title Destruction Extras"); - App.WaitForElement (c => c.Marked ("Title")); - CheckExtras (); - App.Tap (c => c.Marked ("Destruction")); + ScrollAndTap("ActionSheet Title Destruction Extras"); + App.WaitForElement(c => c.Marked("Title")); + CheckExtras(); + App.Tap(c => c.Marked("Destruction")); } [Test] - public void TestDisplayActionSheetTitleExtras () + public void TestDisplayActionSheetTitleExtras() { - ScrollAndTap ("ActionSheet Title Extras"); - CheckExtras (); - App.Tap (c => c.Marked ("Extra One")); + ScrollAndTap("ActionSheet Title Extras"); + CheckExtras(); + App.Tap(c => c.Marked("Extra One")); } - void ScrollAndTap(string actionSheet) + void ScrollAndTap(string actionSheet) { +#if !__MACOS__ App.ScrollForElement(string.Format("* text:'{0}'", actionSheet), new Drag(App.Query(q => q.Marked("ActionSheetPage"))[0].Rect, Drag.Direction.BottomToTop, Drag.DragLength.Long)); - App.Tap(q=>q.Raw(string.Format("* text:'{0}'", actionSheet))); +#endif + App.Tap(q => q.Raw(string.Format("* text:'{0}'", actionSheet))); } } |