mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
Merge branch 'main' of https://github.com/microsoft/PowerToys into leilzh/peekuitests
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Microsoft.PowerToys.UITest
|
||||
Runner,
|
||||
Workspaces,
|
||||
PowerRename,
|
||||
CommandPalette,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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"),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
151
src/modules/cmdpal/Microsoft.CmdPal.UITests/BasicTests.cs
Normal file
151
src/modules/cmdpal/Microsoft.CmdPal.UITests/BasicTests.cs
Normal file
@@ -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<TextBox>("Type here to search...").SetText(text, true).Text, text);
|
||||
}
|
||||
|
||||
private void SetFilesExtensionSearchBox(string text)
|
||||
{
|
||||
Assert.AreEqual(this.Find<TextBox>("Search for files and folders...").SetText(text, true).Text, text);
|
||||
}
|
||||
|
||||
private void SetCalculatorExtensionSearchBox(string text)
|
||||
{
|
||||
Assert.AreEqual(this.Find<TextBox>("Type an equation...").SetText(text, true).Text, text);
|
||||
}
|
||||
|
||||
private void SetTimeAndDaterExtensionSearchBox(string text)
|
||||
{
|
||||
Assert.AreEqual(this.Find<TextBox>("Search values or type a custom time stamp...").SetText(text, true).Text, text);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BasicFileSearchTest()
|
||||
{
|
||||
SetSearchBox("files");
|
||||
|
||||
var searchFileItem = this.Find<NavigationViewItem>("Search files");
|
||||
Assert.AreEqual(searchFileItem.Name, "Search files");
|
||||
searchFileItem.DoubleClick();
|
||||
|
||||
SetFilesExtensionSearchBox("AppData");
|
||||
|
||||
Assert.IsNotNull(this.Find<NavigationViewItem>("AppData"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BasicCalculatorTest()
|
||||
{
|
||||
SetSearchBox("calculator");
|
||||
|
||||
var searchFileItem = this.Find<NavigationViewItem>("Calculator");
|
||||
Assert.AreEqual(searchFileItem.Name, "Calculator");
|
||||
searchFileItem.DoubleClick();
|
||||
|
||||
SetCalculatorExtensionSearchBox("1+2");
|
||||
|
||||
Assert.IsNotNull(this.Find<NavigationViewItem>("3"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BasicTimeAndDateTest()
|
||||
{
|
||||
SetSearchBox("time and date");
|
||||
|
||||
var searchFileItem = this.Find<NavigationViewItem>("Time and Date");
|
||||
Assert.AreEqual(searchFileItem.Name, "Time and Date");
|
||||
searchFileItem.DoubleClick();
|
||||
|
||||
SetTimeAndDaterExtensionSearchBox("year");
|
||||
|
||||
Assert.IsNotNull(this.Find<NavigationViewItem>("2025"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BasicWindowsTerminalTest()
|
||||
{
|
||||
SetSearchBox("Windows Terminal");
|
||||
|
||||
var searchFileItem = this.Find<NavigationViewItem>("Open Windows Terminal Profiles");
|
||||
Assert.AreEqual(searchFileItem.Name, "Open Windows Terminal Profiles");
|
||||
searchFileItem.DoubleClick();
|
||||
|
||||
SetSearchBox("PowerShell");
|
||||
|
||||
Assert.IsNotNull(this.Find<NavigationViewItem>("PowerShell"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BasicWindowsSettingsTest()
|
||||
{
|
||||
SetSearchBox("Windows Settings");
|
||||
|
||||
var searchFileItem = this.Find<NavigationViewItem>("Windows Settings");
|
||||
Assert.AreEqual(searchFileItem.Name, "Windows Settings");
|
||||
searchFileItem.DoubleClick();
|
||||
|
||||
SetSearchBox("power");
|
||||
|
||||
Assert.IsNotNull(this.Find<NavigationViewItem>("Power and sleep"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BasicRegistryTest()
|
||||
{
|
||||
SetSearchBox("Registry");
|
||||
|
||||
var searchFileItem = this.Find<NavigationViewItem>("Registry");
|
||||
Assert.AreEqual(searchFileItem.Name, "Registry");
|
||||
searchFileItem.DoubleClick();
|
||||
|
||||
SetSearchBox("HKEY_LOCAL_MACHINE");
|
||||
|
||||
Assert.IsNotNull(this.Find<NavigationViewItem>("HKEY_LOCAL_MACHINE\\SECURITY"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BasicWindowsServicesTest()
|
||||
{
|
||||
SetSearchBox("Windows Services");
|
||||
|
||||
var searchFileItem = this.Find<NavigationViewItem>("Windows Services");
|
||||
Assert.AreEqual(searchFileItem.Name, "Windows Services");
|
||||
searchFileItem.DoubleClick();
|
||||
|
||||
SetSearchBox("hyper-v");
|
||||
|
||||
Assert.IsNotNull(this.Find<NavigationViewItem>("Hyper-V Heartbeat Service"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void BasicWindowsSystemCommandsTest()
|
||||
{
|
||||
SetSearchBox("Windows System Commands");
|
||||
|
||||
var searchFileItem = this.Find<NavigationViewItem>("Windows System Commands");
|
||||
Assert.AreEqual(searchFileItem.Name, "Windows System Commands");
|
||||
searchFileItem.DoubleClick();
|
||||
|
||||
SetSearchBox("Sleep");
|
||||
|
||||
Assert.IsNotNull(this.Find<NavigationViewItem>("Sleep"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Microsoft.CmdPal.UITests</RootNamespace>
|
||||
<AssemblyName>Microsoft.CmdPal.UITests</AssemblyName>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<!-- This is a UI test, so don't run as part of MSBuild -->
|
||||
<RunVSTest>false</RunVSTest>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\tests\Microsoft.CmdPal.UITests\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MSTest" />
|
||||
<PackageReference Include="System.Net.Http" />
|
||||
<PackageReference Include="System.Private.Uri" />
|
||||
<PackageReference Include="System.Text.RegularExpressions" />
|
||||
<ProjectReference Include="..\..\..\common\UITestAutomation\UITestAutomation.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user