Skip to content

[ci-fix] De-flake SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle with keyboard waits (refs #37556) - #37741

Merged
kubaflo merged 1 commit into
mainfrom
ci-fix/issue-37556-39ac355fcc81b2d1
Aug 22, 2026
Merged

kubaflo merged 1 commit into
mainfrom
ci-fix/issue-37556-39ac355fcc81b2d1

Conversation

@github-actions

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!

Workflow artifact: ci-fix
Artifact kind: deflake
Refs: #37556
Target branch: main
Attempt: 1/10

Attempt 1 of 10

Synchronize the test with actual keyboard visibility before validating the keyboard-dependent safe-area layouts.

Previous attempts (prior commits on this PR)

None.

This attempt differs by: this is the first attempt.

Root cause

The latest main build 1563072 failed SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle on run 0 because ContentGrid had not shrunk after tapping the entry, then passed on built-in retry run 1. The test immediately queried layout after the tap and immediately changed edges after dismissing the keyboard, without first proving either keyboard transition completed.

Flake class: test-quality

Why this was flaky

Issue28986_ContentPage.SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle retried its layout assertion but had no synchronization point confirming that Android had shown the keyboard. It also dismissed the keyboard and immediately restored all safe-area edges. Depending on keyboard animation timing, the assertions could observe the pre-transition layout; build 1563072 demonstrates the intermittent fail-then-pass behavior.

De-flake

The test now asserts WaitForKeyboardToShow() before measuring the keyboard-visible layout and WaitForKeyboardToHide() before restoring all safe-area edges. Every existing layout assertion remains unchanged. No timeout was increased, no retry attribute was added, and no assertion was weakened.

Fix

Add the existing Appium keyboard-state waits at the two transition boundaries so the test evaluates the same behavior in deterministic UI states.

What is unverified / where I need help

  • The Android UI test could not be run because this runner has no device rig.
  • Please confirm the API 36 SafeAreaEdges leg consistently observes both transitions and preserves the intended edge-toggle sequence.

Validation

  • Command: not run because no Android device rig is available
  • Result: not run

Evidence


Filed by ci-status-fix. This is the single PR for #37556: the workflow watches its own CI and pushes up to 10 attempts on this same PR (it never opens a second PR). It advances only when the fix's own build settles red and that red is caused by the fix. Comments, reviews, and commits do not transfer ownership; the loop remains autonomous until this PR is closed. Eligible CHANGES_REQUESTED reviews are handled through Track C. After 10 attempts it stops and defers to humans. In round 1 a maintainer still needs to comment /azp run maui-pr (plus the gated uitests/devicetests legs when relevant) to exercise each new commit.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • dc.services.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "dc.services.visualstudio.com"

See Network Configuration for more information.

Generated by CI Failure Fixer (main) · gpt56 · 446.8 AIC · ⌖ 82.9 AIC · ⊞ 31.1K · ◷

…mpt 1/10)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo

kubaflo commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@kubaflo
kubaflo marked this pull request as ready for review August 22, 2026 18:49
Copilot AI lite review requested due to automatic review settings August 22, 2026 18:49
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo
kubaflo merged commit e7d00b0 into main Aug 22, 2026
151 of 165 checks passed
@kubaflo
kubaflo deleted the ci-fix/issue-37556-39ac355fcc81b2d1 branch August 22, 2026 18:50
@github-actions github-actions Bot added this to the .NET 10 SR11 milestone Aug 22, 2026

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.

Pull request overview

This PR de-flakes the SafeArea keyboard UI test by synchronizing layout assertions with keyboard visibility transitions.

Changes:

  • Waits for the keyboard to appear before validating layout.
  • Waits for dismissal before restoring safe-area edges.
  • Preserves existing layout assertions.

kubaflo added a commit that referenced this pull request Sep 19, 2026
…38665)

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Fix the two Android API 36 / Pixel 3 XL SafeAreaEdges failures in [build
1602666](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1602666&view=logs&j=217a4b68-6397-5ebe-0d4b-1177e8401828&t=3a87bec2-0591-537a-1f29-40eb70176265).

- Preserve the full top inset throughout a full-height page's navigation
transition, including `0 < viewTop <= topInset`. Check animation before
partial overlap, and preserve the translated-child height guard from
#38295.
- Replace catch-and-retry NUnit assertions in
`SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with delayed
constraints. NUnit 4.0.1 records an assertion failure before throwing,
so catching it and succeeding on a later attempt still leaves the test
failed. The original CI device log actually shows the grid shrinking
from 2705 to 1613 pixels and returning to 2705 after dismissal.
- Preserve the 15-second polling window, 500-ms interval, keyboard
visibility checks, and one-pixel restoration tolerance. Check restored
height and Y together on the same rectangle.
- Add six Android native cases exercising the production inset helper:
full-height offsets 0, 1, 99, 100, and 101 with a 100-pixel top inset,
plus a translated short child. Assert padding and inset consumption.

No snapshots, screenshot tolerances, public APIs, dependencies, or CI
configuration are changed. `LayoutShouldBeCorrectOnFirstNavigation`
remains unchanged.

### Regression origins

| Failure | Introducing change | Evidence |
| --- | --- | --- |
| Persistent incorrect top inset during navigation | #33788, commit
`9c0887b8c343a1a98762acfccb64190355e175ee` | Removed the deferred inset
reapplication added in #33285 and introduced `viewTop > top`, leaving
the final `0 < viewTop <= top` transition range unprotected. |
| Transient keyboard measurements retained as NUnit failures | #31022,
commit `0371d318282cc6f0cbb96d36315e7fc2f70680ff` | Introduced
catch-and-retry `RetryAssert` while the Android UI project already
referenced NUnit 4.0.1. |
| The specific keyboard test exposing that defect | #35083 | Added
`SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` using that
helper. The later keyboard waits in #37741 did not isolate recorded
NUnit failures. |

These are source-history attributions, not a historical full-build
bisect. The keyboard failure is a test-harness defect, not proof that
the grid never resized.

### Validation

Tested commit: `8aa80ab8d9312be1aeddfbb200ff580e5c678598`.

Environment: dedicated Android API 36 / Pixel 3 XL ARM64 emulator,
1440x2960 at density 560, Release HostApp, existing NUnit 4.0.1 /
adapter 4.5.0. Actual TRX and xUnit XML results were inspected, not
inferred from process exit codes.

| Coverage | Result |
| --- | --- |
| `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` | Passed in
**3 consecutive focused runs**, on the first attempt each time. |
| `LayoutShouldBeCorrectOnFirstNavigation` | Passed in **3 consecutive
focused runs**, on the first attempt each time, against the unchanged
snapshot and tolerance. |
| Six native inset boundary cases, without native fix | Three expected
failures: offsets 1, 99, and 100 produced padding 99, 1, and 0 instead
of 100. Settled-origin, offset-101, and translated-child controls
passed. |
| Same six native cases, with native fix | **6 passed, 0 failed**. |
| Complete `Issue28986_ContentPage` fixture, final with-fix A/B leg |
**5 passed, 0 failed**, first attempt. |
| Standalone NUnit 4.0.1 probe | All five expected outcomes confirmed:
caught assertions remain failed; delayed height and compound bounds
constraints recover; permanently incorrect height or bounds still fail.
|

The repository `verify-tests-fail.ps1` finished with **`VERIFICATION
PASSED`**, using frozen base `49b62062536b4a2b957d965f76035eb56806615c`
and restoring only the two fix files. The final native A/B evidence is
deterministic. The without-fix keyboard fixture was timing-dependent and
also encountered element-lookup failures; its logs contain the original
retained `2705` assertion. The standalone NUnit probe independently
isolates that bookkeeping defect. No claim is made that every
broad-fixture failure was caused by this PR's targeted bug.

Initial verification attempts were blocked by the pinned XHarness
runtime and its default instrumentation selection. They are not counted
as native proof. Final native execution used the manifest's explicit
`com.microsoft.maui.core.devicetests.TestInstrumentation` with a
session-local runtime. No repository tool versions or machine-wide SDKs
were changed.

Focused UI command, executed three times:

```powershell
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -Configuration Release -DeviceUdid emulator-5554 -TestFilter 'FullyQualifiedName~Issue33038|FullyQualifiedName~SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle'
```

The worktree was clean after verification. PR CI is separate: [maui-pr
build
1602977](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1602977)
is running; this is not a full-CI-green or full-suite-green claim. No
`maui-pr-uitests` build had been scheduled at the time of this update.

### Related work and constraints

The native correction follows the narrowly scoped approach proposed in
closed, unmerged #38641, without its unrelated MacCatalyst skip. Open
#37953 proposes a broader SafeArea redesign; this PR keeps a small
correction and fixes the separate NUnit bookkeeping defect.

Do not replace the navigation baseline, widen its tolerance, or remove
the translated-child guard to make the test pass. Do not use caught
NUnit assertions as a polling predicate. The generic Appium helper
remains unchanged here to avoid adding an NUnit dependency or broad
test-infrastructure changes.

### Issues Fixed

Fixes #37555
Fixes #37556
Refs #33038
Refs #38135

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Sep 21, 2026
…38665)

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Fix the two Android API 36 / Pixel 3 XL SafeAreaEdges failures in [build
1602666](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1602666&view=logs&j=217a4b68-6397-5ebe-0d4b-1177e8401828&t=3a87bec2-0591-537a-1f29-40eb70176265).

- Preserve the full top inset throughout a full-height page's navigation
transition, including `0 < viewTop <= topInset`. Check animation before
partial overlap, and preserve the translated-child height guard from
#38295.
- Replace catch-and-retry NUnit assertions in
`SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` with delayed
constraints. NUnit 4.0.1 records an assertion failure before throwing,
so catching it and succeeding on a later attempt still leaves the test
failed. The original CI device log actually shows the grid shrinking
from 2705 to 1613 pixels and returning to 2705 after dismissal.
- Preserve the 15-second polling window, 500-ms interval, keyboard
visibility checks, and one-pixel restoration tolerance. Check restored
height and Y together on the same rectangle.
- Add six Android native cases exercising the production inset helper:
full-height offsets 0, 1, 99, 100, and 101 with a 100-pixel top inset,
plus a translated short child. Assert padding and inset consumption.

No snapshots, screenshot tolerances, public APIs, dependencies, or CI
configuration are changed. `LayoutShouldBeCorrectOnFirstNavigation`
remains unchanged.

### Regression origins

| Failure | Introducing change | Evidence |
| --- | --- | --- |
| Persistent incorrect top inset during navigation | #33788, commit
`9c0887b8c343a1a98762acfccb64190355e175ee` | Removed the deferred inset
reapplication added in #33285 and introduced `viewTop > top`, leaving
the final `0 < viewTop <= top` transition range unprotected. |
| Transient keyboard measurements retained as NUnit failures | #31022,
commit `0371d318282cc6f0cbb96d36315e7fc2f70680ff` | Introduced
catch-and-retry `RetryAssert` while the Android UI project already
referenced NUnit 4.0.1. |
| The specific keyboard test exposing that defect | #35083 | Added
`SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` using that
helper. The later keyboard waits in #37741 did not isolate recorded
NUnit failures. |

These are source-history attributions, not a historical full-build
bisect. The keyboard failure is a test-harness defect, not proof that
the grid never resized.

### Validation

Tested commit: `8aa80ab8d9312be1aeddfbb200ff580e5c678598`.

Environment: dedicated Android API 36 / Pixel 3 XL ARM64 emulator,
1440x2960 at density 560, Release HostApp, existing NUnit 4.0.1 /
adapter 4.5.0. Actual TRX and xUnit XML results were inspected, not
inferred from process exit codes.

| Coverage | Result |
| --- | --- |
| `SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle` | Passed in
**3 consecutive focused runs**, on the first attempt each time. |
| `LayoutShouldBeCorrectOnFirstNavigation` | Passed in **3 consecutive
focused runs**, on the first attempt each time, against the unchanged
snapshot and tolerance. |
| Six native inset boundary cases, without native fix | Three expected
failures: offsets 1, 99, and 100 produced padding 99, 1, and 0 instead
of 100. Settled-origin, offset-101, and translated-child controls
passed. |
| Same six native cases, with native fix | **6 passed, 0 failed**. |
| Complete `Issue28986_ContentPage` fixture, final with-fix A/B leg |
**5 passed, 0 failed**, first attempt. |
| Standalone NUnit 4.0.1 probe | All five expected outcomes confirmed:
caught assertions remain failed; delayed height and compound bounds
constraints recover; permanently incorrect height or bounds still fail.
|

The repository `verify-tests-fail.ps1` finished with **`VERIFICATION
PASSED`**, using frozen base `49b62062536b4a2b957d965f76035eb56806615c`
and restoring only the two fix files. The final native A/B evidence is
deterministic. The without-fix keyboard fixture was timing-dependent and
also encountered element-lookup failures; its logs contain the original
retained `2705` assertion. The standalone NUnit probe independently
isolates that bookkeeping defect. No claim is made that every
broad-fixture failure was caused by this PR's targeted bug.

Initial verification attempts were blocked by the pinned XHarness
runtime and its default instrumentation selection. They are not counted
as native proof. Final native execution used the manifest's explicit
`com.microsoft.maui.core.devicetests.TestInstrumentation` with a
session-local runtime. No repository tool versions or machine-wide SDKs
were changed.

Focused UI command, executed three times:

```powershell
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -Configuration Release -DeviceUdid emulator-5554 -TestFilter 'FullyQualifiedName~Issue33038|FullyQualifiedName~SafeAreaNoWhiteSpaceAfterKeyboardDismissAndEdgeToggle'
```

The worktree was clean after verification. PR CI is separate: [maui-pr
build
1602977](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1602977)
is running; this is not a full-CI-green or full-suite-green claim. No
`maui-pr-uitests` build had been scheduled at the time of this update.

### Related work and constraints

The native correction follows the narrowly scoped approach proposed in
closed, unmerged #38641, without its unrelated MacCatalyst skip. Open
#37953 proposes a broader SafeArea redesign; this PR keeps a small
correction and fixes the separate NUnit bookkeeping defect.

Do not replace the navigation baseline, widen its tolerance, or remove
the translated-child guard to make the test pass. Do not use caught
NUnit assertions as a polling predicate. The generic Appium helper
remains unchanged here to avoid adding an NUnit dependency or broad
test-infrastructure changes.

### Issues Fixed

Fixes #37555
Fixes #37556
Refs #33038
Refs #38135

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants