Skip to content

MUX runtime-test input helpers (click, tap injection, keyboard) don't work on the WinAppSDK leg #25012

Open

Description

@MartinZikmund

Current behavior 🐛

The shared input helpers used by the MUX-imported runtime tests do not work when the runtime tests run against native WinUI (the WINAPPSDK / !HAS_UNO build). Tests that use them either fail, hang the whole run, or have to be excluded with RuntimeTestPlatforms.NativeWinUI, so WinUI parity for those scenarios is not verified on the WinAppSDK CI leg.

There are four independent problems (all confirmed by code inspection on master @ bfc8dffd7f; the first three were also observed in local WinAppSDK runs):

  1. ControlHelper.DoClickUsingAP detaches Click off the UI thread. The using var _ = Disposable.Create(() => button.Click -= ...) runs after await clickEvent.Task, i.e. on a non-UI continuation. On WinUI, ButtonBase.remove_Click throws COMException 0x8001010E (RPC_E_WRONG_THREAD). ControlHelper.cs#L43-L64. DoClickUsingTap (L20-L40) has the same pattern.
  2. DoClickUsingTap / DoClickUsingAP wait on the Click TaskCompletionSource with no timeout. When the injected tap never produces a Click on WinUI, the test hangs until the runner kills the process, and no results file is written for the entire shard ("Test results file was not created within 600 seconds").
  3. Finger.At (!HAS_UNO) scales the window origin a second time. GetWindowRect already returns physical pixels, but the code computes (rect.Left + x) * scale, so the origin is multiplied by the rasterization scale again. With a window not at (0,0) on a display above 100%, the injected touch lands in the wrong place, which is a likely reason the tap in (2) never clicks. Finger.cs#L168-L183. The same formula is in Mouse.ToNormalizedScreenCoordinates (Mouse.cs#L390-L397).
  4. TestServices.KeyboardHelper.PressKeySequence is compiled out under WINAPPSDK (#if !WINAPPSDK body, so it silently does nothing). TestServices.KeyboardHelper.cs#L134-L136. Every KeyboardHelper method built on it (Down, Up, Tab, Enter, ...) is a no-op on native WinUI.

Expected behavior 🎯

The helpers behave the same on native WinUI as in Uno, so the MUX-imported tests can run on the WinAppSDK leg and validate parity:

  • Event handlers are detached on the UI thread (e.g. inside RunOnUIThread.ExecuteAsync).
  • Click waits have a timeout, so a missing click fails one test instead of killing the shard.
  • Finger.At / Mouse use rect.Left + x * scale (origin physical, offset scaled once).
  • PressKeySequence has a WinUI implementation (e.g. InputInjector keyboard injection), or tests that need it are explicitly excluded.

How to reproduce it 🔬

  1. Check out master. On Windows, set the display scale to e.g. 150%.
  2. Run the runtime tests against native WinUI (the WinAppSDK SamplesApp flow), filtered to a test that uses the helpers, e.g. DatePickerIntegrationTests.CanChooseDate or DatePickerShouldMaintainTime, after removing its NativeWinUI exclusion.
  3. Observe: CanChooseDate / SelectingDateSetsSelectedDate fail with COMException (0x8001010E) ... ButtonBase.remove_Click ... ControlHelper.DoClickUsingAP; DatePickerShouldMaintainTime hangs in DoClickUsingTap until the 600 s timeout and the whole run produces no results file.

Workaround

Tests that depend on the helpers are excluded with [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeWinUI)].

Works on UWP/WinUI

N/A - this is test infrastructure for the WinUI parity leg.

Impact

About 14 runtime test files call DoClickUsingAP / DoClickUsingTap / ClickFlyoutCloseButton / InputHelper.Tap, directly or via DateTimePickerHelper, FlyoutHelper and ComboBoxHelper (DatePicker, TimePicker, ComboBox, CalendarView, CalendarDatePicker, CommandBar, AppBar, MenuFlyout, SwipeControl, FocusManager). PressKeySequence is used by about 19 files. Explicit exclusions citing these problems include 3 tests in DatePickerIntegrationTests and Given_FocusManager.When_Tapped_Empty_Space (comment: "focus is not cleared after the injected tap on empty space"; probably the same mis-targeted injected tap from (3), not verified at runtime). Helper-based tests that are not excluded can hang or fail the WinAppSDK leg.

Suggested fix

  • Unsubscribe inside RunOnUIThread.ExecuteAsync.
  • Add a timeout (e.g. Task.WhenAny(clickEvent.Task, Task.Delay(...))) to both click waits and fail with a clear message.
  • Fix Finger.At and Mouse.ToNormalizedScreenCoordinates to rect.Left + x * scale.
  • Provide a WinAppSDK keyboard injection for PressKeySequence.
  • Then drop the NativeWinUI exclusions and re-check.

Environment

  • Master @ bfc8dffd7f; WinAppSDK SamplesApp net10.0-windows10.0.19041.0
  • Originally observed on a local run with a display scale above 100%.

Affected platforms: Windows (native WinUI / WinAppSDK runtime-test leg). Verified by: code inspection on master plus earlier local WinAppSDK runs; no fresh native run for this report.

Activity

  1. added
    kind/bug
    triage/untriaged
    area/tests 🧪
    project/input ⌨️
    difficulty/medium 🤔
    area/winui
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tests 🧪area/winuidifficulty/medium 🤔kind/bugproject/input ⌨️triage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions