Files
Gleb KhmyznikovandCopilot 13669b7fb1 [UI Tests] Power Display driver backed tests (#51855)
<!--
HARD RULE: You (the human contributor) must write this PR description in
your own words.
AI tools and agents: Do NOT write the Summary, Detailed Description, or
Validation Steps sections.
Leave them for the human. You may put AI-generated text ONLY inside an
"AI-generated summary" <details> block at the bottom.
Maintainers will close PRs whose description they think was not written
by a human.
See
https://github.com/microsoft/PowerToys/blob/main/CONTRIBUTING.md#pull-request-descriptions-must-be-written-by-a-human
-->

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #51800
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

<details>
<summary>AI-generated summary</summary>

Test-only UMDF/IddCx virtual monitors for Power Display, with
independently observed native DDC/CI brightness, hot-plug controls,
unsupported-capability and communication-failure modes, five new UI
scenarios, and an isolated ARM64 CI lane. No shipping product or
installer changes and no boot-policy changes. Reproduction and cleanup
instructions: `.pipelines/powerdisplay-idd-poc/README.txt`.

Claude Opus 5.5 completed `.github/prompts/review-pr.prompt.md`: 0 high,
4 medium, 10 low and 2 informational findings. Relevant findings were
addressed in `2273b0093daa0fefa0f176141d870c8035c45dcf`: stronger
discovery/debounced-persistence assertions, session/stale-element
handling, adapter readiness and native I2C error semantics, 27
ownership/preflight safety tests, licensing, verified package-cache
reuse, fixture-only suite selection and documentation.

The unsupported-card visibility suggestion was not adopted: existing
production discovery intentionally ignores monitors without capability
evidence. The test instead requires the exact healthy monitor and actual
re-read capabilities callbacks. The complete production-probe artifact
is retained for documented manual diagnostics; duplicate SDK/WDK
downloads were addressed without adding driver-only build switches.

Post-review validation at `2273b0093daa0fefa0f176141d870c8035c45dcf`:

- `tools\build\build.cmd -Path
src\modules\powerdisplay\PowerDisplay.UITests -Platform x64
-Configuration Release` - PASS.
- `tools\build\build.cmd -Path
src\modules\powerdisplay\PowerDisplay.UITests -Platform ARM64
-Configuration Release` - PASS.
- `.pipelines\powerdisplay-idd-poc\Build-Poc.ps1 -WorkRoot
C:\PowerToysUiTestVm\tools\display-idd-poc -OutputRoot
C:\PowerToysUiTestVm\payload-staging\display-idd-review-51855
-PackageCache C:\PowerToysUiTestVm\tools\display-idd-poc\packages
-Platform x64` - PASS, including signing/catalog generation.
- The same native build command with `-Platform ARM64` - PASS, including
signing/catalog generation.
- `Invoke-Pester -Script $tests.FullName -ExcludeTag NativeCompiler
-PassThru -Quiet`, with the complete selection from
`.pipelines/v2/templates/steps-test-mwb-infrastructure.yml` - 898/898
locally; 898/898 per CI architecture, 1796 total. Zero failed/skipped.
- Full unfiltered local matrix through `Invoke-LocalVmUiTest.ps1` -
13/13 each on Windows 10/11 Default (actual 4 CPU/8 GB) and Constrained
(actual 1 CPU/4 GB); 52 passes, zero skips/export errors. Local product
payload was the existing managed/ReadyToRun overlay, not a claim of a
fresh full-product source build.
- Fresh scoped `buildNow` [CI build
162600848](https://dev.azure.com/microsoft/c93e867a-8815-43c1-92c4-e7dd5404f1e1/_build/results?buildId=162600848)
- succeeded on attempt 1 at the exact pushed SHA; source-built Release
x64/ARM64 product and 13/13 each on Windows 10 x64, Windows 11 x64 and
isolated Windows 11 ARM64 (39 UI passes, zero non-passing results).
- All three driver evidence artifacts verified: newly owned INF
binding/version, PnP problem 0, both initial arrivals, protocol version
2 with 31 executed self-test assertions, and successful owned cleanup.
Release Runner/Settings companion signatures and trust-cleanup steps
verified on all jobs. ARM64 uses the preconfigured Secure Boot off /
TESTSIGNING image; no script changes that policy.
- Local owned driver/packages and journaled trust were removed, both
owned baselines restored, both VMs stopped, and host signing keys
removed. Worktree clean.

An initial local tray failure was an unrelated OneDrive backup
advertisement covering the icon, confirmed by screenshot/video; stopping
that guest standard user's OneDrive process in the session-only wrapper
allowed the unchanged test and complete matrix to pass. A planned
Windows Update restart interrupted Win11 startup before provisioning;
validation resumed after the desktop recovered. Neither required
repository test or product changes.

### Shared UMDF pipeline infrastructure

The subsequently approved unification is committed and pushed as
`ae28d77bfd482675f5640d086bf2aecfabcccfcb`.

- `.pipelines/umdf/UmdfBuild.Common.ps1` shares pinned
checkout/patching, verified SDK/WDK acquisition, neutral versioned
dependency caching, signing/catalog generation, hashes and managed
output discovery. Both original build entry points and artifact layouts
remain.
- `.pipelines/umdf/UmdfCi.Common.ps1` shares fixture metadata,
setup/cleanup, environment restoration and emergency recovery. The
legacy HID selector/environment entry points remain compatibility
wrappers.
- `.pipelines/umdf/UmdfDriver.Common.ps1` shares atomic journals,
validated ownership, hashes/public certificates, signatures, trust and
diagnostic/removal primitives. Managers retain their existing journal
fields, distinct hardware IDs/subjects, approval gates, readiness
criteria and opposite device/package cleanup ordering. HID now retains
journal-owned trust when removal fails instead of removing trust
prematurely.
- Compile-time ARM64 routing and evidence publishing are shared without
merging fixture jobs or admitting ordinary suites to the TESTSIGNING
image. Shared-helper changes select both suites. Both managers and their
staged shared-helper deployment are documented.

Validation at the exact unification SHA:

- `tools\build\build.cmd -Path
src\modules\GrabAndMove\Tests\GrabAndMove.UITests -Platform x64
-Configuration Release` and the same command with `-Platform ARM64` -
PASS.
- `tools\build\build.cmd -Path
src\modules\powerdisplay\PowerDisplay.UITests -Platform x64
-Configuration Release` and the same command with `-Platform ARM64` -
PASS.
- `.pipelines\umdf-hid-smoke\Build-Smoke.ps1 -WorkRoot
C:\PowerToysUiTestVm\tools\umdf-unify-hid -OutputRoot
C:\PowerToysUiTestVm\payload-staging\umdf-unify-51855\umdf-hid
-Platforms x64 -PackageCache
C:\PowerToysUiTestVm\tools\display-idd-poc\packages -DriverOnly` and the
same command with `-Platforms ARM64` - PASS, including signing/catalog
generation.
- `.pipelines\powerdisplay-idd-poc\Build-Poc.ps1 -WorkRoot
C:\PowerToysUiTestVm\tools\display-idd-poc -OutputRoot
C:\PowerToysUiTestVm\payload-staging\umdf-unify-51855\powerdisplay-idd
-Platform x64 -PackageCache
C:\PowerToysUiTestVm\tools\display-idd-poc\packages` and the same
command with `-Platform ARM64` - PASS.
- `Invoke-Pester -Script $tests.FullName -ExcludeTag NativeCompiler
-PassThru -Quiet`, using the full updated CI selection from
`steps-test-mwb-infrastructure.yml` - 916/916 locally and 916/916 on
each CI build architecture (1832 total).
- Eight full, unfiltered local VM runs - Grab and Move 7/7 and Power
Display 13/13 on each Win10/Win11 Default (4 CPU/8 GB) and Constrained
(1 CPU/4 GB) profile. Total 80/80, no skips/export errors; per-suite
driver cleanup verified.
- The archived Settings XBF lacked the current Grab and Move
exclusion-control automation ID. `tools\build\build.cmd -Path
src\settings-ui\Settings.UI -Platform x64 -Configuration Release` -
PASS; refreshing only Settings and its dependencies/assets made the
unchanged exclusion test pass. The final local matrix used that current
Settings build with the existing managed/ReadyToRun module overlay, not
a fresh full-product claim. No product or C# UI-test source changes were
made.
- Expanded YAML preview verified six jobs: two builds, two x64
combined-suite jobs and two one-suite ARM64 jobs. Fresh scoped
`buildNow` [CI build
162635811](https://dev.azure.com/microsoft/Dart/_build/results?buildId=162635811)
succeeded on attempt 2 at the unchanged SHA: Win10 x64 20/20, Win11 x64
20/20, ARM64 HID 7/7 and ARM64 Display 13/13. All 60 UI results passed.
- Attempt 1,
[162625157](https://dev.azure.com/microsoft/Dart/_build/results?buildId=162625157),
was 59/60 due solely to an unchanged ARM64 HID foreground-handoff
assertion. Screenshot, recording, console and driver evidence were
inspected: native move/resize and binding succeeded, owned cleanup
passed. The full same-SHA rerun passed without weakening or editing
assertions.
- All six final fixture evidence artifacts verified: architecture/image
policy, PnP problem 0, HID's three children, Display's newly owned
INF/version and both monitors, 31 protocol assertions, and owned
cleanup. Required Release Runner/Settings signing and trust cleanup
verified in all four test jobs.
- Both local baselines restored, VMs stopped, only owned checkpoints
removed, and owned host signing key/trust absent. Local, remote, PR and
validated CI revisions match.

This proves emulated Windows/HID/DDC/CI integration, not physical-panel
backlight behavior, WMI hardware control or physical mixed-DPI signoff.
The PR intentionally remains a draft; the human contributor must write
the visible prose sections before maintainer review.

### Foreground-flake investigation and stabilization

The earlier unchanged-SHA retry was evidence of an intermittent failure,
not a stability fix. The test-only fix is committed and pushed as
`4647cc2ea693931df0300dfbf5e13e5ce4850118`.

The old modifier test required the exact Settings HWND to own foreground
before sending End/Enter. It now expands and selects the real WinUI
control through coordinate-free UIA, searches the exact Settings PID's
popup trees, deduplicates identical list-item selectors, and checks both
selected UI text and persisted modifier value. The original real-HID
Windows/Alt move, resize, negative behavior, exact geometry and
unchanged-process assertions remain. The unused cross-process
foreground-transfer helper was removed.

The historical ARM64 `GetForegroundWindow()==0` cause was not
reproduced: a controlled delayed-activation probe passed with the old
helper. This fix removes an unnecessary foreground dependency from
settings selection; it does not claim to repair Windows foreground
activation generally.

Repeated testing exposed two additional test-side failure modes, both
addressed before final sign-off:

- A cached ComboBox selector became stale after selecting Windows key
rebuilt the Alt-only settings cards. Each read now reacquires the
control and retries only known stale-element failures. The captured
error JSON-escapes apostrophes, so the narrow RuntimeId classifier uses
unescaped ASCII message fragments. Five probes of the actual compiled
classifier, including unrelated-assertion and other-exception negative
controls, passed.
- On the one-CPU Win11 profile, the UI showed the correct selected value
but three fresh observations did not fit into ten seconds. Logs showed
individual search/get-value calls taking 4.440s and 2.601s; screenshot
and recording confirmed successful selection. The three-observation
assertion is retained, with a 30-second bounded budget and explicit
stable-sample diagnostics.

The new `ModifierSelectionWorksWhileFixtureOwnsForeground` regression
alternates ten real UIA selections, requiring fixture foreground before
each, unchanged pointer position, correct selected/persisted values and
stable module PID.

Final-source local evidence (earlier failed/paused source series are
excluded):

| Guest/profile | Fresh focused processes | Focused cases | Full-suite
cases |
|---|---:|---:|---:|
| Win10 Default, actual 4 CPU / 8 GB | 10 | 20/20 | 8/8 |
| Win10 Constrained, actual 1 CPU / 4 GB | 10 | 20/20 | 8/8 |
| Win11 Default, actual 4 CPU / 8 GB | 10 | 20/20 | 8/8 |
| Win11 Constrained, actual 1 CPU / 4 GB | 10 | 20/20 | 8/8 |

Total: 40 fresh focused processes, 80/80 focused cases, **400
alternating selections counted from regression TRX**, plus 32/32
full-suite cases. Zero skipped/non-executed cases or export errors. All
requests used test archive SHA-256
`34A776AAA2245BCB57D2275E2CDEB13F88BAD9E2E41F685869FE66D85109491C`; the
three source-file hashes were checked against the published revision.
Local product payload remains the previously described
managed/ReadyToRun overlay with current-source Settings, not a claim of
a fresh full-product local build.

Validation commands and results:

- From `src\modules\GrabAndMove\Tests\GrabAndMove.UITests`,
`C:\Develop\GitHub\PowerToys\tools\build\build.cmd -Platform x64
-Configuration Release` - PASS, including StyleCop.
- From the same directory,
`C:\Develop\GitHub\PowerToys\tools\build\build.cmd -Platform ARM64
-Configuration Release` - PASS, including StyleCop.
- `git diff --check` - PASS.

The session-only `$script` below is `Run-GamFocusValidation.ps1`, a
wrapper around the repository's `Invoke-LocalVmUiTest.ps1`; no
validation wrapper was added to the repository. `$filter` is
`Name~ChangingModifierToWinUpdatesMoveAndResizeWithoutRestart|Name~ModifierSelectionWorksWhileFixtureOwnsForeground`.

```powershell
& $script -BuildLabel gam-focus-stable-full-win10-default -OperatingSystems Win10 -Profiles Default -ExpectedCases 8
# PASS 8/8
& $script -BuildLabel gam-focus-stable-full-win10-constrained -OperatingSystems Win10 -Profiles Constrained -ExpectedCases 8
# PASS 8/8
& $script -BuildLabel gam-focus-stable-full-win11-default -OperatingSystems Win11 -Profiles Default -ExpectedCases 8
# PASS 8/8
& $script -BuildLabel gam-focus-stable-full-win11-constrained -OperatingSystems Win11 -Profiles Constrained -ExpectedCases 8
# PASS 8/8
& $script -BuildLabel gam-focus-stable-repeat-win10-default -OperatingSystems Win10 -Profiles Default -Filter $filter -Repetitions 10 -ExpectedCases 2
# PASS 20/20
& $script -BuildLabel gam-focus-stable-repeat-win10-constrained -OperatingSystems Win10 -Profiles Constrained -Filter $filter -Repetitions 10 -ExpectedCases 2
# PASS 20/20
& $script -BuildLabel gam-focus-stable-repeat-win11-default -OperatingSystems Win11 -Profiles Default -Filter $filter -Repetitions 10 -ExpectedCases 2
# PASS 20/20
& $script -BuildLabel gam-focus-stable-repeat-win11-constrained -OperatingSystems Win11 -Profiles Constrained -Filter $filter -Repetitions 10 -ExpectedCases 2
# PASS 20/20
```

Fresh scoped `buildNow` [CI
162664091](https://dev.azure.com/microsoft/Dart/_build/results?buildId=162664091)
succeeded on **attempt 1** at the exact fix SHA. Both source-built
Release architectures and all five jobs passed: Win10 x64 8/8, Win11 x64
8/8, isolated Win11 ARM64 8/8, and infrastructure 916/916 per build
architecture (1832 total). Both exact modifier scenarios were
individually verified in all three UI runs. All three native
readiness/owned-cleanup artifacts and Runner/Settings
companion-signing/trust-cleanup steps were verified.

ARM64 evidence is one full-suite process including ten regression
selections, not multiple fresh focused ARM64 processes. This is bounded
stability evidence, not proof that no future flake is possible.

All eight final local HID provisioning/cleanup evidence sets were
exported and verified. Both local baselines were restored, VMs stopped,
only the exact owned GAM checkpoints removed, and journal-owned
driver/companion trust removed. The host companion signing key/trust is
absent. The PR remains a draft; visible prose sections are intentionally
left for the human contributor to write in their own words.
</details>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-04 07:32:54 +00:00
..
…
…
…
…

PowerToys Modules

This section contains documentation for individual PowerToys modules, including their architecture, implementation details, and debugging tools.

Available Modules

Module Description
Advanced Paste Tool for enhanced clipboard pasting with formatting options
Always on Top Tool for pinning windows to stay on top of other windows
Awake Tool to keep your computer awake without modifying power settings
Color Picker Tool for selecting and managing colors from the screen
Command Not Found Tool suggesting package installations for missing commands
Crop and Lock Tool for cropping application windows into smaller windows or thumbnails
Environment Variables Tool for managing user and system environment variables
FancyZones (debugging tools) Window manager utility for custom window layouts
File Explorer add-ons Extensions for enhancing Windows File Explorer functionality
File Locksmith Tool for finding processes that lock files
Grab and Move Modifier-drag window moving/resizing, including driver-backed local UI testing
Hosts File Editor Tool for managing the system hosts file
Image Resizer Tool for quickly resizing images within File Explorer
Keyboard Manager Tool for remapping keys and keyboard shortcuts
Mouse Utilities Collection of tools to enhance mouse and cursor functionality
Mouse Without Borders Tool for controlling multiple computers with a single mouse and keyboard
NewPlus Context menu extension for creating new files in File Explorer
Peek File preview utility for quick file content viewing
Power Rename Bulk file renaming tool with search and replace functionality
PowerToys Run (deprecation soon) Quick application launcher and search utility
Quick Accent Tool for quickly inserting accented characters and special symbols
Registry Preview Tool for visualizing and editing Registry files
Screen Ruler Tool for measuring pixel distances and color boundaries on screen
Shortcut Guide Tool for displaying Windows keyboard shortcuts when holding the Windows key
Text Extractor Tool for extracting text from images and screenshots
Window Hopper (Alt Window Cycle) Tool for cycling between windows of the focused application
Workspaces Tool for saving and restoring window layouts for different projects
ZoomIt Screen zoom and annotation tool

Adding New Module Documentation

When adding documentation for a new module:

  1. Create a dedicated markdown file for the module (e.g., modulename.md)
  2. If the module has specialized debugging tools, consider creating a separate tools document (e.g., modulename-tools.md)
  3. Update this index with links to the new documentation
  4. Follow the existing documentation structure for consistency