Skip to content

[UI Tests] PowerOCR new UI tests - #51933

Merged
Niels Laute (niels9001) merged 6 commits into
mainfrom
gleb/ui-tests-power-ocr
Nov 5, 2026
Merged

Niels Laute (niels9001) merged 6 commits into
mainfrom
gleb/ui-tests-power-ocr

Conversation

@khmyznikov

@khmyznikov Gleb Khmyznikov (khmyznikov) commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Migration of Text Extractor UI tests

PR Checklist

  • 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
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

AI-generated summary

Scope

  • Port all 10 existing PowerOCR UI tests one-for-one to src/modules/PowerOCR/PowerOCR.UITests.Next, using Microsoft.PowerToys.UITest.Next and the repository-pinned winappcli. Leave the legacy suite unchanged; add no test cases.
  • Register the project in PowerToys.slnx, embed a PerMonitorV2 manifest, and update doc/devdocs/modules/textextractor.md.
  • Reuse CI companion signing and non-elevated test dispatch. Provision the English OCR language capabilities required by the existing language-switch tests.
  • Keep multi-monitor coverage manual. No product behavior changes.

Verified results

Test source is included in commit 6c732ac43b9f1000cb381be808c7a206c99fa31f.

Validation Result
x64 and ARM64, Debug and Release builds PASS, exit code 0 for all four builds
Windows 10 VM, default 4-vCPU / 8-GB profile PASS, 10/10
Windows 11 VM, default 4-vCPU / 8-GB profile PASS, 10/10
Windows 10 VM, constrained 1-vCPU / 4-GB profile PASS, 10/10
Windows 11 VM, constrained 1-vCPU / 4-GB profile PASS, 10/10
CI build 162892487 Succeeded; Win10 x64, Win11 x64, and ARM64 each passed all 10 tests

No skipped or other non-passing UI outcomes, and no local evidence-export errors. CI Runner/Settings companion signing was verified in all three test jobs.

Local validation used a prebuilt runtime from source revision 92ec74126257e4cacb2754cd8b4d18cdf7ca47d2 and winappcli 0.7.1. Final CI rebuilt the product and tests from the exact pushed commit above.

Known setup cost: the pipeline installs missing en-GB basic/OCR capabilities online. Cold Win11 setup took approximately 76 minutes in the successful run; the setup step has a 90-minute limit.

Build commands executed

Each command below passed with exit code 0:

& X:\GitHub\PowerToys\tools\build\build.cmd -Path X:\GitHub\PowerToys\src\modules\PowerOCR\PowerOCR.UITests.Next -Platform x64 -Configuration Debug
& X:\GitHub\PowerToys\tools\build\build.cmd -Path X:\GitHub\PowerToys\src\modules\PowerOCR\PowerOCR.UITests.Next -Platform ARM64 -Configuration Debug
& X:\GitHub\PowerToys\tools\build\build.cmd -Path X:\GitHub\PowerToys\src\modules\PowerOCR\PowerOCR.UITests.Next -Platform x64 -Configuration Release
& X:\GitHub\PowerToys\tools\build\build.cmd -Path X:\GitHub\PowerToys\src\modules\PowerOCR\PowerOCR.UITests.Next -Platform ARM64 -Configuration Release

Full local VM commands executed

Working directory: X:\GitHub\PowerToys. Each unfiltered suite below passed 10/10 with exit code 0:

& .github\skills\ui-tests-local-vm\scripts\Invoke-LocalVmUiTest.ps1 -VmName PowerToysUiTest-Win10 -VmRoot X:\PowerToysUiTestVm -ExchangeRoot X:\PowerToysUiTestVm\shared\PowerToysUiTests\PowerOCR -TestExecutable PowerOCR.UITests.Next.exe -Platform x64Win10 -BuildLabel 'PowerOCR-port6-winapp0.7.1-product92ec7412' -SuiteTimeout 20m -TimeoutMinutes 30 -ReuseStagedPayload

& .github\skills\ui-tests-local-vm\scripts\Invoke-LocalVmUiTest.ps1 -VmName PowerToysUiTest-Win11 -ConfigurationPath X:\PowerToysUiTestVm\vm.config.powerocr.win11.psd1 -VmRoot X:\PowerToysUiTestVm -ExchangeRoot X:\PowerToysUiTestVm\shared\PowerToysUiTests\PowerOCR -TestExecutable PowerOCR.UITests.Next.exe -Platform x64Win11 -BuildLabel 'PowerOCR-port6-winapp0.7.1-product92ec7412' -SuiteTimeout 20m -TimeoutMinutes 30 -ReuseStagedPayload

& .github\skills\ui-tests-local-vm\scripts\Invoke-LocalVmUiTest.ps1 -VmName PowerToysUiTest-Win10 -VmRoot X:\PowerToysUiTestVm -ExchangeRoot X:\PowerToysUiTestVm\shared\PowerToysUiTests\PowerOCR -ResourceProfile Constrained -TestExecutable PowerOCR.UITests.Next.exe -Platform x64Win10 -BuildLabel 'PowerOCR-port6-winapp0.7.1-product92ec7412' -SuiteTimeout 25m -TimeoutMinutes 35 -ReuseStagedPayload

& .github\skills\ui-tests-local-vm\scripts\Invoke-LocalVmUiTest.ps1 -VmName PowerToysUiTest-Win11 -ConfigurationPath X:\PowerToysUiTestVm\vm.config.powerocr.win11.psd1 -VmRoot X:\PowerToysUiTestVm -ExchangeRoot X:\PowerToysUiTestVm\shared\PowerToysUiTests\PowerOCR -ResourceProfile Constrained -TestExecutable PowerOCR.UITests.Next.exe -Platform x64Win11 -BuildLabel 'PowerOCR-port6-winapp0.7.1-product92ec7412' -SuiteTimeout 25m -TimeoutMinutes 35 -ReuseStagedPayload

The guests were stopped before changing resource profiles. The four final runs used one identical test/product/tool payload fingerprint.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the Product-Text Extractor This refers to the Text Extractor PowerToy label Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted review (iteration 1 @ 6c732ac)

The port is a faithful 10 to 10 migration and follows the ui-tests-migration conventions: .Next project next to the legacy suite, PerMonitorV2 manifest, tests\ output path, warnings-as-errors inherited, ClipboardHelper, retried hotkey activation, and a positively validated negative check. Solution placement, resolver auto-discovery, companion signing, and non-elevated dispatch all look right.

The main concerns are in CI. The new language-provisioning step can block every UI suite in the job, and it changes agent user state without restoring it. On the test side, the toolbar test lost its real-click coverage and the clipboard cleanup has an empty-clipboard bug.

# Severity Location Finding
1 high .pipelines/v2/templates/job-test-project.yml:504-506 Provisioning step is a hard gate: a FOD failure or timeout (~76 of 90 min cold) blocks all UI suites in the job, including full runs
2 medium src/modules/PowerOCR/PowerOCR.UITests.Next/PowerOCRTests.cs:128-131 An empty clipboard is never restored (SetText("") throws; the helper retries 9 times and logs "clipboard locked")
3 medium src/modules/PowerOCR/PowerOCR.UITests.Next/PowerOCRTests.cs:265-270 ToolbarModesTest uses UIA Invoke instead of real clicks, so the toolbar exclusion-rect input path is no longer covered
4 low src/modules/PowerOCR/PowerOCR.UITests.Next/PowerOCRTests.cs:473-483 Dropdown is read in a single snapshot (legacy polled), and visible-subset indices can differ from product indices
5 low src/modules/PowerOCR/PowerOCR.UITests.Next/PowerOCRTests.cs:383-385 Deterministic fixture but non-empty-only assertion; centering on VirtualScreen breaks on multi-monitor setups
6 low src/modules/PowerOCR/PowerOCR.UITests.Next/PowerOCRTests.cs:665-667 Cross-thread fixture.Handle read throws under a debugger
7 low src/modules/PowerOCR/PowerOCR.UITests.Next/PowerOCRTests.cs:31 PreferredLanguage: "en-US" never matches (the module stores and compares NativeName/DisplayName)
8 medium .pipelines/v2/templates/job-test-project.yml:478-484 en-GB language and UK keyboard are added to the agent user and never restored (no PowerToysUiTestState snapshot)
9 low .pipelines/v2/templates/job-test-project.yml:386 Pester parity: the signing and non-elevated test lists aren't updated, and the provisioning gate has no test
10 low doc/devdocs/modules/textextractor.md:20 Doc: two claims not backed by the code, and local setup steps for the second OCR language are missing
11 info src/modules/PowerOCR/PowerOCR.UITests.Next/PowerOCRTests.cs:289-294 Restore the rationale comments for the interior rectangle and MoveBy(1, 0)
Validation performed for this review
  • Pester 3.4.0 at head on the template-parsing suites (uiTestSigningSelection, resolveUiTestModules, umdfHidRouting, mwbUiTestFlow, configureLightSwitchLocation): 149 tests, 144 passed. The 5 failures are all in configureLightSwitchLocation.Tests.ps1 and reproduce identically on base 0b1dd814, so they are pre-existing and unrelated (that file isn't in the CI Pester set).
  • .NET 10.0.14 probes: Clipboard.SetText("") throws ArgumentNullException. A cross-thread Control.Handle read with CheckForIllegalCrossThreadCalls=true throws InvalidOperationException.
  • Local OCR enumeration: OcrEngine.AvailableRecognizerLanguages returned en-US, ru while Get-WinUserLanguageList returned only en-US. The en-GB default input tip is 0809:00000809 (UK keyboard).
  • Microsoft's FOD docs say Language.OCR depends on Language.Basic of the same language, so installing Language.Basic~~~en-GB is required and isn't flagged.

Comment thread doc/devdocs/modules/textextractor.md Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@khmyznikov

Copy link
Copy Markdown
Contributor Author
AI-generated summary

Addressed all 11 review findings in 70d02afa9122e37ccc61bce8a4c99ca4d6ba7fe9, replied to each thread, and resolved the eligible threads after validation. The UI suite still contains exactly the original 10 cases; the legacy suite is unchanged.

Validation:

  • x64/ARM64 Debug and Release builds: passed, exit code 0.
  • Focused Pester selection/provisioning/dispatch checks: 100/100 passed.
  • Adjacent resolver/MWB/UMDF regression checks: 60/60 passed.
  • Full Windows 10 and Windows 11 VM suites at default 4-vCPU/8-GB and constrained 1-vCPU/4-GB profiles: 40/40 passed.
  • Standard-user clipboard probes verified both empty and nonempty restoration.
  • Fresh CI build 162912932: succeeded. Win10 x64, Win11 x64, and ARM64 each executed all 10 expected UI tests as Passed, with no skipped or other non-passing outcomes.

Language setup no longer modifies agent language/keyboard preferences. Its failure path explicitly blocks only PowerOCR while allowing other selected suites to execute.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

✅ PR intake

All automated intake checks now pass. Thanks for the updates!

Automated PR intake; PowerToys maintainers make final decisions.

@niels9001
Niels Laute (niels9001) enabled auto-merge (squash) November 5, 2026 16:40
@niels9001
Niels Laute (niels9001) merged commit 2d28a56 into main Nov 5, 2026
18 of 22 checks passed
@niels9001
Niels Laute (niels9001) deleted the gleb/ui-tests-power-ocr branch November 5, 2026 17:32
@github-project-automation github-project-automation Bot moved this from In Progress to Done in UI Tests tracker Nov 5, 2026
Gary Hsu (howdygary) pushed a commit that referenced this pull request Nov 5, 2026
Resolves the conflicts with the PowerOCR UI tests (#51933): both suites stay in the non-elevated lists.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Tests issues that relate to tests Product-Text Extractor This refers to the Text Extractor PowerToy Ready for review

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

UITests - Text Extractor Migration

2 participants