Skip to content

[Keyboard Manager] UI tests for remapping search, filters and bulk delete - #50352

Open
takahashi (MasaYan24) wants to merge 1 commit into
microsoft:mainfrom
MasaYan24:feature/kbm-search-uitests
Open

[Keyboard Manager] UI tests for remapping search, filters and bulk delete#50352
takahashi (MasaYan24) wants to merge 1 commit into
microsoft:mainfrom
MasaYan24:feature/kbm-search-uitests

Conversation

@MasaYan24

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #49287, requested by Gleb Khmyznikov (@khmyznikov): UI tests for the remapping-list search, filters and bulk delete that shipped in that PR.

KeyboardManager.UITests is already on the Microsoft.PowerToys.UITest.Next / winappcli harness, so this adds a test class to the existing project rather than scaffolding a new one. No product code changes.

What the tests cover

KeyboardManager.Editor.SearchAndFilter

  • Ctrl+F moves focus to the title-bar search box and the typed text narrows the list
  • Clear filters in the filter flyout restores the full list
  • The Ctrl and Alt modifier toggles each narrow the list to their own mapping
  • The application filter hides app-specific mappings under Global only
  • A search with no matches shows the dedicated no-results state, and its Clear filters button recovers from it
  • Searching and filtering never touch the persisted profile

KeyboardManager.Editor.BulkDelete

  • Selection mode turns the toolbar button into the Cancel affordance
  • Two selected rows produce a Delete selected (2) label on an enabled bulk-delete button
  • Confirming the dialog removes exactly the two selected mappings and leaves the other two untouched
  • The editor leaves selection mode afterwards, and the deletion survives an editor restart

Note on the seeded profile

The seeded mappings deliberately use function keys (F13-F17) as their trigger keys. The Keyboard Manager engine is live while these tests run, so a remap on an ordinary letter would rewrite the characters the test types into the search box.

Validation

  • KeyboardManager.UITests builds clean (x64 Debug); the new file produces no analyzer warnings.
  • I have not executed the suite locally. These tests reset the real %LOCALAPPDATA%\Microsoft\PowerToys Keyboard Manager configuration and take over the interactive desktop, and I do not have an isolated desktop/VM available on this machine. Could a maintainer kick off /azp run so the Resolve affected UI test projects job picks them up? Happy to iterate on anything that comes back red.

Checklist

…lete

Adds KeyboardManagerSearchFilterTests to the existing KeyboardManager.UITests
project (already on the Microsoft.PowerToys.UITest.Next / winappcli harness),
covering the list features that shipped in microsoft#49287:

- Ctrl+F focuses the title-bar search box and the typed text filters the list
- Clear filters restores the full list from the filter flyout
- The Ctrl and Alt modifier toggles each narrow the list to their own mapping
- The application filter hides app-specific mappings in "Global only"
- A search with no matches shows the dedicated no-results state, and its
  Clear filters button recovers from it
- Searching and filtering never touch the persisted profile
- Selection mode + "Delete selected (n)" removes exactly the selected rows,
  leaves selection mode, and the deletion survives an editor restart

The seeded profile uses function keys (F13-F17) as trigger keys so the running
Keyboard Manager engine cannot rewrite the letters the test types into the
search box.

Requested by @khmyznikov as a follow-up to microsoft#49287.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EJG9NHHEkEgFmp9W7djrnt
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

🧭 PR intake

Visual evidence: Not needed — The changed files do not indicate a visible UI change. No visual evidence is expected.

Recommendation

Link the issue this PR fixes using a closing keyword such as Closes #123.

✅ Ready for review

This PR passed the automated intake checks and is ready for maintainer review.

Automated PR intake; PowerToys maintainers make final decisions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The profile-integrity assertion can miss persisted shortcut mutations.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds Keyboard Manager UI tests for remapping-list search, filtering, selection, and bulk deletion.

Changes:

  • Tests search/filter behavior and no-results recovery.
  • Tests bulk deletion and persistence across restart.
File summaries
File Description
KeyboardManagerSearchFilterTests.cs Adds search, filter, and bulk-delete UI scenarios.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +200 to +206
private static bool ProfileContainsSeededMappings() =>
SingleKeyMappings().Count == 1 &&
SingleKeyMappings().Any(mapping =>
mapping?["originalKeys"]?.GetValue<string>() == F13.ToString(System.Globalization.CultureInfo.InvariantCulture) &&
mapping?["newRemapKeys"]?.GetValue<string>() == F14.ToString(System.Globalization.CultureInfo.InvariantCulture)) &&
GlobalShortcutMappings().Count == 2 &&
AppSpecificShortcutMappings().Count == 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants