Compare commits

..

147 Commits

Author SHA1 Message Date
Mike Griese
ea42344f03 Merge branch 'dev/migrie/40113/move-context-message' into dev/migrie/selfhost/0.93-003 2025-07-28 10:03:23 -05:00
Mike Griese
bb5e6da47b PRE-MERGE #40640 2025-07-28 10:03:17 -05:00
Mike Griese
da42871023 fine merge conflict fine 2025-07-28 10:01:46 -05:00
Mike Griese
ab18a1f91d Merge remote-tracking branch 'origin/main' into dev/migrie/40113/move-context-message 2025-07-28 09:57:59 -05:00
Mike Griese
3460be464f Merge remote-tracking branch 'origin/main' into feature/40616-replace-tapped-event-with-click-on-button 2025-07-28 09:57:35 -05:00
Mike Griese
c286d01820 PRE-MERGE #40513 2025-07-28 09:18:50 -05:00
Mike Griese
433168b945 PRE-MERGE #40825 2025-07-28 09:18:44 -05:00
Mike Griese
84e928656f PRE-MERGE #40815 2025-07-28 09:18:41 -05:00
Mike Griese
657b281001 PRE-MERGE #40716 2025-07-28 09:18:39 -05:00
Mike Griese
c93e8183e5 PRE-MERGE #40791 2025-07-28 09:18:35 -05:00
Mike Griese
7c28f0f98b PRE-MERGE #40768 2025-07-28 09:18:33 -05:00
Mike Griese
7d1f84ccb4 PRE-MERGE #40761 2025-07-28 09:18:30 -05:00
Mike Griese
a7cac62b5f PRE-MERGE #40752 2025-07-28 09:18:27 -05:00
Mike Griese
087ebb1897 PRE-MERGE #40758 2025-07-28 09:18:16 -05:00
Mike Griese
c22fea859b PRE-MERGE #40847 2025-07-28 09:18:08 -05:00
Mike Griese
eba71baea6 PRE-MERGE #40777 2025-07-28 09:17:35 -05:00
Mike Griese
d6a61da584 Yea this can move too 2025-07-28 09:09:57 -05:00
Jiří Polášek
efb3c307f9 Merge branch 'main' into feature/38260-bandaid-iconcacheservice-exception-handling 2025-07-28 15:58:05 +02:00
Mike Griese
78674bad64 Merge remote-tracking branch 'origin/main' into dev/migrie/40113/move-context-message 2025-07-28 08:48:51 -05:00
Mike Griese
3aeb50249e Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-with-files-2 2025-07-28 08:47:52 -05:00
Mike Griese
7c35093675 Merge remote-tracking branch 'origin/main' into list-announce-screen-reader 2025-07-28 08:39:07 -05:00
Mike Griese
57095c4d8c CmdPal: fix handling form submits
Yea this was real dumb.

I removed the `HandleCommandResultMessage` handler from `ShellPage`,
and never put it on `ShellViewModel`. Just first-grade kind of mistake.

Regressed in #40479
re: #40113
2025-07-28 06:36:55 -05:00
Jiří Polášek
3fa2f02da2 Add error handling to extension disposal
Ensure that errors encountered while sending the extension disposal signal are handled gracefully. If an error occurs when disposing of a particular extension, continue signaling the remaining extensions rather than halting the entire process. This prevents a single failure from interrupting the disposal chain and improves overall robustness.
2025-07-26 13:01:58 +02:00
Mike Griese
44abb98fba CmdPal: Remove vestigial try/catch
This was added in #38040 but appears to be vestigial now.

RE: #40113
2025-07-25 14:54:33 -05:00
Mike Griese
28c5ab709a CmdPal: Move the OpenContextMenuMessage into the UI project
I just blindly moved all the messages. But _this_ one really makes more
sense as a UI message. It's got framework elements. It us used to
actually open a UI element. The whole thing is very UI specific.

re: #40113
2025-07-24 05:52:19 -05:00
Jiří Polášek
616da6ae5e Poor mans synchronization of reloading commands (hotfix, not permanent) 2025-07-24 00:44:07 +02:00
Mike Griese
3a124c02ee and in the context menu too 2025-07-23 16:46:29 -05:00
Mike Griese
76954b3c41 cmdpal: move kb shortcut handling to PreviewKeyDown
This lets things like C-S-c work in the text box

Closes #40174
2025-07-23 16:29:15 -05:00
Jiří Polášek
6d18c453ae Typo. Spellchecker is the new Skynet! 2025-07-23 16:09:12 +02:00
Jiří Polášek
d9f530cdf7 Extend the lock to cover the entire operation to prevent a stale clone from rewriting the TopLevelCommands and fix problem with duplication 2025-07-23 15:51:17 +02:00
Mike Griese
31f74040aa Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes 2025-07-23 06:52:09 -05:00
Mike Griese
b0a500e875 Merge branch 'main' into dev/migrie/f/run-page-2-with-history 2025-07-23 06:51:50 -05:00
Mike Griese
2e2e060f4e context shortcuts are good too 2025-07-23 06:49:54 -05:00
Mike Griese
35ed9f5b56 file context items on commands too 2025-07-23 06:38:08 -05:00
Mike Griese
04d626a053 STASH: start refactoring file search commands to toolkit 2025-07-22 16:39:55 -05:00
Jessica Dene Earley-Cha
6ddf6064e1 add AutomationNotification for screen readers 2025-07-22 13:28:24 -07:00
Mike Griese
b111899ac0 spel 2025-07-22 15:14:27 -05:00
Mike Griese
e6e0f6d541 Revert "MAIN: fix this"
This reverts commit b79cf60d94.
2025-07-22 15:12:32 -05:00
Mike Griese
68c364f75e Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes 2025-07-22 14:54:04 -05:00
Mike Griese
7649c16d2e dead comment 2025-07-22 14:53:40 -05:00
Mike Griese
66489acaac Merge commit 'd62eeb39b' into dev/migrie/f/run-page-2-with-history 2025-07-22 14:49:39 -05:00
Mike Griese
d62eeb39b9 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-07-22 14:48:22 -05:00
Mike Griese
87b79a7ee8 Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes 2025-07-22 10:28:25 -05:00
Mike Griese
367504537d suggestions too 2025-07-22 10:28:00 -05:00
Jiří Polášek
9b6794f359 Adds lock around access to TopLevelCommandManager 2025-07-22 15:47:04 +02:00
Mike Griese
0cfb321b9b Merge branch 'dev/migrie/f/run-page-2-with-suggestions' into dev/migrie/f/run-page-2-with-history 2025-07-22 06:56:45 -05:00
Mike Griese
4b0534acf8 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-07-22 06:56:29 -05:00
Jiří Polášek
75810c439d Fix XAML formatting 2025-07-21 22:07:38 +02:00
Jiří Polášek
58ec692b66 Handle exceptions when enqueuing callbacks to UI thread in IconCacheService
Handle exceptions thrown in TryEnqueue callbacks so they don’t crash the app (as they cannot be caught by the global exception handler). Any exceptions are now returned to the caller for handling. Additionally, a failure to enqueue the operation onto the dispatcher will also result in an exception.

This is not a breaking change, as exceptions only propagate within the class and do not affect external callers.

Ref: #38260
2025-07-19 19:32:11 +02:00
Jiří Polášek
e8077a42e1 Remove background from items in the status messages list (as requested by niels9001) 2025-07-18 18:01:00 +02:00
Jiří Polášek
c5247c831a Remove attributes with default values from XAML stack panel 2025-07-18 17:36:51 +02:00
Jiří Polášek
d6438a6f0b Update IconGrid margin to account for the inner button border and padding 2025-07-18 17:31:45 +02:00
Jiří Polášek
d5b8df24c5 Fix XAML style 2025-07-18 00:56:50 +02:00
Jiří Polášek
f820bca84f Replace status message badge with a button
The previous implementation used a visual badge inside a tappable grid element. However, the grid was not focusable or operable via keyboard, reducing accessibility. Replacing it with a proper button improves keyboard navigation and ensures consistent interaction behavior across input methods.
2025-07-17 14:18:17 +02:00
Jiří Polášek
ee4f75dbb8 Replace RightTapped with ContextRequested event
ContextRequested event covers other input gestures, like keyboard Context menu key or Shift+F10.
2025-07-17 13:27:37 +02:00
Jiří Polášek
64fe19c750 Replace Tapped event with Click on button in CmdPal
Click event on WinUI buttons handle more that just click and is more versatile that Tapped event. When you tap a Button with a finger or stylus, or press a left mouse button while the pointer is over it, the button raises the Click event. If a button has keyboard focus, pressing the Enter key or the Spacebar key also raises the Click event.
2025-07-16 20:02:39 +02:00
Mike Griese
b79cf60d94 MAIN: fix this 2025-07-16 09:33:41 -05:00
Mike Griese
74efb00f40 Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes 2025-07-16 06:57:32 -05:00
Mike Griese
bf83bbd94d Merge branch 'dev/migrie/f/run-page-2-with-suggestions' into dev/migrie/f/run-page-2-with-history 2025-07-16 06:55:50 -05:00
Mike Griese
12b7555006 dead code 2025-07-16 06:54:00 -05:00
Mike Griese
77a0d77471 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-07-16 06:53:30 -05:00
Jiří Polášek
a2cb164a74 Merge branch 'main' into feature/39167-cmdpal-if-you-update-the-command-after-changing-the-title-of-a-fallback-item-we-won-t-hide-it-correctly 2025-07-16 00:32:25 +02:00
Mike Griese
9a3667c91f Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes 2025-07-15 13:15:59 -05:00
Mike Griese
45145cf1a4 Merge branch 'dev/migrie/f/run-page-2-with-suggestions' into dev/migrie/f/run-page-2-with-history 2025-07-15 13:15:04 -05:00
Mike Griese
f758907850 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-07-15 13:14:40 -05:00
Mike Griese
9323598fed don't add to the end of the list
honestly, kinda surprised that the dict maintains insert order?
2025-07-15 13:08:32 -05:00
Mike Griese
e8c63a26e0 okay, fine 2025-07-15 10:17:49 -05:00
Mike Griese
6f867d178c spel 2025-07-15 10:09:57 -05:00
Mike Griese
4250bd82ac Merge branch 'dev/migrie/f/run-page-2-with-suggestions' into dev/migrie/f/run-page-2-with-history 2025-07-15 10:06:52 -05:00
Mike Griese
c4047a8ee2 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-07-15 10:05:08 -05:00
Jiří Polášek
cd00ecb791 Extend CommandItemViewModel to handle additional model changes affecting Title
CommandItemViewModel now updates its internal _itemTitle field not only when the CommandItem model raises a property notification for Title, but also when the model’s Command or the Command’s name changes.

This works around an issue in SDK versions before 0.3, where CommandItem does not raise property change notifications for Title in all effective cases.
This approach is not fully correct, as it relies on knowledge of CommandItem’s internal logic and the Title property being virtual and should be sooner or later reverted.
2025-07-10 00:00:16 +02:00
Jiří Polášek
abd0fb70f6 Raise Title property change notification when Command or Command.Name changes
Previously, the `Title` property raised a change notification only when set directly. However, the `Title` getter returns a coalesced value: if `Title` is not set, it falls back to `Command.Name`. This update ensures that property change notifications for `Title` are also raised when:
- The `Command` property changes
- The `Name` property of the assigned `Command` changes and affects the `Title`
2025-07-09 23:38:53 +02:00
Mike Griese
d9c168c3fe Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes 2025-07-09 14:56:46 -05:00
Mike Griese
210febe270 Merge branch 'dev/migrie/f/run-page-2-with-suggestions' into dev/migrie/f/run-page-2-with-history 2025-07-09 14:56:22 -05:00
Mike Griese
e53cb409b4 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-07-09 14:56:07 -05:00
Mike Griese
98c771788b Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes 2025-07-09 14:55:30 -05:00
Mike Griese
5dee7c9d89 Merge branch 'dev/migrie/f/run-page-2-with-suggestions' into dev/migrie/f/run-page-2-with-history 2025-07-09 14:55:02 -05:00
Mike Griese
c2ba9af144 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-07-09 14:47:13 -05:00
Mike Griese
29c15601f0 Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes 2025-07-06 14:14:53 -05:00
Mike Griese
558e2af6cb uhg 2025-07-06 14:14:33 -05:00
Mike Griese
70c5e3c9d5 Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes 2025-07-06 14:11:30 -05:00
Mike Griese
986ffbeede Merge branch 'dev/migrie/f/run-page-2-with-suggestions' into dev/migrie/f/run-page-2-with-history 2025-07-06 14:07:16 -05:00
Mike Griese
8466c47059 delete all this logging we don't need 2025-07-06 10:36:14 -05:00
Mike Griese
229d3b4991 loc, dead code removal 2025-07-06 09:50:49 -05:00
Mike Griese
7ca9798df5 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-07-06 09:24:35 -05:00
Mike Griese
a6e39d5535 PARENT: omg 2025-07-06 09:24:20 -05:00
Mike Griese
edf02497af tiny note 2025-07-06 09:24:06 -05:00
Mike Griese
02b583267d move it all out 2025-07-06 09:16:04 -05:00
Mike Griese
e2569ec4ee Start pulling this out of IconPathConverter 2025-07-06 09:07:56 -05:00
Mike Griese
c760962573 minor nits 2025-07-05 22:55:53 -05:00
Mike Griese
ec2480385b Tidy up the Type property, which we no longer need 2025-07-05 22:52:44 -05:00
Mike Griese
458d3a2699 I think placeholders should have subtitles too 2025-07-05 10:22:44 -05:00
Mike Griese
a58b802cb9 i'm so good at this 2025-07-05 07:03:57 -05:00
Mike Griese
a72bf5aed7 Bookmarking exes or files or urls is that easy 2025-07-05 06:26:05 -05:00
Mike Griese
fb49f6a5e5 you should be with your friends 2025-07-05 05:47:25 -05:00
Mike Griese
b4a7bb4a7a MAIN: this is dumb 2025-07-04 06:58:50 -05:00
Mike Griese
8615c48c5c this works better 2025-07-03 20:16:03 -05:00
Mike Griese
1aa78e1b96 PARENT: omg 2025-07-03 15:49:42 -05:00
Mike Griese
b0c862dd67 add items to history 2025-07-03 15:27:50 -05:00
Mike Griese
b6e3b8a3ee rename 2025-07-03 12:46:29 -05:00
Mike Griese
a2d0d3b262 start adding callbacks to commands 2025-07-03 12:46:10 -05:00
Mike Griese
ee53a6d138 Use a dict for string->listitem for history 2025-07-02 06:57:02 -05:00
Mike Griese
126a3c0de8 load history items with a timeout 2025-07-02 06:20:07 -05:00
Mike Griese
a94bd91dba Merge branch 'dev/migrie/f/run-page-2-with-suggestions' into dev/migrie/f/run-page-2-with-history 2025-07-01 16:32:14 -05:00
Mike Griese
b2f2462ad6 The fallback command should also be cancellable 2025-07-01 16:13:28 -05:00
Mike Griese
b6f0ced53e Exes that are found in a dir should be RunExeItems 2025-07-01 14:46:58 -05:00
Mike Griese
a405f27d19 reuse existing exe item when we can 2025-07-01 14:30:19 -05:00
Mike Griese
86d04cc3bd timeout resolving network paths 2025-07-01 13:57:14 -05:00
Mike Griese
381482e9a0 Revert "try to async the File.Exists, but get sad"
This reverts commit 9e7d212c31.
2025-07-01 13:34:08 -05:00
Mike Griese
9e7d212c31 try to async the File.Exists, but get sad 2025-07-01 13:34:04 -05:00
Mike Griese
11c9d913cc Make run searches async, so subsequent ones cancel the previous.
thanks copilot, this actually worked
2025-07-01 12:36:01 -05:00
Mike Griese
31f5af7e14 URI only if the file doesn't exist 2025-07-01 12:17:38 -05:00
Mike Griese
568c2ca388 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-07-01 10:04:59 -05:00
Mike Griese
27124972cd Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-06-30 08:39:19 -05:00
Mike Griese
ca9488c875 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-06-30 05:53:59 -05:00
Mike Griese
d73a8a0a2c Load the run history immediately 2025-06-18 09:37:00 -05:00
Mike Griese
c953ce7eca Add support for using the RunDlg history to initialize the run history 2025-06-18 08:43:48 -05:00
Mike Griese
9fc7a180d4 xamlformat(?) 2025-06-10 06:20:09 -05:00
Mike Griese
ccca007562 Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-06-10 06:15:59 -05:00
Mike Griese
07c85065f2 Add support for URIs too 2025-06-09 20:42:35 -05:00
Mike Griese
c06767b73e Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-06-08 12:46:12 -05:00
Mike Griese
4c639a085c Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2-with-suggestions 2025-06-08 06:32:20 -05:00
Mike Griese
8aa7349f32 handle backspacing suggestions cleaner 2025-06-08 05:56:26 -05:00
Mike Griese
fa86f2223c PARENT: deal with drives and quotes better 2025-06-08 05:56:03 -05:00
Mike Griese
30215e8b4f PARENT: much better env var handling 2025-06-06 17:58:29 -05:00
Mike Griese
ee386e7be4 PARENT: Suppress file fallback when run finds something 2025-06-05 04:52:25 -05:00
Mike Griese
9ba2030b5e OWN BRANCH: Fix the weighting for the web search fallbacks
Closes #39419
This can be moved to its own branch.
2025-06-04 06:34:26 -05:00
Mike Griese
1ba832b732 Make the calc command play better with TextToSuggest 2025-06-02 14:11:05 -05:00
Mike Griese
46f27c1612 make it build 2025-05-30 07:00:29 -05:00
Mike Griese
1d81ef8935 PARENT: Start working on making run fallback hide the file search one 2025-05-23 18:16:47 -07:00
Mike Griese
e19cdba074 PARENT: Update the fallback item too 2025-05-23 11:28:28 -07:00
Mike Griese
4223286061 PARENT: Expand env vars 2025-05-23 09:39:19 -07:00
Mike Griese
8e6bd141ca PARENT: Better deal with spaces 2025-05-23 09:37:29 -07:00
Mike Griese
d29121c3fd PARENT: logging that I don't think I needed 2025-05-18 19:00:54 -05:00
Mike Griese
58e0530980 Accept suggestions better 2025-05-18 19:00:41 -05:00
Mike Griese
9272e3112b This feels pretty great tbh 2025-05-18 18:47:10 -05:00
Mike Griese
a64095c3d3 try messing with selection to indicate text suggestion 2025-05-18 17:00:32 -05:00
Mike Griese
49480041cd this is near perfect 2025-05-18 15:43:28 -05:00
Mike Griese
547b664a8c Better handle removing the path item if the thing is an exe 2025-05-18 15:07:11 -05:00
Mike Griese
72320bea79 Add a single command for running the commandline. Remove history 2025-05-18 14:29:54 -05:00
Mike Griese
910de53a0a Merge remote-tracking branch 'origin/main' into dev/migrie/f/run-page-2 2025-05-18 10:18:20 -05:00
Mike Griese
11f60de543 stash: start moving into the main run page 2025-05-08 06:13:57 -05:00
Mike Griese
e7eb2d0239 Add the TextToSuggest back, just for demo purposes 2025-04-30 20:36:24 -05:00
Mike Griese
aefae2935e heck just use the original shell provider for history 2025-04-30 10:05:16 -05:00
Mike Griese
727367960e Start adding history 2025-04-30 06:01:45 -05:00
Mike Griese
32700658fd Deduplicate a bunch of code 2025-04-30 04:25:59 -05:00
Mike Griese
a7cb535515 What if the run page had the same typeahead that Rundlg had? 2025-04-29 17:01:49 -05:00
32 changed files with 241 additions and 589 deletions

View File

@@ -123,7 +123,7 @@ jobs:
displayName: Stage UI Test Build Outputs
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '**/$(BuildPlatform)/$(BuildConfiguration)/tests/**/*'
contents: '$(BuildPlatform)/$(BuildConfiguration)/**/*'
targetFolder: '$(JobOutputDirectory)\$(BuildPlatform)\$(BuildConfiguration)'
- publish: $(JobOutputDirectory)

View File

@@ -11,14 +11,12 @@ parameters:
- name: useLatestWebView2
type: boolean
default: false
- name: buildSource
type: string
default: "latestOfficialBuild"
displayName: "Build Source"
- name: specificBuildId
type: string
default: "xxxx"
displayName: "Build ID (for specific builds)"
- name: useLatestOfficialBuild
type: boolean
default: true
- name: useCurrentBranchBuild
type: boolean
default: false
- name: uiTestModules
type: object
default: []
@@ -115,17 +113,16 @@ jobs:
& '$(build.sourcesdirectory)\.pipelines\InstallWinAppDriver.ps1'
displayName: Download and install WinAppDriver
- ${{ if ne(parameters.buildSource, 'buildNow') }}:
- ${{ if eq(parameters.useLatestOfficialBuild, true) }}:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: 'Dart'
definition: '76541'
${{ if eq(parameters.buildSource, 'specificBuildId') }}:
buildVersionToDownload: 'specific'
buildId: '${{ parameters.specificBuildId }}'
buildVersionToDownload: 'latestFromBranch'
${{ if eq(parameters.useCurrentBranchBuild, true) }}:
branchName: '$(Build.SourceBranch)'
${{ else }}:
buildVersionToDownload: 'latestFromBranch'
branchName: 'refs/heads/main'
artifactName: 'build-$(BuildPlatform)-Release'
targetPath: '$(Build.ArtifactStagingDirectory)'
@@ -136,7 +133,7 @@ jobs:
patterns: |
**/PowerToysSetup*.exe
- ${{ if ne(parameters.buildSource, 'buildNow') }}:
- ${{ if eq(parameters.useLatestOfficialBuild, true) }}:
- ${{ if eq(parameters.installMode, 'peruser') }}:
- pwsh: |-
& "$(build.sourcesdirectory)\.pipelines\installPowerToys.ps1" -InstallMode "PerUser"
@@ -172,7 +169,7 @@ jobs:
!**\UITests-FancyZones\**\UITests-FancyZonesEditor.dll
env:
platform: '$(TestPlatform)'
useInstallerForTest: ${{ ne(parameters.buildSource, 'buildNow') }}
useInstallerForTest: ${{ parameters.useLatestOfficialBuild }}
- ${{ if ne(length(parameters.uiTestModules), 0) }}:
- ${{ each module in parameters.uiTestModules }}:
@@ -194,4 +191,4 @@ jobs:
!**\UITests-FancyZones\**\UITests-FancyZonesEditor.dll
env:
platform: '$(TestPlatform)'
useInstallerForTest: ${{ ne(parameters.buildSource, 'buildNow') }}
useInstallerForTest: ${{ parameters.useLatestOfficialBuild }}

View File

@@ -19,25 +19,22 @@ parameters:
- name: useLatestWebView2
type: boolean
default: false
- name: buildSource
type: string
default: "latestOfficialBuild"
displayName: "Build Source"
values:
- latestOfficialBuild
- buildNow
- specificBuildId
- name: specificBuildId
type: string
default: 'xxxx'
displayName: "Build ID (only used when Build Source = specificBuildId)"
- name: useLatestOfficialBuild
type: boolean
default: true
- name: testBothInstallModes
type: boolean
default: true
- name: useCurrentBranchBuild
type: boolean
default: false
- name: uiTestModules
type: object
default: []
stages:
- ${{ each platform in parameters.buildPlatforms }}:
- ${{ if eq(parameters.buildSource, 'buildNow') }}:
- ${{ if eq(parameters.useLatestOfficialBuild, false) }}:
- stage: Build_${{ platform }}
displayName: Build ${{ platform }}
dependsOn: []
@@ -61,7 +58,7 @@ stages:
useVSPreview: ${{ parameters.useVSPreview }}
timeoutInMinutes: 90
- ${{ if ne(parameters.buildSource, 'buildNow') }}:
- ${{ if eq(parameters.useLatestOfficialBuild, true) }}:
- stage: BuildUITests_${{ platform }}
displayName: Build UI Tests Only
dependsOn: []
@@ -82,7 +79,7 @@ stages:
- ${{ if eq(platform, 'x64') }}:
- stage: Test_x64Win10
displayName: Test x64Win10
${{ if ne(parameters.buildSource, 'buildNow') }}:
${{ if eq(parameters.useLatestOfficialBuild, true) }}:
dependsOn:
- BuildUITests_${{ platform }}
${{ else }}:
@@ -94,19 +91,19 @@ stages:
platform: x64Win10
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
buildSource: ${{ parameters.buildSource }}
specificBuildId: ${{ parameters.specificBuildId }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
# Additional per-user installation test
- ${{ if ne(parameters.buildSource, 'buildNow') }}:
# Additional per-user installation test (when both modes are enabled)
- ${{ if and(eq(parameters.useLatestOfficialBuild, true), eq(parameters.testBothInstallModes, true)) }}:
- template: job-test-project.yml
parameters:
platform: x64Win10
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
buildSource: ${{ parameters.buildSource }}
specificBuildId: ${{ parameters.specificBuildId }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
installMode: 'peruser'
jobSuffix: '_PerUser'
@@ -114,7 +111,7 @@ stages:
- ${{ if eq(platform, 'x64') }}:
- stage: Test_x64Win11
displayName: Test x64Win11
${{ if ne(parameters.buildSource, 'buildNow') }}:
${{ if eq(parameters.useLatestOfficialBuild, true) }}:
dependsOn:
- BuildUITests_${{ platform }}
${{ else }}:
@@ -126,19 +123,19 @@ stages:
platform: x64Win11
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
buildSource: ${{ parameters.buildSource }}
specificBuildId: ${{ parameters.specificBuildId }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
# Additional per-user installation test
- ${{ if ne(parameters.buildSource, 'buildNow') }}:
# Additional per-user installation test (when both modes are enabled)
- ${{ if and(eq(parameters.useLatestOfficialBuild, true), eq(parameters.testBothInstallModes, true)) }}:
- template: job-test-project.yml
parameters:
platform: x64Win11
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
buildSource: ${{ parameters.buildSource }}
specificBuildId: ${{ parameters.specificBuildId }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
installMode: 'peruser'
jobSuffix: '_PerUser'
@@ -146,7 +143,7 @@ stages:
- ${{ if ne(platform, 'x64') }}:
- stage: Test_${{ platform }}
displayName: Test ${{ platform }}
${{ if ne(parameters.buildSource, 'buildNow') }}:
${{ if eq(parameters.useLatestOfficialBuild, true) }}:
dependsOn:
- BuildUITests_${{ platform }}
${{ else }}:
@@ -158,19 +155,19 @@ stages:
platform: ${{ platform }}
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
buildSource: ${{ parameters.buildSource }}
specificBuildId: ${{ parameters.specificBuildId }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
# Additional per-user installation test
- ${{ if ne(parameters.buildSource, 'buildNow') }}:
# Additional per-user installation test (when both modes are enabled)
- ${{ if and(eq(parameters.useLatestOfficialBuild, true), eq(parameters.testBothInstallModes, true)) }}:
- template: job-test-project.yml
parameters:
platform: ${{ platform }}
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
buildSource: ${{ parameters.buildSource }}
specificBuildId: ${{ parameters.specificBuildId }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
installMode: 'peruser'
jobSuffix: '_PerUser'
jobSuffix: '_PerUser'

View File

@@ -461,8 +461,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peek.Common", "src\modules\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peek.FilePreviewer", "src\modules\peek\Peek.FilePreviewer\Peek.FilePreviewer.csproj", "{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Peek.UITests", "src\modules\peek\Peek.UITests\Peek.UITests.csproj", "{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MarkdownPreviewHandlerCpp", "src\modules\previewpane\MarkdownPreviewHandlerCpp\MarkdownPreviewHandlerCpp.vcxproj", "{ED9A1AC6-AEB0-4569-A6E9-E1696182B545}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GcodePreviewHandlerCpp", "src\modules\previewpane\GcodePreviewHandlerCpp\GcodePreviewHandlerCpp.vcxproj", "{5A5DD09D-723A-44D3-8F2B-293584C3D731}"
@@ -1854,14 +1852,6 @@ Global
{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|ARM64.Build.0 = Release|ARM64
{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|x64.ActiveCfg = Release|x64
{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|x64.Build.0 = Release|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5}.Debug|ARM64.ActiveCfg = Debug|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5}.Debug|ARM64.Build.0 = Debug|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5}.Debug|x64.ActiveCfg = Debug|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5}.Debug|x64.Build.0 = Debug|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5}.Release|ARM64.ActiveCfg = Release|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5}.Release|ARM64.Build.0 = Release|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5}.Release|x64.ActiveCfg = Release|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5}.Release|x64.Build.0 = Release|x64
{ED9A1AC6-AEB0-4569-A6E9-E1696182B545}.Debug|ARM64.ActiveCfg = Debug|ARM64
{ED9A1AC6-AEB0-4569-A6E9-E1696182B545}.Debug|ARM64.Build.0 = Debug|ARM64
{ED9A1AC6-AEB0-4569-A6E9-E1696182B545}.Debug|x64.ActiveCfg = Debug|x64
@@ -2998,7 +2988,6 @@ Global
{9D7A6DE0-7D27-424D-ABAE-41B2161F9A03} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20}
{17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20}
{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20}
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A5} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20}
{ED9A1AC6-AEB0-4569-A6E9-E1696182B545} = {2F305555-C296-497E-AC20-5FA1B237996A}
{5A5DD09D-723A-44D3-8F2B-293584C3D731} = {2F305555-C296-497E-AC20-5FA1B237996A}
{B3E869C4-8210-4EBD-A621-FF4C4AFCBFA9} = {2F305555-C296-497E-AC20-5FA1B237996A}
@@ -3128,6 +3117,11 @@ Global
{D9BD324E-1D80-44AA-8E7B-73EB00944434} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
{8EF25507-2575-4ADE-BF7E-D23376903AB8} = {3846508C-77EB-4034-A702-F8BB263C4F79}
{070AC093-C9F2-20AD-0BCD-F318FC2761EA} = {B1234567-1234-1234-1234-123456789ABC}
{E816D7AC-4688-4ECB-97CC-3D8E798F3825} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
{E816D7AD-4688-4ECB-97CC-3D8E798F3826} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
{E816D7AE-4688-4ECB-97CC-3D8E798F3827} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
{E816D7AF-4688-4ECB-97CC-3D8E798F3828} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
{E816D7B0-4688-4ECB-97CC-3D8E798F3829} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
{2C318EC3-BA86-4372-B1BC-DB0F33C208B2} = {322566EF-20DC-43A6-B9F8-616AF942579A}
{BFFB607F-7C78-434B-86B9-DA4C8196A1B5} = {B6C42F16-73EB-477E-8B0D-4E6CF6C20AAC}
{66E1534A-1587-42B2-912F-45C994D32904} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
@@ -3145,11 +3139,6 @@ Global
{806BF185-8B89-5BE1-9AA1-DA5BC9487DB9} = {264B412F-DB8B-4CF8-A74B-96998B183045}
{F93C2817-C846-4259-84D8-B39A6B57C8DE} = {3527BF37-DFC5-4309-A032-29278CA21328}
{8131151D-B0E9-4E18-84A5-E5F946C4480A} = {929C1324-22E8-4412-A9A8-80E85F3985A5}
{E816D7AC-4688-4ECB-97CC-3D8E798F3825} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
{E816D7AD-4688-4ECB-97CC-3D8E798F3826} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
{E816D7AE-4688-4ECB-97CC-3D8E798F3827} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
{E816D7AF-4688-4ECB-97CC-3D8E798F3828} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
{E816D7B0-4688-4ECB-97CC-3D8E798F3829} = {8EF25507-2575-4ADE-BF7E-D23376903AB8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}

View File

@@ -22,23 +22,23 @@ The PowerToys UI test pipeline provides flexible options for building and testin
### Pipeline Options
- **buildSource**: Select the build type for testing:
- `latestOfficialBuild`: Downloads and uses the latest official PowerToys build from main branch
- `buildNow`: Builds PowerToys from current source code and uses it for testing
- `specificBuildId`: Downloads a specific PowerToys build using the build ID specified in `specificBuildId` parameter
- **useLatestOfficialBuild**: When checked, downloads the latest official PowerToys build and installs it for testing. This skips the full solution build and only builds UI test projects.
**Default value**: `latestOfficialBuild`
- **useCurrentBranchBuild**: When checked along with `useLatestOfficialBuild`, downloads the official build from the current branch instead of main.
- **specificBuildId**: When `buildSource` is set to `specificBuildId`, specify the exact PowerToys build ID to download and test against.
**Default value**: `"xxxx"` (placeholder, enter actual build ID when using specificBuildId option)
**Default value**: `false` (downloads from main branch)
**When to use this**:
- Testing against a specific known build for reproducibility
- Regression testing against a particular build version
- Validating fixes in a specific build before release
- **Default scenario**: The pipeline tests against the latest signed PowerToys build from the `main` branch, regardless of which branch your test code changes are from
- **Custom branch testing**: Only specify `true` when:
- Your branch has produced its own signed PowerToys build via the official build pipeline
- You want to test against that specific branch's PowerToys build instead of main
- You are testing PowerToys functionality changes that are only available in your branch's build
**Usage**: Enter the build ID number (e.g., `12345`) to download that specific build. Only used when `buildSource` is set to `specificBuildId`.
**Important notes**:
- The test pipeline itself runs from your specified branch, but by default tests against the main branch's PowerToys build
- Not all branches have signed builds available - only use this if you're certain your branch has a signed build
- If enabled but no build exists for your branch, the pipeline may fail or fall back to main
- **uiTestModules**: Specify which UI test modules to build and run. This parameter controls both the `.csproj` projects to build and the `.dll` test assemblies to execute. Examples:
- `['UITests-FancyZones']` - Only FancyZones UI tests
@@ -50,19 +50,19 @@ The PowerToys UI test pipeline provides flexible options for building and testin
### Build Modes
1. **Official Build Testing** (`buildSource = latestOfficialBuild` or `specificBuildId`)
- Downloads and installs official PowerToys build (latest from main or specific build ID)
- Builds only UI test projects (all or specific based on `uiTestModules`)
- Runs UI tests against installed PowerToys
- Tests both machine-level and per-user installation modes automatically
1. **Official Build + Selective Testing** (`useLatestOfficialBuild = true`)
- Downloads and installs official PowerToys build
- Builds only specified UI test projects
- Runs specified UI tests against installed PowerToys
- Controlled by `uiTestModules` parameter
2. **Current Source Build Testing** (`buildSource = buildNow`)
- Builds entire PowerToys solution from current source code
2. **Full Build + Testing** (`useLatestOfficialBuild = false`)
- Builds entire PowerToys solution
- Builds UI test projects (all or specific based on `uiTestModules`)
- Runs UI tests against freshly built PowerToys
- Uses artifacts from current pipeline build
- Runs UI tests (all or specific based on `uiTestModules`)
- Uses freshly built PowerToys for testing
> **Note**: All modes support the `uiTestModules` parameter to control which specific UI test modules to build and run. Both machine-level and per-user installation modes are tested automatically when using official builds.
> **Note**: Both modes support the `uiTestModules` parameter to control which specific UI test modules to build and run.
### Pipeline Access
- Pipeline: https://microsoft.visualstudio.com/Dart/_build?definitionId=161438&_a=summary

View File

@@ -2,8 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
namespace Microsoft.PowerToys.UITest
{
/// <summary>
@@ -27,9 +25,8 @@ namespace Microsoft.PowerToys.UITest
/// </summary>
/// <param name="value">The text to set.</param>
/// <param name="clearText">A value indicating whether to clear the text before setting it. Default value is true</param>
/// <param name="charDelayMS">Delay in milliseconds between each character. Default is 0 (no delay).</param>
/// <returns>The current TextBox instance.</returns>
public TextBox SetText(string value, bool clearText = true, int charDelayMS = 0)
public TextBox SetText(string value, bool clearText = true)
{
if (clearText)
{
@@ -42,36 +39,10 @@ namespace Microsoft.PowerToys.UITest
Task.Delay(500).Wait();
}
// TODO: CmdPal bug when inputting text, characters are swallowed too quickly.
// This should be fixed within CmdPal itself.
// Temporary workaround: introduce a delay between character inputs to avoid the issue
if (charDelayMS > 0 || EnvironmentConfig.IsInPipeline)
PerformAction((actions, windowElement) =>
{
// Send text character by character with delay (if specified or in pipeline)
PerformAction((actions, windowElement) =>
{
foreach (char c in value)
{
windowElement.SendKeys(c.ToString());
if (charDelayMS > 0)
{
Task.Delay(charDelayMS).Wait();
}
else if (EnvironmentConfig.IsInPipeline)
{
Task.Delay(50).Wait();
}
}
});
}
else
{
// No character delay - send all text at once (original behavior)
PerformAction((actions, windowElement) =>
{
windowElement.SendKeys(value);
});
}
windowElement.SendKeys(value);
});
return this;
}

View File

@@ -1,45 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Microsoft.PowerToys.UITest
{
/// <summary>
/// Centralized configuration for all environment variables used in UI tests.
/// </summary>
public static class EnvironmentConfig
{
private static readonly Lazy<bool> _isInPipeline = new(() =>
!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("platform")));
private static readonly Lazy<bool> _useInstallerForTest = new(() =>
{
string? envValue = Environment.GetEnvironmentVariable("useInstallerForTest") ??
Environment.GetEnvironmentVariable("USEINSTALLERFORTEST");
return !string.IsNullOrEmpty(envValue) && bool.TryParse(envValue, out bool result) && result;
});
private static readonly Lazy<string?> _platform = new(() =>
Environment.GetEnvironmentVariable("platform"));
/// <summary>
/// Gets a value indicating whether the tests are running in a CI/CD pipeline.
/// Determined by the presence of the "platform" environment variable.
/// </summary>
public static bool IsInPipeline => _isInPipeline.Value;
/// <summary>
/// Gets a value indicating whether to use installer paths for testing.
/// Checks both "useInstallerForTest" and "USEINSTALLERFORTEST" environment variables.
/// </summary>
public static bool UseInstallerForTest => _useInstallerForTest.Value;
/// <summary>
/// Gets the platform name from the environment variable.
/// Typically used in CI/CD pipelines to identify the build platform.
/// </summary>
public static string? Platform => _platform.Value;
}
}

View File

@@ -92,7 +92,9 @@ namespace Microsoft.PowerToys.UITest
private ModuleConfigData()
{
// Check if we should use installer paths from environment variable
UseInstallerForTest = EnvironmentConfig.UseInstallerForTest;
string? useInstallerForTestEnv =
Environment.GetEnvironmentVariable("useInstallerForTest") ?? Environment.GetEnvironmentVariable("USEINSTALLERFORTEST");
UseInstallerForTest = !string.IsNullOrEmpty(useInstallerForTestEnv) && bool.TryParse(useInstallerForTestEnv, out bool result) && result;
// Module information including executable name, window name, and optional subdirectory
ModuleInfo = new Dictionary<PowerToysModule, ModuleInfo>

View File

@@ -5,7 +5,6 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
@@ -38,9 +37,6 @@ namespace Microsoft.PowerToys.UITest
private PowerToysModule scope;
private string[]? commandLineArgs;
/// <summary>
/// Gets a value indicating whether to use installer paths for testing.
/// </summary>
private bool UseInstallerForTest { get; }
[UnconditionalSuppressMessage("SingleFile", "IL3000:Avoid accessing Assembly file path when publishing as a single file", Justification = "<Pending>")]
@@ -49,7 +45,9 @@ namespace Microsoft.PowerToys.UITest
this.scope = scope;
this.commandLineArgs = commandLineArgs;
this.sessionPath = ModuleConfigData.Instance.GetModulePath(scope);
UseInstallerForTest = EnvironmentConfig.UseInstallerForTest;
string? useInstallerForTestEnv =
Environment.GetEnvironmentVariable("useInstallerForTest") ?? Environment.GetEnvironmentVariable("USEINSTALLERFORTEST");
UseInstallerForTest = !string.IsNullOrEmpty(useInstallerForTestEnv) && bool.TryParse(useInstallerForTestEnv, out bool result) && result;
this.locationPath = UseInstallerForTest ? string.Empty : Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
CheckWinAppDriverAndRoot();
@@ -138,10 +136,6 @@ namespace Microsoft.PowerToys.UITest
{
TryLaunchPowerToysSettings(opts);
}
else if (scope == PowerToysModule.CommandPalette && UseInstallerForTest)
{
TryLaunchCommandPalette(opts);
}
else
{
opts.AddAdditionalCapability("app", appPath);
@@ -169,77 +163,48 @@ namespace Microsoft.PowerToys.UITest
private void TryLaunchPowerToysSettings(AppiumOptions opts)
{
try
CheckWinAppDriverAndRoot();
var runnerProcessInfo = new ProcessStartInfo
{
var runnerProcessInfo = new ProcessStartInfo
{
FileName = locationPath + runnerPath,
Verb = "runas",
Arguments = "--open-settings",
};
FileName = locationPath + runnerPath,
Verb = "runas",
Arguments = "--open-settings",
};
ExitExe(runnerProcessInfo.FileName);
runner = Process.Start(runnerProcessInfo);
ExitExe(runnerProcessInfo.FileName);
runner = Process.Start(runnerProcessInfo);
Thread.Sleep(5000);
WaitForWindowAndSetCapability(opts, "PowerToys Settings", 5000, 5);
// Exit CmdPal UI before launching new process if use installer for test
ExitExeByName("Microsoft.CmdPal.UI");
// Exit CmdPal UI before launching new process if use installer for test
ExitExeByName("Microsoft.CmdPal.UI");
}
catch (Exception ex)
if (root != null)
{
throw new InvalidOperationException($"Failed to launch PowerToys Settings: {ex.Message}", ex);
}
}
const int maxRetries = 5;
const int delayMs = 5000;
var windowName = "PowerToys Settings";
private void TryLaunchCommandPalette(AppiumOptions opts)
{
try
{
// Exit any existing CmdPal UI process
ExitExeByName("Microsoft.CmdPal.UI");
var processStartInfo = new ProcessStartInfo
for (int attempt = 1; attempt <= maxRetries; attempt++)
{
FileName = "cmd.exe",
Arguments = "/c start shell:appsFolder\\Microsoft.CommandPalette_8wekyb3d8bbwe!App",
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
};
var settingsWindow = ApiHelper.FindDesktopWindowHandler(
[windowName, AdministratorPrefix + windowName]);
var process = Process.Start(processStartInfo);
process?.WaitForExit();
if (settingsWindow.Count > 0)
{
var hexHwnd = settingsWindow[0].HWnd.ToString("x");
opts.AddAdditionalCapability("appTopLevelWindow", hexHwnd);
return;
}
WaitForWindowAndSetCapability(opts, "Command Palette", 5000, 10);
}
catch (Exception ex)
{
throw new InvalidOperationException($"Failed to launch Command Palette: {ex.Message}", ex);
}
}
private void WaitForWindowAndSetCapability(AppiumOptions opts, string windowName, int delayMs, int maxRetries)
{
for (int attempt = 1; attempt <= maxRetries; attempt++)
{
var window = ApiHelper.FindDesktopWindowHandler(
[windowName, AdministratorPrefix + windowName]);
if (window.Count > 0)
{
var hexHwnd = window[0].HWnd.ToString("x");
opts.AddAdditionalCapability("appTopLevelWindow", hexHwnd);
return;
}
if (attempt < maxRetries)
{
Thread.Sleep(delayMs);
}
else
{
throw new TimeoutException($"Failed to find {windowName} window after multiple attempts.");
if (attempt < maxRetries)
{
Thread.Sleep(delayMs);
}
else
{
throw new TimeoutException("Failed to find PowerToys Settings window after multiple attempts.");
}
}
}
}

View File

@@ -5,7 +5,6 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
@@ -21,9 +20,6 @@ namespace Microsoft.PowerToys.UITest
public required Session Session { get; set; }
/// <summary>
/// Gets a value indicating whether the tests are running in a CI/CD pipeline.
/// </summary>
public bool IsInPipeline { get; }
public string? ScreenshotDirectory { get; set; }
@@ -38,8 +34,8 @@ namespace Microsoft.PowerToys.UITest
public UITestBase(PowerToysModule scope = PowerToysModule.PowerToysSettings, WindowSize size = WindowSize.UnSpecified, string[]? commandLineArgs = null)
{
this.IsInPipeline = EnvironmentConfig.IsInPipeline;
Console.WriteLine($"Running tests on platform: {EnvironmentConfig.Platform}");
this.IsInPipeline = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("platform"));
Console.WriteLine($"Running tests on platform: {Environment.GetEnvironmentVariable("platform")}");
if (IsInPipeline)
{
NativeMethods.ChangeDisplayResolution(1920, 1080);
@@ -60,7 +56,6 @@ namespace Microsoft.PowerToys.UITest
[TestInitialize]
public void TestInit()
{
KeyboardHelper.SendKeys(Key.Win, Key.M);
CloseOtherApplications();
if (IsInPipeline)
{
@@ -252,174 +247,6 @@ namespace Microsoft.PowerToys.UITest
return this.Session.Has<Element>(name, timeoutMS, global);
}
/// <summary>
/// Finds an element using partial name matching (contains).
/// Useful for finding windows with variable titles like "filename.txt - Notepad" or "filename - Notepad".
/// </summary>
/// <typeparam name="T">The class of the element, should be Element or its derived class.</typeparam>
/// <param name="partialName">Part of the name to search for.</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found element.</returns>
protected T FindByPartialName<T>(string partialName, int timeoutMS = 5000, bool global = false)
where T : Element, new()
{
return Session.Find<T>(By.XPath($"//*[contains(@Name, '{partialName}')]"), timeoutMS, global);
}
/// <summary>
/// Finds an element using partial name matching (contains).
/// </summary>
/// <param name="partialName">Part of the name to search for.</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found element.</returns>
protected Element FindByPartialName(string partialName, int timeoutMS = 5000, bool global = false)
{
return FindByPartialName<Element>(partialName, timeoutMS, global);
}
/// <summary>
/// Base method for finding elements by selector and filtering by name pattern.
/// </summary>
/// <typeparam name="T">The class of the element, should be Element or its derived class.</typeparam>
/// <param name="selector">The selector to find initial candidates.</param>
/// <param name="namePattern">Pattern to match against the Name attribute. Supports regex patterns.</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <param name="errorMessage">Custom error message when no element is found.</param>
/// <returns>The found element.</returns>
private T FindByNamePattern<T>(By selector, string namePattern, int timeoutMS = 5000, bool global = false, string? errorMessage = null)
where T : Element, new()
{
var elements = Session.FindAll<T>(selector, timeoutMS, global);
var regex = new Regex(namePattern, RegexOptions.IgnoreCase);
foreach (var element in elements)
{
var name = element.GetAttribute("Name");
if (!string.IsNullOrEmpty(name) && regex.IsMatch(name))
{
return element;
}
}
throw new NoSuchElementException(errorMessage ?? $"No element found matching pattern: {namePattern}");
}
/// <summary>
/// Finds an element using regular expression pattern matching.
/// </summary>
/// <typeparam name="T">The class of the element, should be Element or its derived class.</typeparam>
/// <param name="pattern">Regular expression pattern to match against the Name attribute.</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found element.</returns>
protected T FindByPattern<T>(string pattern, int timeoutMS = 5000, bool global = false)
where T : Element, new()
{
return FindByNamePattern<T>(By.XPath("//*[@Name]"), pattern, timeoutMS, global, $"No element found matching pattern: {pattern}");
}
/// <summary>
/// Finds an element using regular expression pattern matching.
/// </summary>
/// <param name="pattern">Regular expression pattern to match against the Name attribute.</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found element.</returns>
protected Element FindByPattern(string pattern, int timeoutMS = 5000, bool global = false)
{
return FindByPattern<Element>(pattern, timeoutMS, global);
}
/// <summary>
/// Finds an element by ClassName only.
/// Returns the first element found with the specified ClassName.
/// </summary>
/// <typeparam name="T">The class of the element, should be Element or its derived class.</typeparam>
/// <param name="className">The ClassName to search for (e.g., "Notepad", "CabinetWClass").</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found element.</returns>
protected T FindByClassName<T>(string className, int timeoutMS = 5000, bool global = false)
where T : Element, new()
{
return Session.Find<T>(By.ClassName(className), timeoutMS, global);
}
/// <summary>
/// Finds an element by ClassName only.
/// Returns the first element found with the specified ClassName.
/// </summary>
/// <param name="className">The ClassName to search for (e.g., "Notepad", "CabinetWClass").</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found element.</returns>
protected Element FindByClassName(string className, int timeoutMS = 5000, bool global = false)
{
return FindByClassName<Element>(className, timeoutMS, global);
}
/// <summary>
/// Finds an element by ClassName and matches its Name attribute using regex pattern matching.
/// </summary>
/// <typeparam name="T">The class of the element, should be Element or its derived class.</typeparam>
/// <param name="className">The ClassName to search for (e.g., "Notepad", "CabinetWClass").</param>
/// <param name="namePattern">Pattern to match against the Name attribute. Supports regex patterns.</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found element.</returns>
protected T FindByClassNameAndNamePattern<T>(string className, string namePattern, int timeoutMS = 5000, bool global = false)
where T : Element, new()
{
return FindByNamePattern<T>(By.ClassName(className), namePattern, timeoutMS, global, $"No element with ClassName '{className}' found matching name pattern: {namePattern}");
}
/// <summary>
/// Finds an element by ClassName and matches its Name attribute using regex pattern matching.
/// </summary>
/// <param name="className">The ClassName to search for (e.g., "Notepad", "CabinetWClass").</param>
/// <param name="namePattern">Pattern to match against the Name attribute. Supports regex patterns.</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found element.</returns>
protected Element FindByClassNameAndNamePattern(string className, string namePattern, int timeoutMS = 5000, bool global = false)
{
return FindByClassNameAndNamePattern<Element>(className, namePattern, timeoutMS, global);
}
/// <summary>
/// Finds a Notepad window regardless of whether the file extension is shown in the title.
/// Handles both "filename.txt - Notepad" and "filename - Notepad" formats.
/// Uses ClassName to efficiently find Notepad windows first, then matches the filename.
/// </summary>
/// <param name="baseFileName">The base filename without extension (e.g., "test" for "test.txt").</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found Notepad window element.</returns>
protected Element FindNotepadWindow(string baseFileName, int timeoutMS = 5000, bool global = false)
{
string pattern = $@"^{Regex.Escape(baseFileName)}(\.\w+)?(\s*-\s*|\s+)Notepad$";
return FindByClassNameAndNamePattern("Notepad", pattern, timeoutMS, global);
}
/// <summary>
/// Finds an Explorer window regardless of the folder or file name display format.
/// Handles various Explorer window title formats like "FolderName", "FileName", "FolderName - File Explorer", etc.
/// Uses ClassName to efficiently find Explorer windows first, then matches the folder or file name.
/// </summary>
/// <param name="folderName">The folder or file name to search for (e.g., "Documents", "Desktop", "test.txt").</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found Explorer window element.</returns>
protected Element FindExplorerWindow(string folderName, int timeoutMS = 5000, bool global = false)
{
string pattern = $@"^{Regex.Escape(folderName)}(\s*-\s*(File\s+Explorer|Windows\s+Explorer))?$";
return FindByClassNameAndNamePattern("CabinetWClass", pattern, timeoutMS, global);
}
/// <summary>
/// Finds an Explorer window by partial folder path.
/// Useful when the full path might be displayed in the title.
/// </summary>
/// <param name="partialPath">Part of the folder path to search for.</param>
/// <param name="timeoutMS">The timeout in milliseconds (default is 5000).</param>
/// <returns>The found Explorer window element.</returns>
protected Element FindExplorerByPartialPath(string partialPath, int timeoutMS = 5000, bool global = false)
{
return FindByPartialName(partialPath, timeoutMS, global);
}
/// <summary>
/// Finds all elements by selector.
/// Shortcut for this.Session.FindAll<T>(by, timeoutMS)

View File

@@ -27,8 +27,10 @@ namespace Microsoft.PowerToys.UITest
[RequiresUnreferencedCode("This method uses reflection which may not be compatible with trimming.")]
public static void AreEqual(TestContext? testContext, Element element, string scenarioSubname = "")
{
var pipelinePlatform = Environment.GetEnvironmentVariable("platform");
// Perform visual validation only in the pipeline
if (!EnvironmentConfig.IsInPipeline)
if (string.IsNullOrEmpty(pipelinePlatform))
{
Console.WriteLine("Skip visual validation in the local run.");
return;
@@ -53,11 +55,11 @@ namespace Microsoft.PowerToys.UITest
if (string.IsNullOrWhiteSpace(scenarioSubname))
{
scenarioSubname = string.Join("_", callerClassName, callerName, EnvironmentConfig.Platform);
scenarioSubname = string.Join("_", callerClassName, callerName, pipelinePlatform);
}
else
{
scenarioSubname = string.Join("_", callerClassName, callerName, scenarioSubname.Trim(), EnvironmentConfig.Platform);
scenarioSubname = string.Join("_", callerClassName, callerName, scenarioSubname.Trim(), pipelinePlatform);
}
var baselineImageResourceName = callerMethod!.DeclaringType!.Assembly.GetManifestResourceNames().Where(name => name.Contains(scenarioSubname)).FirstOrDefault();

View File

@@ -342,7 +342,7 @@ public partial class CommandItemViewModel : ExtensionObjectViewModel, ICommandBa
var newContextMenu = more
.Select(item =>
{
if (item is ICommandContextItem contextItem)
if (item is CommandContextItem contextItem)
{
return new CommandContextItemViewModel(contextItem, PageContext) as IContextItemViewModel;
}

View File

@@ -113,7 +113,7 @@ public abstract partial class ContentPageViewModel : PageViewModel, ICommandBarC
.ToList()
.Select<IContextItem, IContextItemViewModel>(item =>
{
if (item is ICommandContextItem contextItem)
if (item is CommandContextItem contextItem)
{
return new CommandContextItemViewModel(contextItem, PageContext);
}
@@ -172,7 +172,7 @@ public abstract partial class ContentPageViewModel : PageViewModel, ICommandBarC
.ToList()
.Select(item =>
{
if (item is ICommandContextItem contextItem)
if (item is CommandContextItem contextItem)
{
return new CommandContextItemViewModel(contextItem, PageContext) as IContextItemViewModel;
}

View File

@@ -76,44 +76,44 @@
<Grid
x:Name="IconRoot"
Margin="8,0,0,0"
Tapped="PageIcon_Tapped"
Margin="3,0,-5,0"
Visibility="{x:Bind CurrentPageViewModel.IsNested, Mode=OneWay}">
<InfoBadge Visibility="{x:Bind CurrentPageViewModel.HasStatusMessage, Mode=OneWay}" Value="{x:Bind CurrentPageViewModel.StatusMessages.Count, Mode=OneWay}" />
<Grid.ContextFlyout>
<Flyout x:Name="StatusMessagesFlyout" Placement="TopEdgeAlignedLeft">
<ItemsRepeater
x:Name="MessagesDropdown"
Margin="-8"
ItemsSource="{x:Bind CurrentPageViewModel.StatusMessages, Mode=OneWay}"
Layout="{StaticResource VerticalStackLayout}">
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="coreViewModels:StatusMessageViewModel">
<StackPanel
Grid.Row="0"
Margin="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
CornerRadius="0">
<InfoBar
CornerRadius="{ThemeResource ControlCornerRadius}"
IsClosable="False"
IsOpen="True"
Message="{x:Bind Message, Mode=OneWay}"
Severity="{x:Bind State, Mode=OneWay, Converter={StaticResource MessageStateToSeverityConverter}}" />
</StackPanel>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</Flyout>
</Grid.ContextFlyout>
<Button
x:Name="StatusMessagesButton"
x:Uid="StatusMessagesButton"
Padding="4"
Style="{StaticResource SubtleButtonStyle}"
Visibility="{x:Bind CurrentPageViewModel.HasStatusMessage, Mode=OneWay}">
<InfoBadge Value="{x:Bind CurrentPageViewModel.StatusMessages.Count, Mode=OneWay}" />
<Button.Flyout>
<Flyout x:Name="StatusMessagesFlyout" Placement="TopEdgeAlignedLeft">
<ItemsRepeater
x:Name="MessagesDropdown"
Margin="-8"
ItemsSource="{x:Bind CurrentPageViewModel.StatusMessages, Mode=OneWay}"
Layout="{StaticResource VerticalStackLayout}">
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="coreViewModels:StatusMessageViewModel">
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
<InfoBar
CornerRadius="{ThemeResource ControlCornerRadius}"
IsClosable="False"
IsOpen="True"
Message="{x:Bind Message, Mode=OneWay}"
Severity="{x:Bind State, Mode=OneWay, Converter={StaticResource MessageStateToSeverityConverter}}" />
</StackPanel>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</Flyout>
</Button.Flyout>
</Button>
</Grid>
<Button
x:Name="SettingsIconButton"
x:Uid="SettingsButton"
Click="SettingsIcon_Clicked"
Style="{StaticResource SubtleButtonStyle}"
Tapped="SettingsIcon_Tapped"
Visibility="{x:Bind CurrentPageViewModel.IsNested, Mode=OneWay, Converter={StaticResource BoolToInvertedVisibilityConverter}}">
<StackPanel Orientation="Horizontal" Spacing="8">
<FontIcon
@@ -146,8 +146,8 @@
x:Load="{x:Bind IsLoaded, Mode=OneWay}"
AutomationProperties.Name="{x:Bind ViewModel.PrimaryCommand.Name, Mode=OneWay}"
Background="Transparent"
Click="PrimaryButton_Clicked"
Style="{StaticResource SubtleButtonStyle}"
Tapped="PrimaryButton_Tapped"
Visibility="{x:Bind ViewModel.HasPrimaryCommand, Mode=OneWay}">
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock
@@ -169,8 +169,8 @@
Padding="6,4,4,4"
x:Load="{x:Bind IsLoaded, Mode=OneWay}"
AutomationProperties.Name="{x:Bind ViewModel.SecondaryCommand.Name, Mode=OneWay}"
Click="SecondaryButton_Clicked"
Style="{StaticResource SubtleButtonStyle}"
Tapped="SecondaryButton_Tapped"
Visibility="{x:Bind ViewModel.HasSecondaryCommand, Mode=OneWay}">
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock
@@ -200,8 +200,8 @@
x:Name="MoreCommandsButton"
x:Uid="MoreCommandsButton"
Padding="4"
Click="MoreCommandsButton_Clicked"
Style="{StaticResource SubtleButtonStyle}"
Tapped="MoreCommandsButton_Tapped"
ToolTipService.ToolTip="Ctrl+K"
Visibility="{x:Bind ViewModel.ShouldShowContextMenu, Mode=OneWay}">
<StackPanel Orientation="Horizontal" Spacing="8">

View File

@@ -114,34 +114,23 @@ public sealed partial class CommandBar : UserControl,
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "VS has a tendency to delete XAML bound methods over-aggressively")]
private void PrimaryButton_Tapped(object sender, TappedRoutedEventArgs e)
private void PrimaryButton_Clicked(object sender, RoutedEventArgs e)
{
ViewModel.InvokePrimaryCommand();
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "VS has a tendency to delete XAML bound methods over-aggressively")]
private void SecondaryButton_Tapped(object sender, TappedRoutedEventArgs e)
private void SecondaryButton_Clicked(object sender, RoutedEventArgs e)
{
ViewModel.InvokeSecondaryCommand();
}
private void PageIcon_Tapped(object sender, TappedRoutedEventArgs e)
{
if (CurrentPageViewModel?.StatusMessages.Count > 0)
{
StatusMessagesFlyout.ShowAt(
placementTarget: IconRoot,
showOptions: new FlyoutShowOptions() { ShowMode = FlyoutShowMode.Standard });
}
}
private void SettingsIcon_Tapped(object sender, TappedRoutedEventArgs e)
private void SettingsIcon_Clicked(object sender, RoutedEventArgs e)
{
WeakReferenceMessenger.Default.Send<OpenSettingsMessage>();
e.Handled = true;
}
private void MoreCommandsButton_Tapped(object sender, TappedRoutedEventArgs e)
private void MoreCommandsButton_Clicked(object sender, RoutedEventArgs e)
{
WeakReferenceMessenger.Default.Send<OpenContextMenuMessage>(new OpenContextMenuMessage(null, null, null, ContextMenuFilterLocation.Bottom));
}

View File

@@ -113,13 +113,14 @@
<ListView
x:Name="ItemsList"
Padding="0,2,0,0"
ContextCanceled="ItemsList_OnContextCanceled"
ContextRequested="ItemsList_OnContextRequested"
DoubleTapped="ItemsList_DoubleTapped"
IsDoubleTapEnabled="True"
IsItemClickEnabled="True"
ItemClick="ItemsList_ItemClick"
ItemTemplate="{StaticResource ListItemViewModelTemplate}"
ItemsSource="{x:Bind ViewModel.FilteredItems, Mode=OneWay}"
RightTapped="ItemsList_RightTapped"
SelectionChanged="ItemsList_SelectionChanged">
<ListView.ItemContainerTransitions>
<TransitionCollection />

View File

@@ -316,30 +316,51 @@ public sealed partial class ListPage : Page,
return null;
}
private void ItemsList_RightTapped(object sender, RightTappedRoutedEventArgs e)
private void ItemsList_OnContextRequested(UIElement sender, ContextRequestedEventArgs e)
{
if (e.OriginalSource is FrameworkElement element &&
element.DataContext is ListItemViewModel item)
var (item, element) = e.OriginalSource switch
{
if (ItemsList.SelectedItem != item)
{
ItemsList.SelectedItem = item;
}
// caused by keyboard shortcut (e.g. Context menu key or Shift+F10)
ListViewItem listViewItem => (ItemsList.ItemFromContainer(listViewItem) as ListItemViewModel, listViewItem),
ViewModel?.UpdateSelectedItemCommand.Execute(item);
// caused by right-click on the ListViewItem
FrameworkElement { DataContext: ListItemViewModel itemViewModel } frameworkElement => (itemViewModel, frameworkElement),
var pos = e.GetPosition(element);
_ => (null, null),
};
_ = DispatcherQueue.TryEnqueue(
() =>
{
WeakReferenceMessenger.Default.Send<OpenContextMenuMessage>(
new OpenContextMenuMessage(
element,
Microsoft.UI.Xaml.Controls.Primitives.FlyoutPlacementMode.BottomEdgeAlignedLeft,
pos,
ContextMenuFilterLocation.Top));
});
if (item == null || element == null)
{
return;
}
if (ItemsList.SelectedItem != item)
{
ItemsList.SelectedItem = item;
}
ViewModel?.UpdateSelectedItemCommand.Execute(item);
if (!e.TryGetPosition(element, out var pos))
{
pos = new(0, element.ActualHeight);
}
_ = DispatcherQueue.TryEnqueue(
() =>
{
WeakReferenceMessenger.Default.Send<OpenContextMenuMessage>(
new OpenContextMenuMessage(
element,
Microsoft.UI.Xaml.Controls.Primitives.FlyoutPlacementMode.BottomEdgeAlignedLeft,
pos,
ContextMenuFilterLocation.Top));
});
e.Handled = true;
}
private void ItemsList_OnContextCanceled(UIElement sender, RoutedEventArgs e)
{
_ = DispatcherQueue.TryEnqueue(() => WeakReferenceMessenger.Default.Send<CloseContextMenuMessage>());
}
}

View File

@@ -225,11 +225,11 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
ui:VisualExtensions.NormalizedCenterPoint="0.5,0.5"
Click="BackButton_Clicked"
Content="{ui:FontIcon Glyph=&#xE76B;,
FontSize=14}"
FontSize="16"
Style="{StaticResource SubtleButtonStyle}"
Tapped="BackButton_Tapped"
Visibility="{x:Bind ViewModel.CurrentPage.IsNested, Mode=OneWay}">
<animations:Implicit.ShowAnimations>
<animations:OpacityAnimation

View File

@@ -413,7 +413,7 @@ public sealed partial class ShellPage : Microsoft.UI.Xaml.Controls.Page,
}
}
private void BackButton_Tapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e) => WeakReferenceMessenger.Default.Send<NavigateBackMessage>(new());
private void BackButton_Clicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) => WeakReferenceMessenger.Default.Send<NavigateBackMessage>(new());
private void RootFrame_Navigated(object sender, Microsoft.UI.Xaml.Navigation.NavigationEventArgs e)
{

View File

@@ -428,4 +428,10 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<data name="Settings_ExtensionPage_Alias_ToggleSwitch.OffContent" xml:space="preserve">
<value>Indirect</value>
</data>
<data name="StatusMessagesButton.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Show status messages</value>
</data>
<data name="StatusMessagesButton.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Show status messages</value>
</data>
</root>

View File

@@ -67,8 +67,9 @@ public class BasicTests : CommandPaletteTestBase
Assert.AreEqual(searchFileItem.Name, "Open Windows Terminal Profiles");
searchFileItem.DoubleClick();
// SetSearchBox("PowerShell");
// Assert.IsNotNull(this.Find<NavigationViewItem>("PowerShell"));
SetSearchBox("PowerShell");
Assert.IsNotNull(this.Find<NavigationViewItem>("PowerShell"));
}
[TestMethod]
@@ -94,9 +95,9 @@ public class BasicTests : CommandPaletteTestBase
Assert.AreEqual(searchFileItem.Name, "Registry");
searchFileItem.DoubleClick();
// Type the string will cause strange behavior.so comment it out for now.
// SetSearchBox(@"HKEY_LOCAL_MACHINE");
// Assert.IsNotNull(this.Find<NavigationViewItem>(@"HKEY_LOCAL_MACHINE\SECURITY"));
SetSearchBox("HKEY_LOCAL_MACHINE");
Assert.IsNotNull(this.Find<NavigationViewItem>("HKEY_LOCAL_MACHINE\\SECURITY"));
}
[TestMethod]

View File

@@ -45,27 +45,4 @@ public class CommandPaletteTestBase : UITestBase
Assert.IsNotNull(contextMenuButton, "Context menu button not found.");
contextMenuButton.Click();
}
protected void FindDefaultAppDialogAndClickButton()
{
try
{
// win11
var chooseDialog = FindByClassName("NamedContainerAutomationPeer", global: true);
chooseDialog.Find<Button>("Just once").Click();
}
catch
{
try
{
// win10
var chooseDialog = FindByClassName("Shell_Flyout", global: true);
chooseDialog.Find<Button>("OK").Click();
}
catch
{
}
}
}
}

View File

@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -19,7 +18,6 @@ public class IndexerTests : CommandPaletteTestBase
{
private const string TestFileContent = "This is Indexer UI test sample";
private const string TestFileName = "indexer_test_item.txt";
private const string TestFileBaseName = "indexer_test_item";
private const string TestFolderName = "Downloads";
public IndexerTests()
@@ -69,14 +67,11 @@ public class IndexerTests : CommandPaletteTestBase
searchItem.Click();
var openButton = this.Find<Button>("Open with");
var openButton = this.Find<Button>("Open");
Assert.IsNotNull(openButton);
openButton.Click();
FindDefaultAppDialogAndClickButton();
var notepadWindow = FindNotepadWindow(TestFileBaseName, global: true);
var notepadWindow = this.Find<Window>($"{TestFileName} - Notepad", global: true);
Assert.IsNotNull(notepadWindow);
}
@@ -93,9 +88,7 @@ public class IndexerTests : CommandPaletteTestBase
searchItem.DoubleClick();
FindDefaultAppDialogAndClickButton();
var notepadWindow = FindNotepadWindow(TestFileBaseName, global: true);
var notepadWindow = this.Find<Window>($"{TestFileName} - Notepad", global: true);
Assert.IsNotNull(notepadWindow);
}
@@ -114,9 +107,9 @@ public class IndexerTests : CommandPaletteTestBase
Assert.IsNotNull(openButton);
openButton.Click();
var fileExplorer = FindExplorerWindow(TestFolderName, global: true);
var notepadWindow = this.Find<Window>($"{TestFolderName} - File Explorer", global: true);
Assert.IsNotNull(fileExplorer);
Assert.IsNotNull(notepadWindow);
}
[TestMethod]
@@ -129,7 +122,7 @@ public class IndexerTests : CommandPaletteTestBase
Assert.IsNotNull(searchItem);
searchItem.DoubleClick();
var fileExplorer = FindExplorerWindow(TestFolderName, global: true);
var fileExplorer = this.Find<Window>($"{TestFolderName} - File Explorer", global: true);
Assert.IsNotNull(fileExplorer);
}
@@ -188,7 +181,7 @@ public class IndexerTests : CommandPaletteTestBase
Assert.IsNotNull(showInFolderButton);
showInFolderButton.Click();
var fileExplorer = FindExplorerWindow(TestFolderName, global: true, timeoutMS: 20000);
var fileExplorer = this.Find<Window>($"{TestFolderName} - File Explorer", global: true, timeoutMS: 20000);
Assert.IsNotNull(fileExplorer);
}
@@ -208,7 +201,7 @@ public class IndexerTests : CommandPaletteTestBase
Assert.IsNotNull(copyPathButton);
copyPathButton.Click();
var textItem = FindByPartialName("C:\\Windows\\system32\\cmd.exe", global: true);
var textItem = this.Find<Window>("C:\\Windows\\system32\\cmd.exe", global: true);
Assert.IsNotNull(textItem, "The console did not open with the expected path.");
}
@@ -227,7 +220,7 @@ public class IndexerTests : CommandPaletteTestBase
Assert.IsNotNull(copyPathButton);
copyPathButton.Click();
var propertiesWindow = FindByClassNameAndNamePattern<Window>("#32770", "Properties", global: true);
var propertiesWindow = this.Find<Window>($"{TestFileName} Properties", global: true);
Assert.IsNotNull(propertiesWindow, "The properties window did not open for the selected file.");
}
}

View File

@@ -5,7 +5,7 @@
<XesUseOneStoreVersioning>true</XesUseOneStoreVersioning>
<XesBaseYearForStoreVersion>2025</XesBaseYearForStoreVersion>
<VersionMajor>0</VersionMajor>
<VersionMinor>4</VersionMinor>
<VersionMinor>3</VersionMinor>
<VersionInfoProductName>Microsoft Command Palette</VersionInfoProductName>
</PropertyGroup>
</Project>

View File

@@ -154,11 +154,11 @@ internal sealed partial class FallbackExecuteItem : FallbackCommandItem, IDispos
else if (pathIsDir)
{
var pathItem = new PathListItem(exe, query, _addToHistory);
Command = pathItem.Command;
MoreCommands = pathItem.MoreCommands;
Title = pathItem.Title;
Subtitle = pathItem.Subtitle;
Icon = pathItem.Icon;
Command = pathItem.Command;
MoreCommands = pathItem.MoreCommands;
}
else if (System.Uri.TryCreate(searchText, UriKind.Absolute, out var uri))
{

View File

@@ -367,7 +367,7 @@ internal sealed partial class ShellListPage : DynamicListPage, IDisposable
}
// Easiest case: text is literally already a full directory
else if (Directory.Exists(trimmed) && trimmed.EndsWith('\\'))
else if (Directory.Exists(trimmed))
{
directoryPath = trimmed;
searchPattern = $"*";

View File

@@ -22,27 +22,15 @@ internal sealed partial class PathListItem : ListItem
: base(new OpenUrlWithHistoryCommand(path, addToHistory))
{
var fileName = Path.GetFileName(path);
if (string.IsNullOrEmpty(fileName))
{
fileName = Path.GetFileName(Path.GetDirectoryName(path)) ?? string.Empty;
}
_isDirectory = Directory.Exists(path);
if (_isDirectory)
{
if (!path.EndsWith('\\'))
{
path = path + "\\";
}
if (!fileName.EndsWith('\\'))
{
fileName = fileName + "\\";
}
path = path + "\\";
fileName = fileName + "\\";
}
Title = fileName; // Just the name of the file is the Title
Subtitle = path; // What the user typed is the subtitle
Title = fileName;
Subtitle = path;
// NOTE ME:
// If there are spaces on originalDir, trim them off, BEFORE combining originalDir and fileName.

View File

@@ -2,8 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CommandPalette.Extensions.Toolkit.Properties;
namespace Microsoft.CommandPalette.Extensions.Toolkit;
public partial class CopyPathCommand : InvokableCommand
@@ -12,12 +10,12 @@ public partial class CopyPathCommand : InvokableCommand
private readonly string _path;
public CommandResult Result { get; set; } = CommandResult.ShowToast(Resources.CopyPathTextCommand_Result);
public CommandResult Result { get; set; } = CommandResult.KeepOpen();
public CopyPathCommand(string fullPath)
{
this._path = fullPath;
this.Name = Resources.CopyPathTextCommand_Name;
this.Name = "Copy path";
this.Icon = CopyPath;
}

View File

@@ -69,24 +69,6 @@ namespace Microsoft.CommandPalette.Extensions.Toolkit.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Copy path.
/// </summary>
internal static string CopyPathTextCommand_Name {
get {
return ResourceManager.GetString("CopyPathTextCommand_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copied path to clipboard.
/// </summary>
internal static string CopyPathTextCommand_Result {
get {
return ResourceManager.GetString("CopyPathTextCommand_Result", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copied to clipboard.
/// </summary>

View File

@@ -126,12 +126,6 @@
<data name="CopyTextCommand_CopiedToClipboard" xml:space="preserve">
<value>Copied to clipboard</value>
</data>
<data name="CopyPathTextCommand_Name" xml:space="preserve">
<value>Copy path</value>
</data>
<data name="CopyPathTextCommand_Result" xml:space="preserve">
<value>Copied path to clipboard</value>
</data>
<data name="OpenUrlCommand_Open" xml:space="preserve">
<value>Open</value>
</data>

View File

@@ -26,13 +26,11 @@
<file src="Microsoft.CommandPalette.Extensions.targets" target="build\"/>
<!-- AnyCPU Managed dlls from SDK.Lib project -->
<file src="..\Microsoft.CommandPalette.Extensions.Toolkit\x64\release\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.dll" target="lib\net8.0-windows10.0.19041.0\"/>
<file src="..\Microsoft.CommandPalette.Extensions.Toolkit\x64\release\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.pdb" target="lib\net8.0-windows10.0.19041.0\"/>
<file src="..\Microsoft.CommandPalette.Extensions.Toolkit\x64\release\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.deps.json" target="lib\net8.0-windows10.0.19041.0\"/>
<!-- Native dlls and winmd from SDK cpp project -->
<!-- TODO: we may not need this, since there are no implementations in the Microsoft.CommandPalette.Extensions namespace -->
<file src="..\Microsoft.CommandPalette.Extensions\x64\release\Microsoft.CommandPalette.Extensions\Microsoft.CommandPalette.Extensions.dll" target="runtimes\win-x64\native\"/>
<file src="..\Microsoft.CommandPalette.Extensions\x64\release\Microsoft.CommandPalette.Extensions\Microsoft.CommandPalette.Extensions.pdb" target="runtimes\win-x64\native\"/>
<file src="..\Microsoft.CommandPalette.Extensions\arm64\release\Microsoft.CommandPalette.Extensions\Microsoft.CommandPalette.Extensions.dll" target="runtimes\win-arm64\native\"/>
<!-- Not putting the following into the lib folder because we don't want plugin project to directly reference the winmd -->

View File

@@ -78,7 +78,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public BoolProperty ShowTrayIcon { get; set; }
[JsonPropertyName("AnimnateZoom")]
public BoolProperty AnimateZoom { get; set; }
public IntProperty ZoominSliderLevel { get; set; }