From b15ee30765184944d2adf0917de1e6d4b5454853 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Fri, 24 Jun 2016 17:05:42 +0100 Subject: =?UTF-8?q?[UITest]=C2=A0Update=20to=201.3.8,=20remove=20old=20pro?= =?UTF-8?q?jects=20=20(#240)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [UITests] Update to Xamarin UItest 1.3.8 * Remove legacy UITest projects * Remove issue that uses reference to controls * Update Xamarin.Forms.Core.iOS.UITests.csproj * Update Xamarin.Forms.Core.Android.UITests.csproj --- Xamarin.Forms.Android.UITests/BaseTestFixture.cs | 108 ----------------- Xamarin.Forms.Android.UITests/Makefile | 15 --- Xamarin.Forms.Android.UITests/PlatformHelpers.cs | 132 --------------------- Xamarin.Forms.Android.UITests/PlatformQueries.cs | 111 ----------------- .../Properties/AssemblyInfo.cs | 36 ------ .../Xamarin.Forms.Android.UITests.csproj | 80 ------------- Xamarin.Forms.Android.UITests/packages.config | 5 - Xamarin.Forms.Android.UITests/testcloudupload.bat | 1 - 8 files changed, 488 deletions(-) delete mode 100644 Xamarin.Forms.Android.UITests/BaseTestFixture.cs delete mode 100644 Xamarin.Forms.Android.UITests/Makefile delete mode 100644 Xamarin.Forms.Android.UITests/PlatformHelpers.cs delete mode 100644 Xamarin.Forms.Android.UITests/PlatformQueries.cs delete mode 100644 Xamarin.Forms.Android.UITests/Properties/AssemblyInfo.cs delete mode 100644 Xamarin.Forms.Android.UITests/Xamarin.Forms.Android.UITests.csproj delete mode 100644 Xamarin.Forms.Android.UITests/packages.config delete mode 100644 Xamarin.Forms.Android.UITests/testcloudupload.bat (limited to 'Xamarin.Forms.Android.UITests') diff --git a/Xamarin.Forms.Android.UITests/BaseTestFixture.cs b/Xamarin.Forms.Android.UITests/BaseTestFixture.cs deleted file mode 100644 index 6e38f356..00000000 --- a/Xamarin.Forms.Android.UITests/BaseTestFixture.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using Xamarin.UITest; -using Xamarin.UITest.Android; -using Xamarin.UITest.Queries; -using NUnit.Framework; -using System.Threading; - -namespace Xamarin.Forms.UITests -{ - public class BaseTestFixture - { - string idiomEnvVar; - string IPEnvVar; - - public AndroidApp App { get; private set; } - public Device Device { get; set; } - - public BaseTestFixture () - { - idiomEnvVar = Environment.GetEnvironmentVariable ("DEVICE_IDIOM"); - IPEnvVar = Environment.GetEnvironmentVariable ("DEVICE_IP"); - - Console.WriteLine (string.Format ("****** Connecting to {0} with IP: {1} ********", idiomEnvVar, IPEnvVar)); - - Device = SetupDevice (idiomEnvVar, IPEnvVar); - } - - [SetUp] - public void Setup () - { - - if (string.IsNullOrEmpty (idiomEnvVar) && - string.IsNullOrEmpty (IPEnvVar)) { - // Use IDE Configuration - App = ConfigureApp - .Android - .Debug () - .ApkFile ("../../../Xamarin.Forms.ControlGallery.Android/bin/Debug/AndroidControlGallery.AndroidControlGallery-Signed.apk") - .StartApp (); - } else { - // Use CI Configuration - App = ConfigureApp - .Android - .DeviceIp (Device.IP) - .ApkFile ("../../../Xamarin.Forms.ControlGallery.Android/bin/Debug/AndroidControlGallery.AndroidControlGallery-Signed.apk") - .StartApp (); - } - - FixtureSetup (); - } - - protected virtual void FixtureSetup () - { - App.SetOrientationPortrait (); - App.Screenshot ("Begin test"); - } - - Device SetupDevice (string idiomEnvVar, string IPEnvVar) - { - Device device; - - if (idiomEnvVar == "PHONE") { - - // default phone - device = new Device (DeviceType.Phone, "10.0.1.161"); - - if (!string.IsNullOrEmpty (IPEnvVar)) - device.IP = IPEnvVar; - - } else if (idiomEnvVar == "TABLET") { - - // default tablet - device = new Device (DeviceType.Tablet, "10.0.1.42"); - - if (!string.IsNullOrEmpty (IPEnvVar)) - device.IP = IPEnvVar; - - } else { - - // default phone - device = new Device (DeviceType.Phone, "10.0.1.161"); - - } - - return device; - } - - } - - public static class PlatformStrings - { - public static string Button = "Button"; - public static string Cell = "xamarin.forms.platform.android.ViewCellRenderer_ViewCellContainer"; - public static string HomePageTitle = "Android Controls"; - public static string Label = "TextView"; - public static string Entry = "EditText"; - public static string Placeholder = "hint"; - public static string Text = "text"; - } - - public static class PlatformValues - { - public static int BoxViewScreenNumber = 4; - public static int KeyboardDismissY = 500; - public static int OffsetForScrollView = -5; - } -} - diff --git a/Xamarin.Forms.Android.UITests/Makefile b/Xamarin.Forms.Android.UITests/Makefile deleted file mode 100644 index 87c3be60..00000000 --- a/Xamarin.Forms.Android.UITests/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -console: - calabash-android console ../Xamarin.Forms.ControlGallery.Android/bin/Debug/AndroidControlGallery.AndroidControlGallery-Signed.apk - -testcloud: - mono xut-console.exe submit --assembly-dir ../Xamarin.Forms.Android.UITests/bin/debug ../Xamarin.Forms.ControlGallery.Android/bin/Release/AndroidControlGallery.AndroidControlGallery-Signed.apk 1a02b2e1ee5a2895e47da095cc895a49 7a47b813 - -run-phone-android: - DEVICE_IDIOM=PHONE DEVICE_ID=9adaaf78 DEVICE_IP=192.168.1.144 mono ../packages/NUnit.Runners.2.6.3/tools/nunit-console-x86.exe -result=galaxy-results.xml bin/Debug/Xamarin.Forms.Android.UITests.dll - -run-parallel-android: - DEVICE_IDIOM=TABLET mono ../packages/NUnit.Runners.2.6.3/tools/nunit-console-x86.exe -result=nexus-results.xml bin/Debug/Xamarin.Forms.Android.UITests.dll --include "CITest" & - DEVICE_IDIOM=PHONE mono ../packages/NUnit.Runners.2.6.3/tools/nunit-console-x86.exe -result=galaxy-results.xml bin/Debug/Xamarin.Forms.Android.UITests.dll --include "CITest" - -clean: - rm -rf screenshot_* test_servers/ .irb-history nexus-results.xml galaxy-results.xml diff --git a/Xamarin.Forms.Android.UITests/PlatformHelpers.cs b/Xamarin.Forms.Android.UITests/PlatformHelpers.cs deleted file mode 100644 index 6021f2a2..00000000 --- a/Xamarin.Forms.Android.UITests/PlatformHelpers.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using Xamarin.UITest; -using Xamarin.UITest.Android; -using Xamarin.UITest.Queries; -using NUnit.Framework; -using System.Threading; - -namespace Xamarin.Forms.UITests -{ - - public static class PlatformHelpers - { - - public static string GetTextForQuery (this IApp app, Func query) - { - AppResult[] elements = app.Query (query); - if (elements.Length > 1) { - // Test cloud doesn't support Assert.Fail - Assert.False (true, "Query returned more than one result"); - } - return elements [0].Text; - } - - public static bool ScrollDownForElement (this IApp app, Func query, int scrollNumberLimit) - { - // Check if element exists before scrolling - if (app.Query (query).Length > 0) - return true; - - int scrollNumber = 0; - while (app.Query (query).Length == 0) { - app.ScrollDown (); - scrollNumber++; - if (scrollNumber > scrollNumberLimit) - return false; - } - - return true; - } - - public static bool ScrollUpForElement (this IApp app, Func query, int scrollNumberLimit) - { - int scrollNumber = 0; - while (app.Query (query).Length == 0) { - app.ScrollUp (); - scrollNumber++; - if (scrollNumber > scrollNumberLimit) - return false; - } - - return true; - } - - public static bool DragFromToForElement (this AndroidApp app, int scrollNumberLimit, Func query, float xStart, float yStart, float xEnd, float yEnd) - { - int numberOfScrolls = 0; - // Element exists - if (app.Query (query).Length > 0) - return true; - - while (app.Query (query).Length == 0) { - DragFromTo (app, xStart, yStart, xEnd, yEnd); - if (numberOfScrolls > scrollNumberLimit) { - return false; - } - numberOfScrolls++; - } - // Element found - return true; - } - - public static void SwipeBackNavigation (this AndroidApp app) - { - // Do nothing on Android - } - - public static void DragFromTo (this AndroidApp app, float xStart, float yStart, float xEnd, float yEnd, Speed speed = Speed.Fast) - { - // No effect on Android - app.DragCoordinates (xStart, yStart, xEnd, yEnd); - } - - public static void KeyboardIsPresent (this AndroidApp app) - { - // TODO : Add keyboard detection -// Thread.Sleep (1000); -// -// AppRect screenSize = app.MainScreenBounds (); -// AppRect contentBounds = app.Query (q => q.Raw ("*").Id ("content"))[0].Rect; -// -// bool keyboardIsShown = false; -// if ((screenSize.Height - contentBounds.Height) > (screenSize.Height / 4)) { -// // Determine if keyboard is showing by seeing if content size is shrunk by over 1/4 of screens size -// keyboardIsShown = true; -// } -// -// Assert.IsTrue (keyboardIsShown, "Keyboard should be shown"); - Assert.Inconclusive ("Keyboard should be shown"); - } - - public static void KeyboardIsDismissed (this AndroidApp app) - { - // TODO : Add keyboard detection -// AppRect screenSize = app.MainScreenBounds (); -// AppRect contentBounds = app.Query (q => q.Raw ("*").Id ("content"))[0].Rect; -// -// bool keyboardIsShown = false; -// if ((screenSize.Height - contentBounds.Height) > (screenSize.Height / 4)) { -// // Determine if keyboard is showing by seeing if content size is shrunk by over 1/4 of screens size -// keyboardIsShown = true; -// } -// -// Assert.IsFalse (keyboardIsShown, "Keyboard should be dismissed"); - Assert.Inconclusive ("Keyboard should be dismissed"); - } - - public static int IndexForElementWithText (this AndroidApp app, Func query, string text) - { - var elements = app.Query (query); - int index = 0; - for (int i = 0; i < elements.Length; i++) { - string labelText = elements[i].Text; - if (labelText == (text)) { - index = i; - break; - } - index++; - } - return index == elements.Length ? -1 : index; - } - } -} diff --git a/Xamarin.Forms.Android.UITests/PlatformQueries.cs b/Xamarin.Forms.Android.UITests/PlatformQueries.cs deleted file mode 100644 index 0b826949..00000000 --- a/Xamarin.Forms.Android.UITests/PlatformQueries.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using Xamarin.UITest; -using Xamarin.UITest.Android; -using Xamarin.UITest.Queries; -using NUnit.Framework; -using System.Threading; - -namespace Xamarin.Forms.UITests -{ - public class iOSUiTestType - { - public iOSUiTestType () - { - - } - } - - public static class PlatformQueries - { - public static Func AbsoluteGalleryBackground = q => q.Raw ("xamarin.forms.platform.android.BoxRenderer parent xamarin.forms.platform.android.RendererFactory_DefaultRenderer index:0"); - public static Func ActivityIndicators = q => q.Raw ("ProgressBar"); - public static Func Back = q => q.Id ("up"); - public static Func BoxRendererQuery = q => q.Raw ("xamarin.forms.platform.android.BoxRenderer"); - public static Func Cells = q => q.Raw ("xamarin.forms.platform.android.ViewCellRenderer_ViewCellContainer"); - public static Func DismissPickerCustom = q => q.Marked ("OK"); - public static Func DismissPickerNormal = q => q.Marked ("Done"); - public static Func Entrys = q => q.Raw ("EntryEditText"); - public static Func EntryCells = q => q.Raw ("EntryCellEditText"); - public static Func Editors = q => q.Raw ("EditorEditText"); - public static Func Frames = q => q.Raw ("FrameRenderer"); - public static Func Images = q => q.Raw ("xamarin.forms.platform.android.ImageRenderer"); - public static Func ImageView = q => q.Raw("ImageView"); - public static Func LabelRenderers = q => q.Raw ("LabelRenderer"); - public static Func List = q => q.Raw ("ListView"); - public static Func Labels = q => q.Raw ("TextView"); - public static Func Map = q => q.Raw ("MapView"); - public static Func NumberPicker = q => q.Raw ("NumberPicker"); - public static Func ProgressBar = q => q.Raw ("ProgressBar"); - public static Func Tables = q => q.Raw ("ListView"); - public static Func SearchBars = q => q.Raw ("SearchView"); - public static Func Sliders = q => q.Raw ("SeekBar"); - public static Func SpanningThreeRows = q => q.Marked ("Spanning 3 rows"); - public static Func Steppers = q => q.Raw ("button marked:'+'"); - public static Func Switch = q => q.Raw("Switch"); - public static Func ThreeXThreeGridCell = q => q.Marked ("a block 3x3"); - - public static Func EntryWithPlaceholder (string text) { - return q => q.Raw (string.Format ("EntryEditText hint:'{0}'", text)); - } - public static Func EntryCellWithPlaceholder (string text) { - return q => q.Raw (string.Format ("EntryCellEditText hint:'{0}'", text)); - } - - public static Func EntryWithText (string text) { - return q => q.Raw (string.Format ("EntryEditText text:'{0}'", text)); - } - - public static Func EntryCellWithText (string text) { - return q => q.Raw (string.Format ("EntryCellEditText text:'{0}'", text)); - } - - public static Func EditorsWithText (string text) { - return q => q.Raw (string.Format ("EditorEditText text:'{0}'", text)); - } - - public static Func EntryWithIndex (int index) { - return q => q.Raw (string.Format ("EntryEditText index:{0}", index)); - } - - public static Func SearchBarWithIndex (int index) { - return q => q.Raw (string.Format ("SearchView index:{0}", index)); - } - - public static Func LabelWithIndex (int index) { - return q => q.Raw (string.Format ("TextView index:{0}", index)); - } - - public static Func LabelWithText (string text) { - return q => q.Raw (string.Format ("TextView text:'{0}'", text)); - } - - public static Func LabelWithId (string id) { - return q => q.Raw (string.Format ("TextView id:'{0}'", id)); - } - - public static Func PickerEntryWithIndex (int index) { - return q => q.Raw (string.Format ("EditText index:{0}", index)); - } - - public static Func PickerEntryWithPlaceholder (string placeholder) { - return q => q.Raw (string.Format ("EditText hint:'{0}'", placeholder)); - } - - public static Func PickerEntryWithText (string text) { - return q => q.Raw (string.Format ("EditText 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 ("button marked:'+' index:{0}", index)); - } - - public static AppResult DetailPage (this AndroidApp app) - { - return app.Query (q => q.Raw ("*"))[0]; - } - } -} diff --git a/Xamarin.Forms.Android.UITests/Properties/AssemblyInfo.cs b/Xamarin.Forms.Android.UITests/Properties/AssemblyInfo.cs deleted file mode 100644 index 99b6aa63..00000000 --- a/Xamarin.Forms.Android.UITests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Xamarin.Forms.Android.UITest")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Xamarin.Forms.Android.UITest")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("fd80e73b-7225-40ce-b38d-350c5487a0df")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Xamarin.Forms.Android.UITests/Xamarin.Forms.Android.UITests.csproj b/Xamarin.Forms.Android.UITests/Xamarin.Forms.Android.UITests.csproj deleted file mode 100644 index a549f353..00000000 --- a/Xamarin.Forms.Android.UITests/Xamarin.Forms.Android.UITests.csproj +++ /dev/null @@ -1,80 +0,0 @@ - - - - - Debug - AnyCPU - {D290FCBE-3196-452B-B84C-B62BF9B54F2A} - Library - Properties - Xamarin.Forms.Android.UITest - Xamarin.Forms.Android.UITests - v4.5 - 512 - ..\ - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - - - - - - - - ..\packages\Xamarin.UITest.1.3.8\lib\Xamarin.UITest.dll - True - - - - - - - TestHelpers.cs - - - - - - - - Device.cs - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file diff --git a/Xamarin.Forms.Android.UITests/packages.config b/Xamarin.Forms.Android.UITests/packages.config deleted file mode 100644 index 6a27733a..00000000 --- a/Xamarin.Forms.Android.UITests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Xamarin.Forms.Android.UITests/testcloudupload.bat b/Xamarin.Forms.Android.UITests/testcloudupload.bat deleted file mode 100644 index 1afa4cff..00000000 --- a/Xamarin.Forms.Android.UITests/testcloudupload.bat +++ /dev/null @@ -1 +0,0 @@ -xut-console.exe submit --assembly-dir ..\Xamarin.Forms.Android.UITests\bin\debug ..\Xamarin.Forms.ControlGallery.Android\bin\Release\AndroidControlGallery.AndroidControlGallery-Signed.apk 1a02b2e1ee5a2895e47da095cc895a49 6bbba6ec -- cgit v1.2.3