Skip to content

[release/10.0.1xx-sr11] Fix unloaded-page alert UI test - #38539

Closed
kubaflo wants to merge 1 commit into
release/10.0.1xx-sr11from
kubaflo-ci-test-fixes
Closed

kubaflo wants to merge 1 commit into
release/10.0.1xx-sr11from
kubaflo-ci-test-fixes

Conversation

@kubaflo

@kubaflo kubaflo commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

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!

Summary

Fix DisplayAlertAsyncShouldNotCrashWhenPageUnloaded in the Android Page/Performance/Picker/ProgressBar check on release/10.0.1xx-sr11. Only the regression fixture and its UI test change; no framework behavior, retries, or timeouts change.

Root cause

The reported check in build 1596434 fails at the wait for GoBackButton, including the retry (test runs 44070846 and 44071672).

There are two coupled test defects:

  • [ci-fix] De-flake DisplayAlert navigation with push completion (refs #38016) #38381 intentionally assigns the back button's AutomationId after PushAsync completes. On Android that late assignment exposes content-desc="GoBackButton", but the button has no matching resource-id. The test's string locator searches by resource ID and cannot find it. A local run with the timer removed confirmed this exact hierarchy.
  • The two-second OnAppearing timer can display the alert before Appium navigates back. The CI failure attachment shows Test Alert covering the page, so the intended detached-page scenario never executes.

Picker_TapPicker_TakeScreenshot and Picker_SetShadow_VerifyShadow also failed on the first attempt of the linked job, but both passed its retry. They are not changed here.

Fix

  • Keep the push-completion barrier from [ci-fix] De-flake DisplayAlert navigation with push completion (refs #38016) #38381 and query the late-assigned back button by accessibility ID.
  • Replace the timer with an alert call when back navigation clears the page's parent. This exercises the null-window protection from Fix crash when displaying alerts on unloaded pages #33288 before navigation disconnects the handler. Calling only after handler teardown would instead enqueue an alert for a future navigation and leave the task pending.
  • Await navigation, the Unloaded event, and the alert task; assert that the page is detached/unloaded and publish an explicit completion result.
  • Replace the test's three-second sleep with a completion assertion, retaining its main-page responsiveness assertion.

This preserves the earlier push-transition fix while removing the remaining timing and locator failures. No open PR addressing #33287 was found before implementing this follow-up.

Validation

  • Reproduced the original GoBackButton timeout locally on Android API 30.
  • Final test passed on Android API 30 twice, including a repeat after formatting.
  • Final test passed on iOS 26.5.
  • MacCatalyst run stopped at the user's request to avoid desktop input interference; no MacCatalyst result is claimed. Windows was not run.
  • Framework-guard-removal verification was not run.

Related to #33287, #33288, and #38381.

Use the accessibility ID for the back button exposed after PushAsync. Invoke the alert when the page loses its parent, before handler disconnection, and wait for unloading and alert completion instead of fixed delays.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 14, 2026 22:31
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38539

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38539"

@kubaflo
kubaflo changed the base branch from main to release/10.0.1xx-sr11 September 14, 2026 22:31
@kubaflo

kubaflo commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

/azp run maui-pr-uitests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The UI lifecycle synchronization changes require final human review.

Pull request overview

This test-only pull request stabilizes the unloaded-page alert UI regression test by synchronizing navigation, unloading, alert completion, and assertions.

Changes:

  • Uses accessibility-ID lookup for the late-created back button.
  • Replaces timer-based alert invocation with lifecycle synchronization.
  • Adds explicit completion and responsiveness assertions.
File summaries
File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33287.cs Improves navigation and completion assertions.
src/Controls/tests/TestCases.HostApp/Issues/Issue33287.cs Coordinates unloaded-page alert testing and completion reporting.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

@sheiksyedm

Copy link
Copy Markdown
Contributor

@kubaflo This PR no need after moving this #38564.

@kubaflo kubaflo closed this Sep 15, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 28, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 691a291d Deployed Sep 14, 2026 by kubaflo via conclusion #1898
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants