diff options
author | Rui Marinho <me@ruimarinho.net> | 2016-10-04 00:45:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-04 00:45:57 +0100 |
commit | b645064d939201a7df7cc67917b4c31c450a7a89 (patch) | |
tree | 6699bcfe7c88a35a094b06d65bd584a8f7b79723 /Xamarin.Forms.Core.iOS.UITests | |
parent | 5372d216df44bf09a160cfd9649ce97776ed343d (diff) | |
download | xamarin-forms-b645064d939201a7df7cc67917b4c31c450a7a89.tar.gz xamarin-forms-b645064d939201a7df7cc67917b4c31c450a7a89.tar.bz2 xamarin-forms-b645064d939201a7df7cc67917b4c31c450a7a89.zip |
Fix tests on IOS10 [Do not merge] (#373)
* [UITests] Update packages
* [UITests] Fix formatting
* [UITests] Fix tests
* Add badges
* Update Android csproj
* fix
Diffstat (limited to 'Xamarin.Forms.Core.iOS.UITests')
3 files changed, 143 insertions, 138 deletions
diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-CellsUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-CellsUITests.cs index d143b414..4710c336 100644 --- a/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-CellsUITests.cs +++ b/Xamarin.Forms.Core.iOS.UITests/Tests/Legacy-CellsUITests.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; - +using System.Threading.Tasks; using NUnit.Framework; using Xamarin.Forms.CustomAttributes; @@ -13,250 +13,254 @@ using Xamarin.UITest.Queries; namespace Xamarin.Forms.Core.UITests { [TestFixture] - [Category ("Cells")] + [Category("Cells")] internal class CellsGalleryTests : BaseTestFixture { // TODO find a way to test individula elements of cells // TODO port to new framework - protected override void NavigateToGallery () + protected override void NavigateToGallery() { - App.NavigateToGallery (GalleryQueries.CellsGalleryLegacy); + App.NavigateToGallery(GalleryQueries.CellsGalleryLegacy); } [Test] - [Description ("ListView with TextCells, all are present")] - [UiTest (typeof(ListView))] - [UiTest (typeof(TextCell))] - public void CellsGalleryTextCellList () + [Description("ListView with TextCells, all are present")] + [UiTest(typeof(ListView))] + [UiTest(typeof(TextCell))] + public void CellsGalleryTextCellList() { - App.ScrollForElement ("* marked:'TextCell List'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Tap (q => q.Marked ("TextCell List")); - App.WaitForElement (q => q.Marked ("Text 0"), "Timeout : Text 0"); + App.ScrollForElement("* marked:'TextCell List'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.Tap(q => q.Marked("TextCell List")); + App.WaitForElement(q => q.Marked("Text 0"), "Timeout : Text 0"); - App.Screenshot ("At TextCell List Gallery"); + App.Screenshot("At TextCell List Gallery"); - App.ScrollForElement ("* marked:'Detail 99'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'Detail 99'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.WaitForElement (q => q.Marked ("Detail 99"), "Timeout : Detail 99"); + App.WaitForElement(q => q.Marked("Detail 99"), "Timeout : Detail 99"); - App.Screenshot ("All TextCells are present"); + App.Screenshot("All TextCells are present"); } [Test] - [Description ("TableView with TextCells, all are present")] - [UiTest (typeof(TableView))] - [UiTest (typeof(TextCell))] - public void CellsGalleryTextCellTable () + [Description("TableView with TextCells, all are present")] + [UiTest(typeof(TableView))] + [UiTest(typeof(TextCell))] + public void CellsGalleryTextCellTable() { - App.ScrollForElement ("* marked:'TextCell Table'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'TextCell Table'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Tap (q => q.Marked ("TextCell Table")); - App.WaitForElement (q => q.Marked ("Text 1"), "Timeout : Text 1"); + App.Tap(q => q.Marked("TextCell Table")); + App.WaitForElement(q => q.Marked("Text 1"), "Timeout : Text 1"); - App.Screenshot ("At TextCell Table Gallery"); + App.Screenshot("At TextCell Table Gallery"); - App.ScrollForElement ("* marked:'Detail 12'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'Detail 12'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.WaitForElement (q => q.Marked ("Detail 12"), "Timeout : Detail 12"); + App.WaitForElement(q => q.Marked("Detail 12"), "Timeout : Detail 12"); - App.Screenshot ("All TextCells are present"); + App.Screenshot("All TextCells are present"); } [Test] - [Description ("ListView with ImageCells, all are present")] - [UiTest (typeof(ListView))] - [UiTest (typeof(ImageCell))] - public void CellsGalleryImageCellList () + [Description("ListView with ImageCells, all are present")] + [UiTest(typeof(ListView))] + [UiTest(typeof(ImageCell))] + public void CellsGalleryImageCellList() { - Thread.Sleep (2000); + Thread.Sleep(2000); - App.ScrollForElement ("* marked:'ImageCell List'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'ImageCell List'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - Thread.Sleep (2000); + Thread.Sleep(2000); - App.Tap (q => q.Marked ("ImageCell List")); - App.WaitForElement (q => q.Marked ("Text 0"), "Timeout : Text 0"); + App.Tap(q => q.Marked("ImageCell List")); + App.WaitForElement(q => q.Marked("Text 0"), "Timeout : Text 0"); - App.Screenshot ("At ImageCell List Gallery"); + App.Screenshot("At ImageCell List Gallery"); - var scollBounds = App.Query (q => q.Marked ("ImageCellListView")).First ().Rect; - App.ScrollForElement ("* marked:'Detail 99'", new Drag (scollBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + var scollBounds = App.Query(q => q.Marked("ImageCellListView")).First().Rect; + App.ScrollForElement("* marked:'Detail 99'", new Drag(scollBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.WaitForElement (q => q.Marked ("Detail 99"), "Timeout : Detail 99"); + App.WaitForElement(q => q.Marked("Detail 99"), "Timeout : Detail 99"); - App.Screenshot ("All ImageCells are present"); + App.Screenshot("All ImageCells are present"); - var numberOfImages = App.Query (q => q.Raw (PlatformViews.Image)).Length; + var numberOfImages = App.Query(q => q.Raw(PlatformViews.Image)).Length; // Check that there are images present. In Android, // have to make sure that there are more than 2 for navigation. - Assert.IsTrue (numberOfImages > 2); + Assert.IsTrue(numberOfImages > 2); - App.Screenshot ("Images are present"); + App.Screenshot("Images are present"); } [Test] - [Description ("ListView with ImageCells, file access problems")] - [UiTest (typeof(ListView))] - [UiTest (typeof(ImageCell))] - public void CellsGalleryImageUrlCellList () + [Description("ListView with ImageCells, file access problems")] + [UiTest(typeof(ListView))] + [UiTest(typeof(ImageCell))] + public async Task CellsGalleryImageUrlCellList() { - - App.ScrollForElement ("* marked:'ImageCell Url List'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Tap (q => q.Marked ("ImageCell Url List")); - - var scollBounds = App.Query (q => q.Marked ("ImageUrlCellListView")).First ().Rect; - App.ScrollForElement ("* marked:'Detail 200'", new Drag (scollBounds, Drag.Direction.BottomToTop, Drag.DragLength.Long), 40); + App.ScrollForElement("* marked:'ImageCell Url List'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + + App.Tap(q => q.Marked("ImageCell Url List")); - App.WaitForElement (q => q.Marked ("Detail 200"), "Timeout : Detail 200"); + //var scollBounds = App.Query(q => q.Marked("ImageUrlCellListView")).First().Rect; + //App.ScrollForElement("* marked:'Detail 200'", new Drag(scollBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + //App.ScrollUp(); + //App.WaitForElement(q => q.Marked("Detail 200"), "Timeout : Detail 200"); - App.Screenshot ("All ImageCells are present"); + App.Screenshot("All ImageCells are present"); - var numberOfImages = App.Query (q => q.Raw (PlatformViews.Image)).Length; + await Task.Delay(1000); + var numberOfImages = App.Query(q => q.Raw(PlatformViews.Image)).Length; // Check that there are images present. In Android, // have to make sure that there are more than 2 for navigation. - Assert.IsTrue (numberOfImages > 2); + Assert.IsTrue(numberOfImages > 2); - App.Screenshot ("Images are present"); + App.Screenshot("Images are present"); } - + [Test] - [Description ("TableView with ImageCells, all are present")] - [UiTest (typeof(TableView))] - [UiTest (typeof(ImageCell))] - public void CellsGalleryImageCellTable () + [Description("TableView with ImageCells, all are present")] + [UiTest(typeof(TableView))] + [UiTest(typeof(ImageCell))] + public void CellsGalleryImageCellTable() { - App.ScrollForElement ("* marked:'ImageCell Table'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'ImageCell Table'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Tap (q => q.Marked ("ImageCell Table")); - App.WaitForElement (q => q.Marked ("Text 1"), "Timeout : Text 1"); + App.Tap(q => q.Marked("ImageCell Table")); + App.WaitForElement(q => q.Marked("Text 1"), "Timeout : Text 1"); - App.Screenshot ("At ImageCell Table Gallery"); + App.Screenshot("At ImageCell Table Gallery"); - App.ScrollForElement ("* marked:'Detail 12'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'Detail 12'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.WaitForElement (q => q.Marked ("Detail 12"), "Timeout : Detail 12"); + App.WaitForElement(q => q.Marked("Detail 12"), "Timeout : Detail 12"); - App.Screenshot ("All ImageCells are present"); + App.Screenshot("All ImageCells are present"); - var numberOfImages = App.Query (q => q.Raw (PlatformViews.Image)).Length; + var numberOfImages = App.Query(q => q.Raw(PlatformViews.Image)).Length; // Check that there are images present. In Android, // have to make sure that there are more than 2 for navigation. - Assert.IsTrue (numberOfImages > 2); + Assert.IsTrue(numberOfImages > 2); - App.Screenshot ("Images are present"); + App.Screenshot("Images are present"); } [Test] - [Description ("ListView with SwitchCells, all are present")] - [UiTest (typeof(ListView))] - [UiTest (typeof(SwitchCell))] - public void CellsGallerySwitchCellList () + [Description("ListView with SwitchCells, all are present")] + [UiTest(typeof(ListView))] + [UiTest(typeof(SwitchCell))] + public void CellsGallerySwitchCellList() { - App.ScrollForElement ("* marked:'SwitchCell List'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'SwitchCell List'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Tap (q => q.Marked ("SwitchCell List")); - App.WaitForElement (q => q.Marked ("Label 0"), "Timeout : Label 0"); + App.Tap(q => q.Marked("SwitchCell List")); + App.WaitForElement(q => q.Marked("Label 0"), "Timeout : Label 0"); - App.Screenshot ("At SwitchCell List Gallery"); + App.Screenshot("At SwitchCell List Gallery"); - App.ScrollForElement ("* marked:'Label 99'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'Label 99'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - var numberOfSwitches = App.Query (q => q.Raw (PlatformViews.Switch)).Length; - Assert.IsTrue (numberOfSwitches > 2); + var numberOfSwitches = App.Query(q => q.Raw(PlatformViews.Switch)).Length; + Assert.IsTrue(numberOfSwitches > 2); - App.Screenshot ("Switches are present"); + App.Screenshot("Switches are present"); } [Test] - [Description ("TableView with SwitchCells, all are present")] - [UiTest (typeof(TableView))] - [UiTest (typeof(SwitchCell))] - public void CellsGallerySwitchCellTable () + [Description("TableView with SwitchCells, all are present")] + [UiTest(typeof(TableView))] + [UiTest(typeof(SwitchCell))] + public void CellsGallerySwitchCellTable() { - App.ScrollForElement ("* marked:'SwitchCell Table'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'SwitchCell Table'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Tap (q => q.Marked ("SwitchCell Table")); - App.WaitForElement (q => q.Marked ("text 1"), "Timeout : text 1"); + App.Tap(q => q.Marked("SwitchCell Table")); + App.WaitForElement(q => q.Marked("text 1"), "Timeout : text 1"); - App.Screenshot ("At SwitchCell Table Gallery"); + App.Screenshot("At SwitchCell Table Gallery"); - App.ScrollForElement ("* marked:'text 32'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'text 32'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - var numberOfSwitches = App.Query (q => q.Raw (PlatformViews.Switch)).Length; - Assert.IsTrue (numberOfSwitches > 2); + var numberOfSwitches = App.Query(q => q.Raw(PlatformViews.Switch)).Length; + Assert.IsTrue(numberOfSwitches > 2); - App.Screenshot ("Switches are present"); + App.Screenshot("Switches are present"); } [Test] - [Description ("ListView with EntryCells, all are present")] - [UiTest (typeof(ListView))] - [UiTest (typeof(EntryCell))] - public void CellsGalleryEntryCellList () + [Description("ListView with EntryCells, all are present")] + [UiTest(typeof(ListView))] + [UiTest(typeof(EntryCell))] + public void CellsGalleryEntryCellList() { - App.ScrollForElement ("* marked:'EntryCell List'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'EntryCell List'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Tap (q => q.Marked ("EntryCell List")); - App.WaitForElement (q => q.Marked ("Label 0"), "Timeout : Label 0"); + App.Tap(q => q.Marked("EntryCell List")); + App.WaitForElement(q => q.Marked("Label 0"), "Timeout : Label 0"); - App.Screenshot ("At EntryCell List Gallery"); + App.Screenshot("At EntryCell List Gallery"); - App.ScrollForElement ("* marked:'Label 99'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'Label 99'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Screenshot ("All EntryCells are present"); + App.Screenshot("All EntryCells are present"); } - + [Test] - [Description ("TableView with EntryCells, all are present")] - [UiTest (typeof(TableView))] - [UiTest (typeof(EntryCell))] - public void CellsGalleryEntryCellTable () + [Description("TableView with EntryCells, all are present")] + [UiTest(typeof(TableView))] + [UiTest(typeof(EntryCell))] + public void CellsGalleryEntryCellTable() { - App.ScrollForElement ("* marked:'EntryCell Table'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'EntryCell Table'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Tap (q => q.Marked ("EntryCell Table")); - App.WaitForElement (q => q.Marked ("Text 2"), "Timeout : Text 2"); + App.Tap(q => q.Marked("EntryCell Table")); + App.WaitForElement(q => q.Marked("Text 2"), "Timeout : Text 2"); - App.Screenshot ("At EntryCell Table Gallery"); + App.Screenshot("At EntryCell Table Gallery"); - App.ScrollForElement ("* marked:'Text 32'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'Text 32'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Screenshot ("All EntryCells are present"); + App.Screenshot("All EntryCells are present"); } [Test] - [Category ("EntryCell")] - [Description ("EntryCell fires .Completed event")] - [UiTest (typeof(EntryCell), "Completed")] - public void CellsGalleryEntryCellCompleted () + [Category("EntryCell")] + [Description("EntryCell fires .Completed event")] + [UiTest(typeof(EntryCell), "Completed")] + public void CellsGalleryEntryCellCompleted() { - App.ScrollForElement ("* marked:'EntryCell Table'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.ScrollForElement("* marked:'EntryCell Table'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + + App.Tap(q => q.Marked("EntryCell Table")); + App.WaitForElement(q => q.Marked("Text 2"), "Timeout : Text 2"); - App.Tap (q => q.Marked ("EntryCell Table")); - App.WaitForElement (q => q.Marked ("Text 2"), "Timeout : Text 2"); + App.Screenshot("At EntryCell Table Gallery"); + App.ScrollForElement("* marked:'Enter text'", new Drag(ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); - App.Screenshot ("At EntryCell Table Gallery"); - App.ScrollForElement ("* marked:'Enter text'", new Drag (ScreenBounds, Drag.Direction.BottomToTop, Drag.DragLength.Medium)); + App.Screenshot("Before clicking Entry"); - App.Screenshot ("Before clicking Entry"); +#if !__IOS__ + App.Tap(PlatformQueries.EntryCellWithPlaceholder("I am a placeholder")); + App.EnterText(PlatformQueries.EntryCellWithPlaceholder("I am a placeholder"), "Hi"); + App.Screenshot("Entered Text"); + App.PressEnter(); - App.Tap (PlatformQueries.EntryCellWithPlaceholder ("I am a placeholder")); - App.EnterText (PlatformQueries.EntryCellWithPlaceholder ("I am a placeholder"), "Hi"); - App.Screenshot ("Entered Text"); - App.PressEnter (); + App.WaitForElement(q => q.Marked("Entered: 1")); + App.Screenshot("Completed should have changed label's text"); - App.WaitForElement (q => q.Marked ("Entered: 1")); - App.Screenshot ("Completed should have changed label's text"); +#endif } protected override void TestTearDown() { - App.NavigateBack (); + App.NavigateBack(); base.TestTearDown(); } } 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 79368025..a67db71d 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 @@ -58,8 +58,9 @@ <Reference Include="nunit.framework"> <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath> </Reference> - <Reference Include="Xamarin.UITest"> - <HintPath>..\packages\Xamarin.UITest.2.0.0-beta02\lib\Xamarin.UITest.dll</HintPath> + <Reference Include="Xamarin.UITest, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.UITest.2.0.0-beta04\lib\Xamarin.UITest.dll</HintPath> + <Private>True</Private> </Reference> </ItemGroup> <ItemGroup> diff --git a/Xamarin.Forms.Core.iOS.UITests/packages.config b/Xamarin.Forms.Core.iOS.UITests/packages.config index bae38c6e..64dd65ab 100644 --- a/Xamarin.Forms.Core.iOS.UITests/packages.config +++ b/Xamarin.Forms.Core.iOS.UITests/packages.config @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="NUnit" version="2.6.4" targetFramework="net45" /> - <package id="Xamarin.UITest" version="2.0.0-beta02" targetFramework="net45" /> + <package id="Xamarin.UITest" version="2.0.0-beta04" targetFramework="net45" /> </packages>
\ No newline at end of file |