Harden WPF/WinUI3 integration fixtures against CI readiness races#36
Merged
Conversation
WpfSampleFixture and WinUI3SampleFixture dumped the tree twice in the test body and asserted directly on the result. Because WPF/WinUI3 tree collection injects a walker and completes asynchronously (issue #27), an individual dump can race and return an incomplete tree on slow/CI machines -- e.g. WpfSampleFixture.DurableKeyContract intermittently failed on CI with `okButton == nullptr` (the managed WPF names were missing that run), even though the fixture's SetUp readiness poll had succeeded. Add retry helpers (dump_ready_tree / query_element_until / query_prop_until) that re-issue the dump/query until the framework subtree (and the expected named control) is present, then assert. Makes both fixtures deterministic under CI. The Avalonia fixture already used the robust pattern (validated initialDump_ captured in SetUp), and the ComCtl fixture targets a synchronous in-process HWND, so neither is affected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Problem
WpfSampleFixture.DurableKeyContractfailed on CI (it passed on #32's own CI run, so it's flaky):WPF/WinUI3 tree collection injects a managed walker and completes asynchronously (issue #27). The fixtures polled for readiness in
SetUp, but their test bodies dumped the tree again and asserted directly — an individual dump can race and return an incomplete (Win32-only) tree on slow/CI machines, so the managednameproperties (e.g.OkButton) are missing that run.This surfaced as a red CI on PR #33, even though #33's Avalonia change is unrelated (its fixture already uses the robust pattern).
Fix
Add retry helpers and use them in the two vulnerable fixtures:
dump_ready_tree(...)— re-issues the dump until the framework subtree + expected named control are present.query_element_until(...)/query_prop_until(...)— retry--queryuntil it resolves.WpfSampleFixtureandWinUI3SampleFixturenow retry each body dump/query until complete, then assert. Deterministic under CI.Not affected: Avalonia fixture already captures a validated
initialDump_inSetUp; ComCtl targets a synchronous in-process HWND.Validation
cmake --build buildgreen.lvt_integration_tests.exe --gtest_filter=WpfSampleFixture.*:WinUI3SampleFixture.*passes locally. (Local injection is reliable, so the flake only reproduces on CI; the fix is by-design + CI will confirm.)Relates to #27.