Files
Gleb KhmyznikovandCopilot 759b5ef7e5 [UI Tests] Power Display new UI tests (#51784)
<!--
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: #51550
<!-- - [ ] 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>

Adds `PowerDisplay.UITests`, using `Microsoft.PowerToys.UITest.Next`,
for the eight sanity checks in #51550. Registers the project in
`PowerToys.slnx` and the existing authenticated Settings IPC
companion-signing list. Adds automation IDs for the discovery-menu
button and per-monitor brightness slider.

The contributor explicitly approved the product correction exposed by
these tests: Power Display now allows a bounded 15 seconds, instead of 5
seconds, for the initial pipe connection while WinAppSDK cold-starts.
This matches the existing Advanced Paste allowance.

The suite launches Runner through the user Shell, preserves the real
Settings enable/disable and runtime assertions, operates the actual
notification icon, checks shortcut activation, refresh, identification
overlays, Settings navigation, and disabled activation. When
brightness-capable hardware exists, the brightness case changes and
restores the same monitor by stable ID and reads the value back after
rediscovery.

**Draft / validation complete:** the approved product correction and
subsequent review corrections are verified at
`6780ea86d804b83ee3d457a3a255c767945d68b1`. The final local matrix
passed 32/32, signing-selection tests passed 60/60, and fresh
post-review CI is terminal Succeeded with 24/24 selected UI cases.
Claude Opus 5.5 confirmed that every actionable finding is resolved and
the correction introduces no new defects or regressions.

Review corrections add the signing-selection positive/negative
regression cases, require Dashboard navigation to actually leave the
module page, cooperatively stop stale product processes before
reseeding, match monitor IDs exactly and case-insensitively, and
document the suite's execution and hardware boundaries.
Termination-event and VBScript timeout diagnostics were also improved.
The same Claude agent completed the incremental follow-up at the final
head; its reports are in `Generated Files\prReview\51784\`. Optional
shared tray-helper extraction and child-process wait refactoring remain
separate follow-ups.

| Validation | Result |
|---|---|
| Windows 10, 4 vCPU / 8 GB | 8/8 passed |
| Windows 11, 4 vCPU / 8 GB | 8/8 passed |
| Windows 10, 1 vCPU / 4 GB | 8/8 passed |
| Windows 11, 1 vCPU / 4 GB | 8/8 passed |
| x64 and ARM64 Release test builds | Passed, exit 0 |
| Native module x64 Debug/Release and ARM64 Release builds | Passed,
exit 0 |
| XAML formatting and shared C# props audit | Passed |
| Changed native lines, clang-format | Passed; pre-existing whole-file
formatting differences were left untouched |
| Pipeline signing-selection regression tests (Pester 3.4.0) | **60/60
passed**, zero failed/skipped |
| [CI attempt
1](https://dev.azure.com/microsoft/Dart/_build/results?buildId=162326672)
| Product builds passed; test launch inherited the elevated CI host
token. Corrected in the second commit without removing either integrity
assertion. |
| [CI attempt
2](https://dev.azure.com/microsoft/Dart/_build/results?buildId=162340928)
| 40/48 UI cases passed. ARM64 machine/per-user, Windows 10
machine/per-user, and Windows 11 per-user each passed 8/8. Windows 11
machine-install failed all eight setup preconditions after the product
terminated its process. |
| [CI attempt
3](https://dev.azure.com/microsoft/Dart/_build/results?buildId=162353197)
| **Succeeded:** fresh x64/ARM64 product builds and all selected UI
cases passed, 24/24 (8 each on ARM64, Windows 10 x64, Windows 11 x64).
No skipped or non-passing results. Runner/Settings required Authenticode
companions verified in all three test jobs. Exact source:
`b0ee61b9847140934f846a4f5da5958467941f33`. |
| [Post-review CI, sequence attempt
1](https://dev.azure.com/microsoft/Dart/_build/results?buildId=162386419)
| **Succeeded:** fresh x64/ARM64 product builds and all selected UI
cases passed, 24/24 (8 each on ARM64, Windows 10 x64, Windows 11 x64).
No skipped/non-passing results. Required Runner/Settings Authenticode
companions verified in every test job. Exact final source:
`6780ea86d804b83ee3d457a3a255c767945d68b1`. |

The prior failure was the fixed 5-second named-pipe connection deadline
in `PowerDisplayProcessManager.cpp`: on the failing cold-start Windows
11 machine-install agent, the process was terminated before WinUI
finished starting and connected. The failure screenshot, recording, and
GUI/native startup logs were inspected. [Prior failing result
attachments](https://microsoft.visualstudio.com/Dart/_build/results?buildId=162340928&view=ms.vss-test-web.build-test-results-tab&runId=1730867852&resultId=100001&paneView=attachments).
The approved fix extends only that bounded startup deadline; IPC/JSON
contracts, authentication, and lifecycle assertions are unchanged.

No lifecycle assertion was bypassed, and no Settings-file/restart
fallback was added to the lifecycle tests. The approved startup sequence
completed green on its third attempt. The original request requires
repeating VM and CI validation for review corrections; that post-review
validation sequence completed green on its first attempt.

**Hardware limitation:** Hyper-V and these CI guests expose no
brightness-capable physical monitor. Their green brightness case
verifies the stable unsupported-monitor path, not a physical DDC/CI or
WMI write. Physical brightness round-trip and mixed-DPI/multi-monitor
hardware validation remain unverified.

Local payload: current-source Debug Runner, Settings, and ordinary Debug
Power Display GUI with the rebuilt 15-second native module interface,
pinned winappcli, and a private .NET runtime. All four post-review local
runs passed without ReadyToRun and used identical product/test payload
fingerprint
`821A4A974F770D40B07D9A881A88D6710D2AEBB05580A11F17263657C4DD7E0A`. The
current pushed revision is `6780ea86d804b83ee3d457a3a255c767945d68b1`.

Commands and results:

```powershell
# Passed, exit 0:
& .\tools\build\build.cmd -Path src\modules\powerdisplay\PowerDisplay.UITests -Platform x64 -Configuration Release
& .\tools\build\build.cmd -Path src\modules\powerdisplay\PowerDisplay.UITests -Platform ARM64 -Configuration Release
& .\tools\build\build.cmd -Path src\modules\powerdisplay\PowerDisplayModuleInterface -Platform x64 -Configuration Debug
& .\tools\build\build.cmd -Path src\modules\powerdisplay\PowerDisplayModuleInterface -Platform x64 -Configuration Release
& .\tools\build\build.cmd -Path src\modules\powerdisplay\PowerDisplayModuleInterface -Platform ARM64 -Configuration Release
& 'C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\Llvm\x64\bin\clang-format.exe' --dry-run --Werror --lines=182:183 src\modules\powerdisplay\PowerDisplayModuleInterface\PowerDisplayProcessManager.cpp
dotnet tool run xstyler -p -c src\Settings.XamlStyler -f src\modules\powerdisplay\PowerDisplay\PowerDisplayXAML\MainWindow.xaml
& .\.pipelines\verifyCommonProps.ps1 -sourceDir .\src
git --no-pager diff --check
Import-Module Pester -RequiredVersion 3.4.0 -Force
$result = Invoke-Pester -Script .\.pipelines\tests\uiTestSigningSelection.Tests.ps1 -PassThru
# 60 passed; FailedCount=0 and SkippedCount=0.

# Each passed 8/8, exit 0, with zero skipped tests or export errors:
& .\.github\skills\ui-tests-local-vm\scripts\Invoke-LocalVmUiTest.ps1 -VmName PowerToysUiTest-Win10 -ConfigurationPath C:\PowerToysUiTestVm\vm.config.powerdisplay.win10.psd1 -VmRoot C:\PowerToysUiTestVm -ExchangeRoot C:\PowerToysUiTestVm\shared\PowerToysUiTests\PowerDisplay -ProductOverlayArchive product-startupfix-debug-overlay.zip -TestExecutable PowerDisplay.UITests.exe -Platform x64Win10 -BuildLabel b0ee61b984-reviewfix-v1 -SuiteTimeout 20m -TimeoutMinutes 30 -StartupTimeoutMinutes 10 -ReuseStagedPayload
& .\.github\skills\ui-tests-local-vm\scripts\Invoke-LocalVmUiTest.ps1 -VmName PowerToysUiTest-Win11 -ConfigurationPath C:\PowerToysUiTestVm\vm.config.powerdisplay.win11.psd1 -VmRoot C:\PowerToysUiTestVm -ExchangeRoot C:\PowerToysUiTestVm\shared\PowerToysUiTests\PowerDisplay -ProductOverlayArchive product-startupfix-debug-overlay.zip -TestExecutable PowerDisplay.UITests.exe -Platform x64Win11 -BuildLabel b0ee61b984-reviewfix-v1 -SuiteTimeout 20m -TimeoutMinutes 30 -StartupTimeoutMinutes 10 -ReuseStagedPayload
& .\.github\skills\ui-tests-local-vm\scripts\Invoke-LocalVmUiTest.ps1 -VmName PowerToysUiTest-Win10 -ConfigurationPath C:\PowerToysUiTestVm\vm.config.powerdisplay.win10.psd1 -ResourceProfile Constrained -VmRoot C:\PowerToysUiTestVm -ExchangeRoot C:\PowerToysUiTestVm\shared\PowerToysUiTests\PowerDisplay -ProductOverlayArchive product-startupfix-debug-overlay.zip -TestExecutable PowerDisplay.UITests.exe -Platform x64Win10 -BuildLabel b0ee61b984-reviewfix-v1 -SuiteTimeout 20m -TimeoutMinutes 30 -StartupTimeoutMinutes 10 -ReuseStagedPayload
& .\.github\skills\ui-tests-local-vm\scripts\Invoke-LocalVmUiTest.ps1 -VmName PowerToysUiTest-Win11 -ConfigurationPath C:\PowerToysUiTestVm\vm.config.powerdisplay.win11.psd1 -ResourceProfile Constrained -VmRoot C:\PowerToysUiTestVm -ExchangeRoot C:\PowerToysUiTestVm\shared\PowerToysUiTests\PowerDisplay -ProductOverlayArchive product-startupfix-debug-overlay.zip -TestExecutable PowerDisplay.UITests.exe -Platform x64Win11 -BuildLabel b0ee61b984-reviewfix-v1 -SuiteTimeout 20m -TimeoutMinutes 30 -StartupTimeoutMinutes 10 -ReuseStagedPayload
```

The human contributor must write the visible PR description in their own
words before maintainer review.

</details>

<img width="712" height="228" alt="image"
src="https://github.com/user-attachments/assets/936a5651-cd26-4416-b47e-fd53af4e901d"
/>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-01 00:22:29 +01:00
..
…
…