Convert tests to UIThreadTestMethod pattern#764
Conversation
…tMethod - Changed [TestMethod] to [UIThreadTestMethod] - Removed EnqueueAsync wrapper - Added CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync() after gridSplitter.Name assignment - Added CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync() after gridSplitter.SetValue call - Added using CommunityToolkit.WinUI.Helpers for CompositionTargetHelper Co-authored-by: michael-hawker <[email protected]>
97f6180 to
55b3ecf
Compare
|
Updated to run it again will see if it passes again or if fluke. If this does make a different then it at least gives us some insight that it could be this specific test pattern that somehow has issues... FYI @Arlodotexe |
|
(UWP CI fail on .NET Native) |
|
|
|
@copilot apply the same [UIThreadTestMethod] fix to the ColorPickerTests.ExampleColorPickerTestClass.ComplexAsyncLoadUIExampleTest test in this same PR. |
- Changed [TestMethod] to [UIThreadTestMethod] - Removed EnqueueAsync wrapper - Added CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync() after LoadTestContentAsync - Added CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync() after UnloadTestContentAsync - Added using CommunityToolkit.WinUI.Helpers for CompositionTargetHelper Co-authored-by: michael-hawker <[email protected]>
Applied the same fix to |
The using CommunityToolkit.WinUI.Helpers is not needed as CompositionTargetHelper is already available through the test base class. Co-authored-by: michael-hawker <[email protected]>
Migrates tests from
[TestMethod]withEnqueueAsyncto[UIThreadTestMethod]pattern, adding explicit composition rendering waits for property propagation. This addresses CI failures on .NET Native UWP builds.Tests Converted
ShouldConfigureGridSplitterAutomationPeer (ExampleSizerBaseTestClass.cs)
[TestMethod]+EnqueueAsyncwrapper with[UIThreadTestMethod]CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync()aftergridSplitter.NameandgridSplitter.SetValue()calls to ensure property changes propagate before assertionsComplexAsyncLoadUIExampleTest (ExampleColorPickerTestClass.cs)
[TestMethod]+EnqueueAsyncwrapper with[UIThreadTestMethod]CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync()afterLoadTestContentAsyncandUnloadTestContentAsyncto ensure UI updates complete before assertionsBefore/After
Pattern matches existing usage across 15+ test files in the codebase.
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.