From 52dc625bce269e5de4913cc1da444d890bc93d10 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Tue, 16 Aug 2016 19:31:53 +0100 Subject: [iOS] Change when we updated the XF INavigationPageController after popping a page natively, Cleanup UITest references (#291) --- Xamarin.Forms.Core.iOS.UITests/App.cs | 29 -------------- Xamarin.Forms.Core.iOS.UITests/BaseTestFixture.cs | 46 +++++++++------------- .../Tests/Legacy-UnevenListTests.cs | 9 +++-- .../Xamarin.Forms.Core.iOS.UITests.csproj | 8 ++-- 4 files changed, 26 insertions(+), 66 deletions(-) delete mode 100644 Xamarin.Forms.Core.iOS.UITests/App.cs (limited to 'Xamarin.Forms.Core.iOS.UITests') diff --git a/Xamarin.Forms.Core.iOS.UITests/App.cs b/Xamarin.Forms.Core.iOS.UITests/App.cs deleted file mode 100644 index dee82d8c..00000000 --- a/Xamarin.Forms.Core.iOS.UITests/App.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using NUnit.Framework; - -using Xamarin.UITest; -using Xamarin.UITest.iOS; - -namespace Xamarin.Forms.Core.UITests -{ - internal static class RunningApp - { - public static iOSApp App; - - public static void Restart () - { - App = ConfigureApp - .iOS - .Debug () - // Keeping the old BundleId for now, Test Cloud doesn't - // like it when we update the BundleId for an existing app - .InstalledApp ("com.xamarin.quickui.controlgallery") - .StartApp (Xamarin.UITest.Configuration.AppDataMode.Clear); - } - } -} \ No newline at end of file diff --git a/Xamarin.Forms.Core.iOS.UITests/BaseTestFixture.cs b/Xamarin.Forms.Core.iOS.UITests/BaseTestFixture.cs index c60ef35c..b2f98e24 100644 --- a/Xamarin.Forms.Core.iOS.UITests/BaseTestFixture.cs +++ b/Xamarin.Forms.Core.iOS.UITests/BaseTestFixture.cs @@ -16,22 +16,22 @@ namespace Xamarin.Forms.Core.UITests { // TODO: Landscape tests - public static IApp App { get; private set; } + public static IApp App { get; private set; } public string PlatformViewType { get; protected set; } public bool ShouldResetPerFixture { get; protected set; } public AppRect ScreenBounds { get; private set; } - protected BaseTestFixture () + protected BaseTestFixture() { ShouldResetPerFixture = true; } - protected abstract void NavigateToGallery (); + protected abstract void NavigateToGallery(); #pragma warning disable 618 [TestFixtureSetUp] #pragma warning restore 618 - protected virtual void FixtureSetup () + protected virtual void FixtureSetup() { try { @@ -50,43 +50,33 @@ namespace Xamarin.Forms.Core.UITests #pragma warning disable 618 [TestFixtureTearDown] #pragma warning restore 618 - protected virtual void FixtureTeardown () - { + protected virtual void FixtureTeardown() + { } [SetUp] - protected virtual void TestSetup () + protected virtual void TestSetup() { - if (!ShouldResetPerFixture) { - RelaunchApp (); + if (!ShouldResetPerFixture) + { + + RelaunchApp(); } - App.Screenshot ("Begin Test"); } [TearDown] - protected virtual void TestTearDown () + protected virtual void TestTearDown() { - App.Screenshot ("Test complete"); + } - void RelaunchApp () + void RelaunchApp() { App = null; - RunningApp.App = null; - - try { - RunningApp.Restart (); - } catch (Exception ex) { - // if at first you dont succeed - RunningApp.Restart (); - } - - // Wrap the app in ScreenshotConditional so it only takes screenshots if the SCREENSHOTS symbol is specified - App = new ScreenshotConditionalApp(RunningApp.App); - - App.SetOrientationPortrait (); - ScreenBounds = App.RootViewRect (); - NavigateToGallery (); + App = AppSetup.Setup(); + App.SetOrientationPortrait(); + ScreenBounds = App.RootViewRect(); + NavigateToGallery(); } } } diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-UnevenListTests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-UnevenListTests.cs index b425545f..86a39ad3 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-UnevenListTests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-UnevenListTests.cs @@ -21,10 +21,11 @@ namespace Xamarin.Forms.Core.UITests [Test] public void UnevenListCellTest () { - if (UnevenListTests.ShouldRunTest(RunningApp.App)) { - var element = App.Query (q => q.Marked ("unevenCellListGalleryDynamic").Descendant (("UITableViewCellContentView"))) [0]; - - Assert.GreaterOrEqual (element.Rect.Height, 100); + if (UnevenListTests.ShouldRunTest(App)) + { + var element = App.Query(q => q.Marked("unevenCellListGalleryDynamic").Descendant(("UITableViewCellContentView")))[0]; + + Assert.GreaterOrEqual(element.Rect.Height, 100); } } diff --git a/Xamarin.Forms.Core.iOS.UITests/Xamarin.Forms.Core.iOS.UITests.csproj b/Xamarin.Forms.Core.iOS.UITests/Xamarin.Forms.Core.iOS.UITests.csproj index 3454e072..9c5ad1bd 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Xamarin.Forms.Core.iOS.UITests.csproj +++ b/Xamarin.Forms.Core.iOS.UITests/Xamarin.Forms.Core.iOS.UITests.csproj @@ -22,7 +22,7 @@ TRACE;DEBUG;__IOS__;UITEST prompt 4 - false + true 0114;0108;4014;0649;0169;0168;0219 @@ -58,14 +58,12 @@ ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - + ..\packages\Xamarin.UITest.1.3.8\lib\Xamarin.UITest.dll - True - @@ -153,4 +151,4 @@ --> - + \ No newline at end of file -- cgit v1.2.3