diff --git a/PowerToys.sln b/PowerToys.sln index f1400a602e..517a8b5d7a 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -742,6 +742,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{02EA681E-C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.CmdPal.Core.ViewModels", "src\modules\cmdpal\Microsoft.CmdPal.Core.ViewModels\Microsoft.CmdPal.Core.ViewModels.csproj", "{24133F7F-C1D1-DE04-EFA8-F5D5467FE027}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.CmdPal.UITests", "src\modules\cmdpal\Microsoft.CmdPal.UITests\Microsoft.CmdPal.UITests.csproj", "{840455DF-5634-51BB-D937-9D7D32F0B0C2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -2748,6 +2750,14 @@ Global {BCDC7246-F4F8-4EED-8DE6-037AA2E7C6D1}.Release|ARM64.Build.0 = Release|ARM64 {BCDC7246-F4F8-4EED-8DE6-037AA2E7C6D1}.Release|x64.ActiveCfg = Release|x64 {BCDC7246-F4F8-4EED-8DE6-037AA2E7C6D1}.Release|x64.Build.0 = Release|x64 + {840455DF-5634-51BB-D937-9D7D32F0B0C2}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {840455DF-5634-51BB-D937-9D7D32F0B0C2}.Debug|ARM64.Build.0 = Debug|ARM64 + {840455DF-5634-51BB-D937-9D7D32F0B0C2}.Debug|x64.ActiveCfg = Debug|x64 + {840455DF-5634-51BB-D937-9D7D32F0B0C2}.Debug|x64.Build.0 = Debug|x64 + {840455DF-5634-51BB-D937-9D7D32F0B0C2}.Release|ARM64.ActiveCfg = Release|ARM64 + {840455DF-5634-51BB-D937-9D7D32F0B0C2}.Release|ARM64.Build.0 = Release|ARM64 + {840455DF-5634-51BB-D937-9D7D32F0B0C2}.Release|x64.ActiveCfg = Release|x64 + {840455DF-5634-51BB-D937-9D7D32F0B0C2}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3036,6 +3046,7 @@ Global {24133F7F-C1D1-DE04-EFA8-F5D5467FE027} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} {9D3F3793-EFE3-4525-8782-238015DABA62} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3} {BCDC7246-F4F8-4EED-8DE6-037AA2E7C6D1} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20} + {840455DF-5634-51BB-D937-9D7D32F0B0C2} = {7520A2FE-00A2-49B8-83ED-DB216E874C04} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0} diff --git a/src/common/UITestAutomation/ModuleConfigData.cs b/src/common/UITestAutomation/ModuleConfigData.cs index 56b8789251..456e893659 100644 --- a/src/common/UITestAutomation/ModuleConfigData.cs +++ b/src/common/UITestAutomation/ModuleConfigData.cs @@ -32,6 +32,7 @@ namespace Microsoft.PowerToys.UITest Runner, Workspaces, PowerRename, + CommandPalette, } /// @@ -104,6 +105,7 @@ namespace Microsoft.PowerToys.UITest [PowerToysModule.Runner] = new ModuleInfo("PowerToys.exe", "PowerToys"), [PowerToysModule.Workspaces] = new ModuleInfo("PowerToys.WorkspacesEditor.exe", "Workspaces Editor"), [PowerToysModule.PowerRename] = new ModuleInfo("PowerToys.PowerRename.exe", "PowerRename", "WinUI3Apps"), + [PowerToysModule.CommandPalette] = new ModuleInfo("Microsoft.CmdPal.UI.exe", "PowerToys Command Palette", "WinUI3Apps\\CmdPal"), }; } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UITests/BasicTests.cs b/src/modules/cmdpal/Microsoft.CmdPal.UITests/BasicTests.cs new file mode 100644 index 0000000000..c1eea18d98 --- /dev/null +++ b/src/modules/cmdpal/Microsoft.CmdPal.UITests/BasicTests.cs @@ -0,0 +1,151 @@ +// 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; +using System.Threading.Tasks; +using Microsoft.PowerToys.UITest; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Microsoft.CmdPal.UITests; + +[TestClass] +public class BasicTests : UITestBase +{ + public BasicTests() + : base(PowerToysModule.CommandPalette) + { + } + + private void SetSearchBox(string text) + { + Assert.AreEqual(this.Find("Type here to search...").SetText(text, true).Text, text); + } + + private void SetFilesExtensionSearchBox(string text) + { + Assert.AreEqual(this.Find("Search for files and folders...").SetText(text, true).Text, text); + } + + private void SetCalculatorExtensionSearchBox(string text) + { + Assert.AreEqual(this.Find("Type an equation...").SetText(text, true).Text, text); + } + + private void SetTimeAndDaterExtensionSearchBox(string text) + { + Assert.AreEqual(this.Find("Search values or type a custom time stamp...").SetText(text, true).Text, text); + } + + [TestMethod] + public void BasicFileSearchTest() + { + SetSearchBox("files"); + + var searchFileItem = this.Find("Search files"); + Assert.AreEqual(searchFileItem.Name, "Search files"); + searchFileItem.DoubleClick(); + + SetFilesExtensionSearchBox("AppData"); + + Assert.IsNotNull(this.Find("AppData")); + } + + [TestMethod] + public void BasicCalculatorTest() + { + SetSearchBox("calculator"); + + var searchFileItem = this.Find("Calculator"); + Assert.AreEqual(searchFileItem.Name, "Calculator"); + searchFileItem.DoubleClick(); + + SetCalculatorExtensionSearchBox("1+2"); + + Assert.IsNotNull(this.Find("3")); + } + + [TestMethod] + public void BasicTimeAndDateTest() + { + SetSearchBox("time and date"); + + var searchFileItem = this.Find("Time and Date"); + Assert.AreEqual(searchFileItem.Name, "Time and Date"); + searchFileItem.DoubleClick(); + + SetTimeAndDaterExtensionSearchBox("year"); + + Assert.IsNotNull(this.Find("2025")); + } + + [TestMethod] + public void BasicWindowsTerminalTest() + { + SetSearchBox("Windows Terminal"); + + var searchFileItem = this.Find("Open Windows Terminal Profiles"); + Assert.AreEqual(searchFileItem.Name, "Open Windows Terminal Profiles"); + searchFileItem.DoubleClick(); + + SetSearchBox("PowerShell"); + + Assert.IsNotNull(this.Find("PowerShell")); + } + + [TestMethod] + public void BasicWindowsSettingsTest() + { + SetSearchBox("Windows Settings"); + + var searchFileItem = this.Find("Windows Settings"); + Assert.AreEqual(searchFileItem.Name, "Windows Settings"); + searchFileItem.DoubleClick(); + + SetSearchBox("power"); + + Assert.IsNotNull(this.Find("Power and sleep")); + } + + [TestMethod] + public void BasicRegistryTest() + { + SetSearchBox("Registry"); + + var searchFileItem = this.Find("Registry"); + Assert.AreEqual(searchFileItem.Name, "Registry"); + searchFileItem.DoubleClick(); + + SetSearchBox("HKEY_LOCAL_MACHINE"); + + Assert.IsNotNull(this.Find("HKEY_LOCAL_MACHINE\\SECURITY")); + } + + [TestMethod] + public void BasicWindowsServicesTest() + { + SetSearchBox("Windows Services"); + + var searchFileItem = this.Find("Windows Services"); + Assert.AreEqual(searchFileItem.Name, "Windows Services"); + searchFileItem.DoubleClick(); + + SetSearchBox("hyper-v"); + + Assert.IsNotNull(this.Find("Hyper-V Heartbeat Service")); + } + + [TestMethod] + public void BasicWindowsSystemCommandsTest() + { + SetSearchBox("Windows System Commands"); + + var searchFileItem = this.Find("Windows System Commands"); + Assert.AreEqual(searchFileItem.Name, "Windows System Commands"); + searchFileItem.DoubleClick(); + + SetSearchBox("Sleep"); + + Assert.IsNotNull(this.Find("Sleep")); + } +} diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UITests/Microsoft.CmdPal.UITests.csproj b/src/modules/cmdpal/Microsoft.CmdPal.UITests/Microsoft.CmdPal.UITests.csproj new file mode 100644 index 0000000000..8518a381c8 --- /dev/null +++ b/src/modules/cmdpal/Microsoft.CmdPal.UITests/Microsoft.CmdPal.UITests.csproj @@ -0,0 +1,26 @@ + + + + + Microsoft.CmdPal.UITests + Microsoft.CmdPal.UITests + false + true + enable + Library + + false + + + + $(SolutionDir)$(Platform)\$(Configuration)\tests\Microsoft.CmdPal.UITests\ + + + + + + + + + + \ No newline at end of file