Skip to content

test(textbox): De-flake iOS single-tap caret assert (backport #23963) - #25954

Merged
agneszitte merged 1 commit into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-23963
Nov 3, 2026
Merged

agneszitte merged 1 commit into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-23963

Conversation

@mergify

@mergify mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: #9080 (tracking epic — intentionally not auto-closed by this PR)

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

Given_TextBox.When_Touch_SingleTap_Places_Caret_iOS failed the Tests - iOS Skia Runtime Tests 3 shard:

Assert.AreEqual failed. Expected:<ThumblessCaretShowing>. Actual:<ThumblessCaretHidden>.
'expected' expression: 'expectedCaret', 'actual' expression: 'SUT.CaretMode'.
  at Given_TextBox.AssertTouchSingleTapPlacesCaret(TouchTextSelectionConvention, CaretDisplayMode)

ThumblessCaretShowing / ThumblessCaretHidden are the two halves of the caret blink cycle, not two
different outcomes. A 500 ms DispatcherTimer flips between them (TextBox.skia.cs:79, TimerOnTick at
:1504-1517), and Select() restarts that timer on every caret move (:548-555). The test tapped, awaited a
bare WaitForIdle(), then sampled CaretMode exactly once — so any tap→assert gap longer than one blink
period legitimately observes the hidden half and fails. It is the only runtime test that asserted a blinking
mode without a wait.

That gap only opens on the iOS simulator, where focus drives a full native keyboard/IME handshake that
WaitForIdle has to drain (StartImeSession(); the device log shows a keyboard dismiss + show cycle per focus,
UIKeyboardAnimationDuration = 0.25 plus a 0.4 s BSAnimationSettings). Desktop and Android Skia have no
per-focus keyboard cost, which is why the test is green there. On the failing run the shard's agent was
unusually slow — 1 h 4 m vs 29–52 m for the other three iOS shards — and all three in-process retries failed,
so it was reproducible on that agent rather than a one-off.

This waits for the expected mode instead of sampling it:

 			Assert.AreEqual("", SUT.SelectedText);
-			Assert.AreEqual(expectedCaret, SUT.CaretMode);
+			await WindowHelper.WaitFor(
+				() => SUT.CaretMode == expectedCaret,
+				timeoutMS: 3000,
+				message: $"tap should settle the caret in {expectedCaret}");

Notes on the choices:

  • The explicit timeoutMS: 3000 matters — WindowHelper.WaitFor defaults to 1000 ms
    (TestServices.WindowHelper.cs:314), only two blink periods on the one platform that stalls. Line 5072 of
    the same file already passes 3000.
  • Both conventions stay correct: the Android expectation is a thumbed mode, for which the setter stops the
    timer (TextBox.skia.cs:113-117), so it still matches on the first evaluation with no added pumping.
  • Deliberately not relaxed to "either thumbless phase": _caretMode initializes to ThumblessCaretHidden
    (TextBox.skia.cs:55), so that variant would pass vacuously if the tap never registered. Waiting for
    Showing requires focus plus a running timer.
  • Assert.AreEqual("", SUT.SelectedText) is kept ahead of the wait, so a tap ever mis-read as a double-tap
    still fails there with a clear message instead of timing out.
  • No [PlatformCondition] added. Gating this off Skia-UIKit would drop coverage on the very platform whose
    convention the test emulates — worse than the flake it would hide. A genuine focus loss also still fails
    after the timeout with the same symptom (TimerOnTick no-ops when unfocused), so this does not mask a
    regression.

The same wait is applied to AssertTouchGestureOnEmptyBoxOpensFlyout, the one remaining single-shot assert on
a blinking mode. It samples CaretMode after a Task.Delay(1200) and a flyout-open wait — well past one blink
period — and is green today only because its callers are gated to SkiaDesktop | SkiaAndroid, not because the
assert is safe. (The third ThumblessCaret site, AssertTouchTapOnEmptyBoxPlacesCaret, already used
WaitFor.)

Test-only change — no product code touched. The caret is supposed to blink; the test had to tolerate it.

Validation: compile — Uno.UI.RuntimeTests.Skia net10.0, 0 errors / 0 warnings. Runtime — not run locally;
a Skia Desktop run cannot reproduce an iOS-simulator timing flake, so the iOS shards on this PR are the real
gate. Per the investigation this should not be called proven until those shards come back green.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable) — N/A, this hardens two existing runtime-test assertions
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features) — N/A, no user-facing change
  • 🖼️ Validated PR Screenshots Compare Test Run results. — N/A, no rendering change
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

🤖 Generated with Claude Code


This is an automatic backport of pull request #23963 done by [Mergify](https://mergify.com).

When_Touch_SingleTap_Places_Caret_iOS asserted CaretMode exactly once
after a bare WaitForIdle, but ThumblessCaretShowing/Hidden are the two
halves of the caret blink cycle, flipped every 500ms by a DispatcherTimer
that Select() restarts on each caret move. Any tap-to-assert gap longer
than one blink period legitimately leaves the caret hidden, which is what
failed the iOS Skia shard on an unusually slow simulator agent (all three
in-process retries failed there).

Wait for the expected mode instead, with an explicit 3000ms timeout since
WaitFor defaults to 1000ms. The Android expectation is a thumbed mode
that stops the timer, so it still matches on the first evaluation, and a
genuine focus loss still fails after the timeout with the same symptom.

Applies the same wait to AssertTouchGestureOnEmptyBoxOpensFlyout, the one
remaining single-shot assert on a blinking mode; it is green today only
because its callers are gated off Skia-UIKit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 23648ea)
@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Nov 3, 2026
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 243020 did not find any UI Test snapshots differences.

@mergify

mergify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@agneszitte
agneszitte merged commit d3224a7 into release/stable/6.7 Nov 3, 2026
47 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-23963 branch November 3, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants