[ci-fix-net11] De-flake EditorRuntimeTextAlignmentChanged UI test (NoSuchElementException race on iOS)#36395
Conversation
… tapping EditorRuntimeTextAlignmentChanged (Issue10987) intermittently failed on the iOS latest simulator with NoSuchElementException because its first action, App.Tap(LTREditor), ran before the editor had rendered. The sibling test EditorPlaceholderRuntimeTextAlignmentChanged already waits for its target element first; this applies the same synchronization. Adds App.WaitForElement(LTREditor) before the first interaction so the test is deterministic. No assertion is weakened and VerifyScreenshot is unchanged. Refs: #36393 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@github-actions[bot] — new AI review results are available based on this last commit:
e2fcaac. To request a fresh review after new comments or commits, comment/review rerun.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ⚠️ SKIPPED
Gate skipped (SkipUITests fast test mode). No UI/device tests were run for this pipeline invocation.
📋 Pre-Flight — Context & Validation
Issue: #36393 - [ci-scan-net11] Flaky: EditorRuntimeTextAlignmentChanged — NoSuchElementException on iOS (vlatest) UITests (net11.0)
PR: #36395 - [ci-fix] De-flake EditorRuntimeTextAlignmentChanged UI test (NoSuchElementException race on iOS)
Platforms Affected: iOS reported; android requested for candidate testing
Files Changed: 0 implementation, 1 test
Key Findings
- The linked issue reports intermittent
NoSuchElementExceptioninIssue10987.EditorRuntimeTextAlignmentChangedbefore the first interaction withLTREditor. - PR #36395 adds
App.WaitForElement(LTREditor);beforeApp.Tap(LTREditor);; it does not mute the test, weakenVerifyScreenshot(), add retry attributes, or change baselines. - The changed file is
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10987.cs; the affected UI category isEditor. - Local
ghis unauthenticated, so PR metadata/comments were gathered through GitHub's public REST API. The local worktree also contains unrelated script edits, so public PR data was treated as authoritative for PR context.
Code Review Summary
Verdict: NEEDS_DISCUSSION
Confidence: low
Errors: 0 | Warnings: 0 | Suggestions: 0
Key code review findings:
- ℹ No code findings. The PR fix matches MAUI UI-test guidance to use
WaitForElementbefore interacting with an element that may not be rendered yet. - ℹ Coverage/verification gap: required-check state could not be authenticated locally, and Android device validation is blocked by missing
adb.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #36395 | Add App.WaitForElement(LTREditor); before App.Tap(LTREditor); |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10987.cs |
Original PR; one-line deterministic wait before first interaction |
🔬 Code Review — Deep Analysis
Code Review — PR #36395
Independent Assessment
What this changes: Adds App.WaitForElement(LTREditor); before tapping LTREditor in EditorRuntimeTextAlignmentChanged.
Inferred motivation: De-flake an Appium timing race where the editor is not yet present when first tapped.
Reconciliation with PR Narrative
Author claims: Fixes intermittent iOS NoSuchElementException without muting or weakening the test.
Agreement/disagreement: Agrees. The fix matches MAUI UI-test guidance: wait for an element before interacting.
Prior Review Reconciliation
No prior ❌ Error findings found. Inline review comments were empty via the public PR comments API.
Blast Radius Assessment
- Runs for all instances: No — isolated to one UI test method.
- Startup impact: No.
- Static/shared state: No.
CI Status
- Required-check result:
gh pr checks --requiredunavailable because the local GitHub CLI is unauthenticated. Public combined status for heade2fcaacc5217ec7bb40a89908bfebff03b3a029creturnedpendingwith zero contexts. - Classification: undetermined.
- Action taken: confidence capped low.
Findings
No ❌ Errors,
Failure-Mode Probing
- If
LTREditoris not rendered yet:WaitForElementblocks until present, addressing the reported first-interactionNoSuchElementException. - If the page is not fully settled but
LTREditorexists: the PR fix proves target presence but does not prove adjacent control readiness; laterApp.WaitForElement(RTLEditor)still guards the second editor. - Cross-platform impact: safe; test-only change, no product code, no assertion weakening, no screenshot baseline change.
Verdict: NEEDS_DISCUSSION
Confidence: low
Summary: The code change is sound and minimal, with no code-review findings. Because required-check state could not be authenticated and the Android validation environment lacks adb, this cannot be promoted to a verified LGTM from this session alone.
🛠️ Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix-1 | Replace wait-then-second-lookup with App.WaitForElement(LTREditor).Tap() |
1 file | Potentially stronger than PR by tapping the waited element; Android SDK/adb missing prevented execution |
|
| 2 | try-fix-2 | Wait for RTLEditor as a whole-page readiness barrier before tapping LTREditor |
1 file | Uses sibling-test pattern but is more indirect than the PR fix; Android SDK/adb missing prevented execution |
|
| 3 | try-fix-3 | Remove the first tap and let EnterText(LTREditor, ...) focus after page readiness |
1 file | Meaningfully different but riskier because the tap is documented as Mac focus setup; Android SDK/adb missing prevented execution |
|
| PR | PR #36395 | Add App.WaitForElement(LTREditor); before App.Tap(LTREditor); |
1 file | Original PR; simplest and best-aligned with MAUI UITest guidance |
Cross-Pollination
| Model/Reviewer | Round | New Ideas? | Details |
|---|---|---|---|
| code-review skill + MAUI expert reviewer | 1 | Yes | Generated alternatives: reuse waited element for tap, wait for later page element as readiness barrier, require hittable/non-zero geometry, remove initial tap, add host-page readiness sentinel. |
| orchestrator | 1 | No further viable tested candidates | Geometry/hittable custom wait and host-page sentinel were not run because they are more invasive/verbose for a simple element-not-found race and not clearly better than candidates 1-3 or the PR fix. |
Exhausted: Yes
Selected Fix: PR #36395 — No alternative passed tests, and all candidate executions were blocked by missing Android SDK/adb. Among unverified options, try-fix-1 is the only candidate that may be stronger than the PR fix, but it is not demonstrably better without device execution. The PR fix remains the simplest deterministic synchronization matching .github/instructions/uitests.instructions.md.
Environment Blocker
All Android candidate tests used:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "FullyQualifiedName~Issue10987.EditorRuntimeTextAlignmentChanged"Each attempt failed before running tests with:
Android SDK (adb) not found. Please install Android SDK and ensure 'adb' is in PATH.
Failed to start or detect device
🏁 Report — Final Recommendation
Comparative Candidate Report — PR #36395
Candidates compared
| Rank | Candidate | Result | Assessment |
|---|---|---|---|
| 1 | pr |
Gate skipped; no regression failure observed | Adds the exact missing readiness wait before the first interaction with LTREditor. This is the simplest targeted synchronization fix and matches MAUI UI-test guidance for element-not-found races. |
| 2 | pr-plus-reviewer |
Same as pr |
Expert review produced no actionable findings, so this is identical to pr and not a distinct improvement. |
| 3 | try-fix-1 |
Blocked before test execution | Uses App.WaitForElement(LTREditor).Tap() to tap the waited element. This is plausible and slightly stronger against a theoretical wait-then-relookup race, but it was not empirically validated and is not necessary for the observed failure. |
| 4 | try-fix-2 |
Blocked before test execution | Waits for RTLEditor as a page-ready barrier before tapping LTREditor. It is deterministic but indirect because it waits for a neighboring/later element instead of the element being tapped. |
| 5 | try-fix-3 |
Blocked before test execution | Removes the initial tap and relies on EnterText to focus. This is riskiest because the existing tap is explicitly documented as needed for Mac focus behavior, while the reported flake is an iOS element-readiness race. |
No candidate failed regression tests. The Step 5a try-fix candidates were all blocked before UI test execution because Android SDK/adb was unavailable, so they cannot outrank the simpler PR fix on empirical grounds. Candidates that failed regression tests would be ranked below passing candidates; none are present here.
Winning candidate
Winner: pr
The raw PR fix is the best candidate because it directly addresses the root cause with the smallest safe change: wait for LTREditor before tapping it. It does not mute the test, add retry behavior, weaken assertions, remove platform-specific focus setup, or change screenshot verification. Expert review found no actionable improvements, making pr-plus-reviewer equivalent rather than superior.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
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!
Target branch: net11.0
Refs: #36393
Attempt: 1/5
Outcome: de-flake (test-quality flake — Step 4.7 bucket b)
Summary
EditorRuntimeTextAlignmentChanged(Issue10987) fails intermittently on the iOS latest simulator inmaui-pr-uitestswithNoSuchElementException("An element could not be located on the page"). The failure is a timing race in the test, not a product defect and not a visual-snapshot difference, so it is de-flaked with a proper synchronization point rather than muted.Root cause — a genuine test-quality flake
EditorRuntimeTextAlignmentChanged's very first action interacts withLTREditorwithout first waiting for it to render:When the page has not finished rendering on the iOS simulator,
App.Tap(LTREditor)cannot locate the element and throwsNoSuchElementException. Whether the editor is ready when the test starts is non-deterministic, which is why the failure is intermittent (green on retry / most builds).Evidence of intermittency (anonymous AzDO
_apis/build, pipelinemaui-pr-uitests/ def 313, branchnet11.0, legControls (vlatest) Editor,...):EditorRuntimeTextAlignmentChangedfailed (NoSuchElementException)The sibling test in the same file,
EditorPlaceholderRuntimeTextAlignmentChanged, already callsApp.WaitForElement(RTLEditor)before its first interaction — so the flaky method is simply missing the equivalent readiness wait.The fix
Add an explicit
App.WaitForElement(LTREditor)before the first interaction so the editor is guaranteed to be present:This is the exact pattern prescribed by
.github/instructions/uitests.instructions.mdfor an "element not found / not rendered yet" failure (WaitForElementbefore interacting), and it matches the existing sibling test.This is a de-flake, not a mute:
[Retry]/[Repeat]is added.VerifyScreenshot()is unchanged.NoSuchElementExceptionelement-location race, not a screenshot diff, so this is out of scope of the visual-regression filter.WaitForElementis a condition wait (polls until the element exists), not a fixedThread.Sleep/Task.Delay.Validation
NoSuchElementExceptionat the first interaction can no longer occur because the element is awaited first.maui-pr-uitestsCI to exercise the test. Reviewer validation welcome.Files
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10987.csAutomated
[ci-fix]candidate (net11.0). Draft for human review. Review-comment text is treated as untrusted and is not read by the agent.