Repository navigation
test: Fix flaky NavigationView toggle test on WinUI - #23610
Merged
MartinZikmund merged 1 commit intoJul 1, 2026
Merged
Conversation
The When_CompactPaneLength_Changed_PaneToggleButton_Updates test was unstable on native WinUI (winappsdk). After changing CompactPaneLength, the binding-driven MinWidth updates before the button is re-arranged, so ActualWidth catches up asynchronously and a single WaitForIdle was sometimes insufficient. Poll for the width to settle instead. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates a NavigationView runtime test to reduce flakiness by avoiding an immediate ActualWidth assertion after CompactPaneLength changes, which can race with an asynchronous layout pass (notably on native WinUI).
Changes:
- Replaces the immediate
toggleButton.ActualWidthassertion with aWindowHelper.WaitFor(...)poll (3s timeout). - Adds a comment explaining the WinUI layout/binding timing behavior that motivated the change.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23610/wasm-skia-net9/index.html |
MartinZikmund
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue: closes #23561
PR Type:
🐞 Bugfix
What changed? 🚀
Given_NavigationView.When_CompactPaneLength_Changed_PaneToggleButton_Updateswas flaky on native WinUI (winappsdk) — it intermittently failed withToggle button should grow: 200 -> 200(only on WinUI, not Skia Desktop).Root cause (test timing, not a product bug): the test runs against Microsoft's own
NavigationViewon WinUI, which is the reference implementation, so its behavior is correct by definition. AfterCompactPaneLengthchanges, the value flows source →TemplateSettings→ binding →TogglePaneButton.MinWidthsynchronously, but the re-arrange that updatesActualWidthhappens asynchronously. A singleWaitForIdle()sometimes returned before that arrange pass flushed. The failure state was internally inconsistent (MinWidth=292whileActualWidth=200), confirming the layout simply hadn't settled — the value arrives, just late.Fix: the upstream
TemplateSettings/MinWidthassertions stay eager (they settle first, preserving the granular diagnostic), and only the racyActualWidthcheck is replaced with a pollingWindowHelper.WaitFor(...)(3s timeout). This corrects a wrong timing assumption in the test — a root-cause fix, not defensive hardening.Validation: built the WinAppSDK SamplesApp MSIX and ran the test against native WinUI — 9/9 consecutive passes (1 initial + 8 reruns). Previously it flaked on this path.
PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code