Skip to content

Commit

Permalink
Enable WinUI Core Tests on CI (#15885)
Browse files Browse the repository at this point in the history
* Fix WinUI test issues

* - enable core tests

* - core test fixes

* - ignore semantics tests

* - fix

* - syntax errors
  • Loading branch information
PureWeen authored and jfversluis committed Aug 21, 2023
1 parent 0825104 commit 45044fd
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 17 deletions.
2 changes: 1 addition & 1 deletion eng/pipelines/device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ stages:
android: $(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests/Core.DeviceTests.csproj
ios: $(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests/Core.DeviceTests.csproj
# Skip this one for Windows for now, it's crashing sometimes
windows: #$(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests/Core.DeviceTests.csproj
windows: $(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests/Core.DeviceTests.csproj
- name: controls
desc: Controls
androidApiLevelsExclude: [25] # Ignore for now API25 since the runs's are not stable
Expand Down
9 changes: 0 additions & 9 deletions src/Controls/tests/DeviceTests/ControlsHandlerTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@

namespace Microsoft.Maui.DeviceTests
{
#if WINDOWS
// Uncomment these sections if you hit issues with parallel executions
[CollectionDefinition("Non-Parallel Collection", DisableParallelization = true)]
public class NonParallelCollectionDefinitionClass
{
}

[Collection("Non-Parallel Collection")]
#endif
public partial class ControlsHandlerTestBase : HandlerTestBase, IDisposable
{
// In order to run any page level tests android needs to add itself to the decor view inside a new fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public virtual async Task SetVisibility(Visibility visibility)
}

[Fact(DisplayName = "Setting Semantic Description makes element accessible")]
public async Task SettingSemanticDescriptionMakesElementAccessible()
public async virtual Task SettingSemanticDescriptionMakesElementAccessible()
{
var view = new TStub();
MockAccessibilityExpectations(view);
Expand All @@ -94,7 +94,7 @@ public async Task SettingSemanticDescriptionMakesElementAccessible()
}

[Fact(DisplayName = "Setting Semantic Hint makes element accessible")]
public async Task SettingSemanticHintMakesElementAccessible()
public async virtual Task SettingSemanticHintMakesElementAccessible()
{
var view = new TStub();
MockAccessibilityExpectations(view);
Expand Down
8 changes: 8 additions & 0 deletions src/Core/tests/DeviceTests.Shared/HandlerTests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
using System.Threading.Tasks;
using Microsoft.Maui.Dispatching;
using Microsoft.Maui.TestUtils.DeviceTests.Runners;
using Xunit;

namespace Microsoft.Maui.DeviceTests
{
//// Uncomment these sections if you hit issues with parallel executions
//[CollectionDefinition("Non-Parallel Collection", DisableParallelization = true)]
//public class NonParallelCollectionDefinitionClass
//{
//}

[Collection("Non-Parallel Collection")]
public partial class TestBase
{
public const int EmCoefficientPrecision = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,17 @@ ProgressRing GetNativeActivityIndicator(ActivityIndicatorHandler activityIndicat

bool GetNativeIsRunning(ActivityIndicatorHandler activityIndicatorHandler) =>
GetNativeActivityIndicator(activityIndicatorHandler).IsActive;

[Fact(Skip = "Failing on Windows")]
public override Task SettingSemanticDescriptionMakesElementAccessible()
{
return base.SettingSemanticDescriptionMakesElementAccessible();
}

[Fact(Skip = "Failing on Windows")]
public override Task SettingSemanticHintMakesElementAccessible()
{
return base.SettingSemanticHintMakesElementAccessible();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ public async Task IsRunningInitializesCorrectly(bool isRunning)
await ValidatePropertyInitValue(activityIndicator, () => activityIndicator.IsRunning, GetNativeIsRunning, activityIndicator.IsRunning);
}

[Fact(DisplayName = "Background Updates Correctly")]
[Fact(DisplayName = "Background Updates Correctly"
#if WINDOWS
, Skip = "Failing on Windows"
#endif
)]
public async Task BackgroundUpdatesCorrectly()
{
var activityIndicator = new ActivityIndicatorStub()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Threading.Tasks;
using Microsoft.Maui.DeviceTests.Stubs;

namespace Microsoft.Maui.DeviceTests
{
#if !WINDOWS
[Category(TestCategory.SwipeView)]
public partial class SwipeViewHandlerTests : CoreHandlerTestBase<SwipeViewHandler, SwipeViewStub>
{
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ public async Task NullThumbColorDoesntCrash()
await CreateHandlerAsync(switchStub);
}

[Fact(DisplayName = "Thumb Color Updates Correctly")]
[Fact(DisplayName = "Thumb Color Updates Correctly"
#if WINDOWS
, Skip = "Failing on Windows"
#endif
)]
public async Task ThumbColorUpdatesCorrectly()
{
var switchStub = new SwitchStub()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public async Task TextChangedEventsFireCorrectly(string initialText, string newT
Assert.Equal(0, eventFiredCount);
}

[Fact]
[Fact
#if WINDOWS
(Skip = "Failing on Windows")
#endif
]
public async Task CursorPositionDoesntResetWhenNativeTextValueChanges()
{
var textInput = new TStub()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ await handler.PlatformView.AttachAndRun(async () =>
await handler.PlatformView.OnLoadedAsync();
await navigationComplete.Task;
navigationComplete = null;
}, MauiContext);
});
});
}

Expand Down
1 change: 0 additions & 1 deletion src/Core/tests/DeviceTests/Stubs/BorderStub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ public Size CrossPlatformArrange(Rect bounds)
return (PresentedContent ?? (Content as IView))?.Arrange(bounds) ?? Size.Zero;
}
#endif

}
}

0 comments on commit 45044fd

Please sign in to comment.