Repository navigation
test(textbox): De-flake iOS single-tap caret assert (backport #23963) - #25954
Merged
agneszitte merged 1 commit intoNov 3, 2026
Merged
Conversation
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)
4 of 5 tasks
ajpinedam
approved these changes
Nov 3, 2026
Contributor
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
Contributor
|
The build 243020 did not find any UI Test snapshots differences. |
agneszitte
approved these changes
Nov 3, 2026
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. |
1 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_iOSfailed the Tests - iOS Skia Runtime Tests 3 shard:ThumblessCaretShowing/ThumblessCaretHiddenare the two halves of the caret blink cycle, not twodifferent outcomes. A 500 ms
DispatcherTimerflips between them (TextBox.skia.cs:79,TimerOnTickat:1504-1517), andSelect()restarts that timer on every caret move (:548-555). The test tapped, awaited abare
WaitForIdle(), then sampledCaretModeexactly once — so any tap→assert gap longer than one blinkperiod 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
WaitForIdlehas to drain (StartImeSession(); the device log shows a keyboard dismiss + show cycle per focus,UIKeyboardAnimationDuration = 0.25plus a 0.4 sBSAnimationSettings). Desktop and Android Skia have noper-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:
timeoutMS: 3000matters —WindowHelper.WaitFordefaults to 1000 ms(
TestServices.WindowHelper.cs:314), only two blink periods on the one platform that stalls. Line 5072 ofthe same file already passes 3000.
timer (
TextBox.skia.cs:113-117), so it still matches on the first evaluation with no added pumping._caretModeinitializes toThumblessCaretHidden(
TextBox.skia.cs:55), so that variant would pass vacuously if the tap never registered. Waiting forShowingrequires focus plus a running timer.Assert.AreEqual("", SUT.SelectedText)is kept ahead of the wait, so a tap ever mis-read as a double-tapstill fails there with a clear message instead of timing out.
[PlatformCondition]added. Gating this off Skia-UIKit would drop coverage on the very platform whoseconvention the test emulates — worse than the flake it would hide. A genuine focus loss also still fails
after the timeout with the same symptom (
TimerOnTickno-ops when unfocused), so this does not mask aregression.
The same wait is applied to
AssertTouchGestureOnEmptyBoxOpensFlyout, the one remaining single-shot assert ona blinking mode. It samples
CaretModeafter aTask.Delay(1200)and a flyout-open wait — well past one blinkperiod — and is green today only because its callers are gated to
SkiaDesktop | SkiaAndroid, not because theassert is safe. (The third
ThumblessCaretsite,AssertTouchTapOnEmptyBoxPlacesCaret, already usedWaitFor.)Test-only change — no product code touched. The caret is supposed to blink; the test had to tolerate it.
Validation: compile —
Uno.UI.RuntimeTests.Skianet10.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 ✅
Screenshots Compare Test Runresults. — N/A, no rendering change🤖 Generated with Claude Code
This is an automatic backport of pull request #23963 done by [Mergify](https://mergify.com).