diff options
Diffstat (limited to 'Xamarin.Forms.Core.iOS.UITests/Tests')
11 files changed, 128 insertions, 100 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))); } } diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/ActivityIndicatorUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/ActivityIndicatorUITests.cs index 36dd3a14..86d0d750 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/ActivityIndicatorUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/ActivityIndicatorUITests.cs @@ -47,11 +47,14 @@ namespace Xamarin.Forms.Core.UITests [UiTest (typeof(ActivityIndicator), "IsRunning")] public void IsRunning () { - var remote = new ViewContainerRemote (App, Test.ActivityIndicator.IsRunning, PlatformViewType); - remote.GoTo (); - + var remote = new ViewContainerRemote(App, Test.ActivityIndicator.IsRunning, PlatformViewType); + remote.GoTo(); +#if __MACOS__ + Assert.Inconclusive("Not tested yet"); +#else var isRunning = remote.GetProperty<bool> (ActivityIndicator.IsRunningProperty); Assert.IsTrue (isRunning); +#endif } protected override void FixtureTeardown () diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/AppearingUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/AppearingUITests.cs index 1e624611..568663ab 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/AppearingUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/AppearingUITests.cs @@ -3,6 +3,9 @@ using NUnit.Framework; namespace Xamarin.Forms.Core.UITests { +#if __MACOS__ + [Ignore("Not tested on the MAC")] +#endif [Category(UITestCategories.LifeCycle)] internal class AppearingUITests : BaseTestFixture { diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/AutomationIDUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/AutomationIDUITests.cs index 4aeb5cc7..9b814a92 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/AutomationIDUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/AutomationIDUITests.cs @@ -3,6 +3,7 @@ using Xamarin.UITest; using System; using System.Threading; using Xamarin.UITest.Queries; +using System.Threading.Tasks; namespace Xamarin.Forms.Core.UITests { @@ -41,8 +42,9 @@ namespace Xamarin.Forms.Core.UITests [Test] - public void Test2 () + public async void Test2() { + await Task.Delay(1000); App.WaitForElement(c => c.Marked("btnTest2")); App.Tap (c => c.Marked ("btnTest2")); App.WaitForElement (c => c.Marked ("imgHello")); diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/BoxViewUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/BoxViewUITests.cs index fa9cdc29..6def5ed0 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/BoxViewUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/BoxViewUITests.cs @@ -17,6 +17,9 @@ using Xamarin.UITest.iOS; namespace Xamarin.Forms.Core.UITests { [TestFixture] +#if __MACOS__ + [Ignore("Not tested on the MAC")] +#endif [Category(UITestCategories.BoxView)] internal class BoxViewUITests : _ViewUITests { diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/ButtonUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/ButtonUITests.cs index 83c9cccd..89994a98 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/ButtonUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/ButtonUITests.cs @@ -127,6 +127,8 @@ namespace Xamarin.Forms.Core.UITests #if __ANDROID__ var isBold = remote.GetProperty<bool> (Button.FontProperty); Assert.True (isBold); +#elif __MACOS__ + Assert.Inconclusive("needs testing"); #else var font = remote.GetProperty<Font> (Button.FontProperty); Assert.True (font.FontAttributes.HasFlag (FontAttributes.Bold)); diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs index d681d476..cd0b3643 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs @@ -31,7 +31,7 @@ namespace Xamarin.Forms.Core.UITests const string mark = "Mark"; -#if __ANDROID__ +#if __ANDROID__ || __MACOS__ [Test] public void ContextActionsShow () { @@ -81,7 +81,6 @@ namespace Xamarin.Forms.Core.UITests } #endif } - [TestFixture] [Category(UITestCategories.Cells)] internal class ContextActionsTableUITests : BaseTestFixture @@ -103,7 +102,7 @@ namespace Xamarin.Forms.Core.UITests const string mark = "Mark"; const string cellWithNoContextActions = "I have no ContextActions"; -#if __ANDROID__ +#if __ANDROID__ || __MACOS__ [Test] public void ContextActionsShowAndReset () { diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/FrameUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/FrameUITests.cs index 035e3f70..338d6fed 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/FrameUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/FrameUITests.cs @@ -16,6 +16,9 @@ using Xamarin.UITest.iOS; namespace Xamarin.Forms.Core.UITests { +#if __MACOS__ + [Ignore("Not tested on the MAC")] +#endif [TestFixture] [Category(UITestCategories.Frame)] internal class FrameUITests : _ViewUITests diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-CellsUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-CellsUITests.cs index f89f5714..24732519 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-CellsUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-CellsUITests.cs @@ -12,6 +12,9 @@ using Xamarin.UITest.Queries; namespace Xamarin.Forms.Core.UITests { +#if __MACOS__ + [Ignore("Not tested on the MAC")] +#endif [TestFixture] [Category(UITestCategories.Cells)] internal class CellsGalleryTests : BaseTestFixture diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/ToolbarItemTests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/ToolbarItemTests.cs index 30cabffd..1c8a1565 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/ToolbarItemTests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/ToolbarItemTests.cs @@ -6,6 +6,9 @@ using Xamarin.UITest.iOS; namespace Xamarin.Forms.Core.UITests { +#if __MACOS__ + [Ignore("Not tested in MacOS yet")] +#endif [TestFixture] [Category(UITestCategories.ToolbarItem)] internal class ToolbarItemTests : BaseTestFixture diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/ViewUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/ViewUITests.cs index a7a13017..9029f2aa 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/ViewUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/ViewUITests.cs @@ -11,6 +11,7 @@ using Xamarin.UITest.iOS; namespace Xamarin.Forms.Core.UITests { + [Category("ViewBaseTests")] internal abstract class _ViewUITests : BaseTestFixture { /* Under score prefixes ensure inherited properties run first in test suite */ @@ -117,7 +118,11 @@ namespace Xamarin.Forms.Core.UITests var viewPre = remote.GetViews (); +#if __MACOS__ + Assert.GreaterOrEqual(viewPre.Length, 1); +#else Assert.AreEqual (1, viewPre.Length); +#endif remote.TapStateButton (); @@ -136,12 +141,15 @@ namespace Xamarin.Forms.Core.UITests [UiTest (typeof (VisualElement), "Opacity")] public virtual void _Opacity () { - var remote = new ViewContainerRemote (App, Test.VisualElement.Opacity, PlatformViewType); - remote.GoTo (); - + var remote = new ViewContainerRemote(App, Test.VisualElement.Opacity, PlatformViewType); + remote.GoTo(); +#if __MACOS__ + Assert.Inconclusive("needs testing"); +#else float opacity = -1f; opacity = remote.GetProperty<float> (View.OpacityProperty); Assert.AreEqual (0.5f, opacity); +#endif } [Test] @@ -203,12 +211,15 @@ namespace Xamarin.Forms.Core.UITests [UiTest (typeof (VisualElement), "Scale")] public virtual void _Scale () { - var remote = new ViewContainerRemote (App, Test.VisualElement.Scale, PlatformViewType); - remote.GoTo (); - - var scaleMatrix = remote.GetProperty<Matrix> (View.ScaleProperty); - Matrix generatedMatrix = NumericExtensions.BuildScaleMatrix (0.5f); - Assert.AreEqual (generatedMatrix, scaleMatrix); + var remote = new ViewContainerRemote(App, Test.VisualElement.Scale, PlatformViewType); + remote.GoTo(); +#if __MACOS__ + Assert.Inconclusive("needs testing"); +#else + var scaleMatrix = remote.GetProperty<Matrix>(View.ScaleProperty); + Matrix generatedMatrix = NumericExtensions.BuildScaleMatrix(0.5f); + Assert.AreEqual(generatedMatrix, scaleMatrix); +#endif } [Test] |