-
Notifications
You must be signed in to change notification settings - Fork 123
Convert tests to UIThreadTestMethod pattern #764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 <24302614+michael-hawker@users.noreply.github.com>
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 <24302614+michael-hawker@users.noreply.github.com>
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 <24302614+michael-hawker@users.noreply.github.com>
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.