[release/11.0.1xx-preview7] Fix Label UI test page recreation - #37043
[release/11.0.1xx-preview7] Fix Label UI test page recreation#37043kubaflo wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9be49656-7117-4235-9d96-404779ab6b16
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37043Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37043" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Label feature-matrix HostApp page’s “recreate page” tap handler to rebuild LabelControlMainPage via the navigation stack (insert + pop) instead of re-running InitializeComponent() on the existing page instance, addressing layout shifts that can cascade into multiple Label visual test failures.
Changes:
- Change the label tap handler to asynchronously replace the current page by inserting a new instance before it and popping the current page.
- Preserve the existing
BindingContext = nullstep to detach the oldFormattedStringbefore the page is replaced.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
MainLabel_Tapped could be re-entered if the label was tapped again before the first PopAsync completed, inserting multiple pages and popping the wrong one. Add a per-instance guard so the page recreation runs at most once. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial review: no actionable findings
Three independent reviewers with adversarial consensus plus the MAUI domain specialist found no high-confidence correctness issues. The page replacement preserves the shared view-model state, returns the navigation stack to one page, rebuilds the XAML name scope/toolbar/query identifiers, detaches the old FormattedString through BindingContext = null, and leaves the popped page eligible for cleanup. The change is confined to the UI-test HostApp and does not alter shipping framework behavior.
The existing ordered Label screenshot tests exercise the recreation path before and after mapper application; their screenshot retry path covers the asynchronous pop transition. The earlier repeated-tap concern is resolved by the per-instance guard, with no unresolved prior review findings.
Discarded concerns: async void navigation failure handling and dedicated double-tap guard coverage were considered, but neither had a concrete new failure scenario in this test-only flow.
|
/azp run maui-pr-uitests |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
CI verification found this change does not fix the intended failure yet, so please do not merge this revision. At current head |
|
Closing this approach: the current head left the same 17 WinUI Label failures unchanged versus the preview7 base, and its Android Label shard introduced three deterministic formatted-text truncation snapshot failures on both attempts. The page-recreation change is therefore ineffective and adds regressions. PR #37046 remains the clean blessed-SDK comparison for deciding whether the WinUI baselines need updating. |
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
The Label feature-matrix tests verify both subsequent property updates and initial mapper application by tapping the label and taking a second screenshot. The tap handler was re-running
InitializeComponent()on the existingContentPage, which left the Windows page layout shifted. The first screenshot passed, while the second screenshot failed and caused 17 cascading Label visual failures.Recreate the
LabelControlMainPagethrough the navigation stack instead. Clearing the old binding context still detaches the existingFormattedString, while the replacement page gets a clean name scope, toolbar, content tree, and handler lifecycle.CI Evidence
In maui-pr-uitests build 1537359,
VerifyLabelWithTextAndFontColorpassed its first screenshot and failed the second screenshot afterMainLabel_Tapped(LabelFeatureTests.cs:590). The resulting vertical layout shift then affected the remaining Label visual tests.Testing
The existing Label feature-matrix UI tests cover this path by comparing screenshots before and after page recreation.