ui-tests-migration
PowerToys UI-Tests Migration (legacy → .Next)
Legacy retirement:mainno longer containssrc/common/UITestAutomationor its test
projects. Use the existing .Next suites and Scenario B for current development. Scenario Aand the legacy comparisons in this skill are historical guidance for older branches; do not
restore the retired framework or tests. Existing .Next project names remain unchanged.Convert a PowerToys module's UI tests from the legacy WinAppDriver / Selenium / Appium harness
(Microsoft.PowerToys.UITest, in src/common/UITestAutomation/) to the new winappcli harness
(Microsoft.PowerToys.UITest.Next, in src/common/UITestAutomation.Next/).
The new harness shells out to winapp.exe and parses its JSON — **no WinAppDriver server on :4723,
no Selenium/Appium NuGet packages, no WindowsElement/WindowsDriver.** The public *shape*
(UITestBase, Session, Find<T>, By, element wrappers like ToggleSwitch) is deliberately
similar, so most of the work is mechanical API mapping plus reworking a few patterns that don't
translate one-to-one (XPath selectors, stateful elements, instance mouse/keyboard helpers).
When to use this skill
Use this skill when the task is to:
- Port a module's existing legacy UI tests to
.Next(e.g. "migrate the ScreenRuler UI tests to
the new framework", "convert FancyZones.UITests to winappcli").
- Create a new
[Module].UITests.Nextproject that re-implements the legacy tests with the new
harness, leaving the old project in place.
- Stand up brand-new
.NextUI tests for a module that has no UI tests at all, by reading the
module's human test sign-off markdown (e.g. ColorPickerUITest.md) and turning each manual
checklist item into an automated test.
- Validate a new or migrated suite in a local Windows VM through an unattended
build/package/deploy/run/TRX/diagnose loop. Use a retained VM for fast iteration and a restored
baseline checkpoint when clean-profile behavior matters.
This skill is the *how*: the framework differences, the API mapping, the project scaffolding, the
naming rules, the recurring PowerToys test recipes, and the build/validate loop. The *what* (which
module, which tests) comes from the calling prompt.
End-to-end completion contract
A request to create, migrate, or stabilize UI tests includes the complete delivery loop:
implement -> build -> full local VM matrix -> commit and push -> scoped CI -> terminal results.
Local success is a handoff, not completion. After the full default and constrained suites pass,
invoke ui-tests-pipeline-ci automatically; do not wait for a
separate "push" or "run CI" request. Keep commit/push and CI validation as open TODOs from the start.
Respect an explicit local-only/no-push/no-CI request. A read-only investigation, VM setup, or request
to run an existing suite locally does not authorize publishing changes. CI remains Microsoft
FTE-only and requires the pipeline skill's successful access preflight; report an exact blocker
when unavailable, never call local-only evidence CI-validated. The pipeline skill owns publication,
queueing, synchronous waiting, and the three-run stabilization limit.
Reference implementation — read these working examples before porting anything. They are
the ground truth for "what good looks like" with each harness:
- New (.Next): ColorPickerEndToEndTests.cs— full end-to-end scenario (navigate Settings → toggle module → read shortcut → fire hotkey →
read overlay → click-capture → inspect editor), driven entirely through winappcli.- Worked Scenario-A port (validated 5/5): the
ScreenRuler suite ported from the retired legacy project lives in
ScreenRuler.UITests.Next/TestHelper.cs
+ 5 test classes. It is the canonical port reference — cross-window toolbar discovery via
Session.FromProcess, a DPI-awareapp.manifest, cursor centering, and patient hotkey
activation are all there because real runs needed them (see
references/patterns-and-pitfalls.md).
- Stateful/visual reference (validated 15/15 across Win10 x64, Win11 x64, and ARM64):
PeekFilePreviewTests.cs
demonstrates stable Explorer Shell selection, toggle-hotkey activation, process-preserving
pinning tests, renderer readiness, and composed WinUI/WebView visual baselines.
- Explorer/Shell-extension reference (validated across x64 and ARM64 CI):
FileExplorerAddonsTests.cs
demonstrates class-scoped runner reuse, one-time Shell restart, state-aware Preview pane
activation, exact Shell selection, deterministic icon sizes, provider-log readiness, and
failure media captured before Explorer teardown. Read
references/explorer-shell-tests.md before testing Explorer.
Required reads (in order)
- This
SKILL.md— the decision tree (which scenario), the naming rules, the high-level
workflow, and the build/validate
