mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
[Tests] Fix PowerToys.sln to make cmdpal unit tests listed in the Test folder (#40804)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request 1. Just change the sln to show cmdpal unit test in the Tests folder. 2. Move cmdpal UITest into Tests folder <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: #xxx - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
This commit is contained in:
130
src/modules/cmdpal/Tests/Microsoft.CmdPal.UITests/BasicTests.cs
Normal file
130
src/modules/cmdpal/Tests/Microsoft.CmdPal.UITests/BasicTests.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
// 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 : CommandPaletteTestBase
|
||||
{
|
||||
public BasicTests()
|
||||
{
|
||||
}
|
||||
|
||||
[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"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user