Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Tests]Update to Xamarin.UITest 3.0 and NUnit 3.0 (#6332) #7031

Merged
merged 5 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Tests]Update to Xamarin.UITest 3.0 and NUnit 3.0 (#6332)
  • Loading branch information
PureWeen committed Sep 9, 2019
commit 253ef25beaad3591d67b762a4ccd40c5077b6865
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected override void Init()
#if UITEST && __IOS__
[Test]
[Category(UITestCategories.ManualReview)]
[Ignore]
[Ignore("Fails sometimes")]
public void Bugzilla35736Test()
{
RunningApp.WaitForElement(q => q.Marked("Bugzilla35736Editor"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ public FileInfo Screenshot(string title)

public void SwipeRight()
{
#pragma warning disable 618
_app.SwipeRight();
#pragma warning restore 618
SwipeLeftToRight();
}

public void SwipeLeftToRight(double swipePercentage = 0.67, int swipeSpeed = 500, bool withInertia = true)
Expand All @@ -257,9 +255,7 @@ public void SwipeLeftToRight(string marked, double swipePercentage = 0.67, int s

public void SwipeLeft()
{
#pragma warning disable 618
_app.SwipeLeft();
#pragma warning restore 618
SwipeRightToLeft();
}

public void SwipeRightToLeft(double swipePercentage = 0.67, int swipeSpeed = 500, bool withInertia = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ namespace Xamarin.Forms.Controls.Issues
[SetUpFixture]
public class IssuesSetup
{
[SetUp]
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
AppSetup.RunningApp = AppSetup.Setup(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="NUnitTestAdapter">
<Version>2.2.0</Version>
</PackageReference>
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="2.2.7" />
<PackageReference Include="Xamarin.UITest" Version="3.0.0" />
<PackageReference Include="NUnit3TestAdapter">
<Version>3.13.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="BaseViewContainerRemoteAndroid.cs" />
Expand Down Expand Up @@ -87,7 +87,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="_CopyXamarinUITestFiles" AfterTargets="Build">
<ItemGroup>
<_XamarinUITestFiles Include="$(NuGetPackageRoot)Xamarin.UITest\%(Version)\**" Condition="@(PackageReference -> '%(Identity)') == 'Xamarin.UITest'" InProject="False" />
<_XamarinUITestFiles Include="$(NuGetPackageRoot)Xamarin.UITest\%(Version)\**" Condition="@(PackageReference -&gt; '%(Identity)') == 'Xamarin.UITest'" InProject="False" />
</ItemGroup>
<Copy SourceFiles="@(_XamarinUITestFiles)" DestinationFolder="$(SolutionDir)packages\Xamarin.UITest.AnyVersion\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
</Target>
Expand Down
13 changes: 5 additions & 8 deletions Xamarin.Forms.Core.UITests.Shared/BaseTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal abstract class BaseTestFixture

public static AppRect ScreenBounds { get; set; }

[TestFixtureTearDown]
[OneTimeTearDown]
protected virtual void FixtureTeardown()
{
}
Expand Down Expand Up @@ -45,7 +45,7 @@ public void EnsureMemory()
[SetUp]
protected virtual void TestSetup()
{
EnsureMemory();
//EnsureMemory();
}

[TearDown]
Expand All @@ -55,9 +55,7 @@ protected virtual void TestTearDown()

protected abstract void NavigateToGallery();

#pragma warning disable 618
[TestFixtureSetUp]
#pragma warning restore 618
[OneTimeSetUp]
protected virtual void FixtureSetup()
{
ResetApp();
Expand Down Expand Up @@ -111,7 +109,6 @@ protected void ResetApp()
}
}
}

#if UITEST

namespace Xamarin.Forms.Core.UITests
Expand All @@ -121,7 +118,7 @@ namespace Xamarin.Forms.Core.UITests
[SetUpFixture]
public class CoreUITestsSetup
{
[SetUp]
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
LaunchApp();
Expand All @@ -138,4 +135,4 @@ public static void LaunchApp()
}
}

#endif
#endif
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core.UnitTests/AnimationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class AnimationTests : BaseTestFixture
{
[Test]
//https://bugzilla.xamarin.com/show_bug.cgi?id=51424
public async void AnimationRepeats()
public async Task AnimationRepeats()
{
var box = new BoxView();
Assume.That(box.Rotation, Is.EqualTo(0d));
Expand Down
14 changes: 7 additions & 7 deletions Xamarin.Forms.Core.UnitTests/BindingUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ public void GetterMissingTwoWay()
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("Text2")), Throws.Nothing);
Assert.That (bindable.Text, Is.EqualTo (MockBindable.TextProperty.DefaultValue));
Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"Text2",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+DifferentViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
Expand All @@ -1607,7 +1607,7 @@ public void BindingAppliesAfterGetterPreviouslyMissing()
Assert.That (bindable.Text, Is.EqualTo ("Foo"));

Assert.That (log.Messages.Count, Is.Not.GreaterThan (1), "Too many errors were logged");
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"Text",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+EmptyViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
Expand All @@ -1621,7 +1621,7 @@ public void SetterMissingTwoWay()
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("Text")), Throws.Nothing);

Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"Text",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+DifferentViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
Expand All @@ -1637,7 +1637,7 @@ public void PrivateSetterTwoWay()
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("PrivateSetter")), Throws.Nothing);

Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"PrivateSetter",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+DifferentViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
Expand All @@ -1646,7 +1646,7 @@ public void PrivateSetterTwoWay()
Assert.That (() => bindable.SetValueCore (MockBindable.TextProperty, "foo"), Throws.Nothing);

Assert.That (log.Messages.Count, Is.EqualTo (2), "An error was not logged");
Assert.That (log.Messages[1], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[1], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"PrivateSetter",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+DifferentViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
Expand All @@ -1660,7 +1660,7 @@ public void PropertyNotFound()
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("MissingProperty")), Throws.Nothing);

Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"MissingProperty",
"Xamarin.Forms.Core.UnitTests.MockViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
Expand Down Expand Up @@ -1688,7 +1688,7 @@ public void PropertyNotFoundChained()
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("Model.MissingProperty")), Throws.Nothing);

Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"MissingProperty",
"Xamarin.Forms.Core.UnitTests.BindingBaseUnitTests+ComplexMockViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
Expand Down
5 changes: 3 additions & 2 deletions Xamarin.Forms.Core.UnitTests/CellTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using NUnit.Framework;
using System;
using System.Threading.Tasks;

namespace Xamarin.Forms.Core.UnitTests
{
Expand Down Expand Up @@ -153,7 +154,7 @@ public void RenderHeightINPCFromParent()
}

[Test]
public async void ForceUpdateSizeCallsAreRateLimited()
public async Task ForceUpdateSizeCallsAreRateLimited()
{
var lv = new ListView { HasUnevenRows = true };
var cell = new ViewCell { Parent = lv };
Expand All @@ -172,7 +173,7 @@ public async void ForceUpdateSizeCallsAreRateLimited()
}

[Test]
public async void ForceUpdateSizeWillNotBeCalledIfParentIsNotAListViewWithUnevenRows ()
public async Task ForceUpdateSizeWillNotBeCalledIfParentIsNotAListViewWithUnevenRows ()
{
var lv = new ListView { HasUnevenRows = false };
var cell = new ViewCell { Parent = lv };
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core.UnitTests/GeocoderUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Xamarin.Forms.Core.UnitTests
public class GeocoderUnitTests : BaseTestFixture
{
[Test]
public async void AddressesForPosition ()
public async Task AddressesForPosition ()
{
Geocoder.GetAddressesForPositionFuncAsync = GetAddressesForPositionFuncAsync;
var geocoder = new Geocoder ();
Expand All @@ -26,7 +26,7 @@ async Task<IEnumerable<string>> GetAddressesForPositionFuncAsync (Position posit
}

[Test]
public async void PositionsForAddress () {
public async Task PositionsForAddress () {
Geocoder.GetPositionsForAddressAsyncFunc = GetPositionsForAddressAsyncFunc ;
var geocoder = new Geocoder ();
var result = await geocoder.GetPositionsForAddressAsync ("quux");
Expand Down
8 changes: 4 additions & 4 deletions Xamarin.Forms.Core.UnitTests/MotionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ protected override void DisableTimer ()
[TestFixture]
public class MotionTests : BaseTestFixture
{
[TestFixtureSetUp]
[OneTimeSetUp]
public void Init ()
{
Device.PlatformServices = new MockPlatformServices ();
Ticker.Default = new BlockingTicker ();
}

[TestFixtureTearDown]
[OneTimeTearDown]
public void End ()
{
Device.PlatformServices = null;
Expand Down Expand Up @@ -154,14 +154,14 @@ public void KineticFinished ()
[TestFixture]
public class TickerSystemEnabledTests
{
[TestFixtureSetUp]
[OneTimeSetUp]
public void Init ()
{
Device.PlatformServices = new MockPlatformServices ();
Ticker.Default = new AsyncTicker();
}

[TestFixtureTearDown]
[OneTimeTearDown]
public void End ()
{
Device.PlatformServices = null;
Expand Down
8 changes: 4 additions & 4 deletions Xamarin.Forms.Core.UnitTests/NavigationUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public async Task CurrentPageChanged()
}

[Test]
public async void HandlesPopToRoot ()
public async Task HandlesPopToRoot ()
{
var root = new ContentPage { Title = "Root" };
var navPage = new NavigationPage (root);
Expand Down Expand Up @@ -489,7 +489,7 @@ public void DoesNotSendBackEventToNonCurrentPage ()
}

[Test]
public async void NavigatesBackWhenBackButtonPressed ()
public async Task NavigatesBackWhenBackButtonPressed ()
{
var root = new ContentPage { Title = "Root" };
var navPage = new NavigationPage (root);
Expand All @@ -503,7 +503,7 @@ public async void NavigatesBackWhenBackButtonPressed ()
}

[Test]
public async void DoesNotNavigatesBackWhenBackButtonPressedIfHandled ()
public async Task DoesNotNavigatesBackWhenBackButtonPressedIfHandled ()
{
var root = new BackButtonPage { Title = "Root" };
var second = new BackButtonPage () {Handle = true};
Expand Down Expand Up @@ -562,7 +562,7 @@ public void TestInsertPage()
}

[Test]
public async void TestRemovePage()
public async Task TestRemovePage()
{
var root = new ContentPage { Title = "Root" };
var newPage = new ContentPage();
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core.UnitTests/ResourceDictionaryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public void ShowKeyInExceptionIfNotFound()
var rd = new ResourceDictionary();
rd.Add("foo", "bar");
var ex = Assert.Throws<KeyNotFoundException>(() => { var foo = rd ["test_invalid_key"]; });
Assert.That(ex.Message, Is.StringContaining("test_invalid_key"));
Assert.That(ex.Message, Does.Contain("test_invalid_key"));
}

class MyRD : ResourceDictionary
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core.UnitTests/StyleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public void TriggersAppliedAfterSetters ()

[Test]
//https://bugzilla.xamarin.com/show_bug.cgi?id=31207
public async void StyleDontHoldStrongReferences ()
public async Task StyleDontHoldStrongReferences ()
{
var style = new Style (typeof(Label));
var label = new Label ();
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core.UnitTests/TypedBindingUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ public void OneTimeBindingDoesntUpdateNeedSettersOrHandlers()
}

[Test]
[Ignore]
[Ignore("SpeedTestApply")]
public void SpeedTestApply()
{

Expand Down Expand Up @@ -1560,7 +1560,7 @@ public void SpeedTestApply()
}

[Test]
[Ignore]
[Ignore("SpeedTestSetBC")]
public void SpeedTestSetBC()
{
var property = BindableProperty.Create("Foo", typeof(string), typeof(MockBindable));
Expand Down
8 changes: 4 additions & 4 deletions Xamarin.Forms.Core.UnitTests/UriImageSourceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static async Task<Stream> GetStreamAsync (Uri uri, CancellationToken cancellatio
}

[Test]
[Ignore]
[Ignore("LoadImageFromStream")]
public void LoadImageFromStream ()
{
var loader = new UriImageSource {
Expand All @@ -60,7 +60,7 @@ public void LoadImageFromStream ()
}

[Test]
[Ignore]
[Ignore("SecondCallLoadFromCache")]
public void SecondCallLoadFromCache ()
{
var loader = new UriImageSource {
Expand All @@ -80,7 +80,7 @@ public void SecondCallLoadFromCache ()
}

[Test]
[Ignore]
[Ignore("DoNotKeepFailedRetrieveInCache")]
public void DoNotKeepFailedRetrieveInCache ()
{
var loader = new UriImageSource {
Expand All @@ -98,7 +98,7 @@ public void DoNotKeepFailedRetrieveInCache ()
}

[Test]
[Ignore]
[Ignore("ConcurrentCallsOnSameUriAreQueued")]
public void ConcurrentCallsOnSameUriAreQueued ()
{
var loader = new UriImageSource {
Expand Down
Loading