2025-07-18 16:22:37 +08:00
|
|
|
|
// 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]
|
2025-07-21 18:06:51 +08:00
|
|
|
|
public class BasicTests : CommandPaletteTestBase
|
2025-07-18 16:22:37 +08:00
|
|
|
|
{
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
[UI Tests] Enhance UI Test Automation and Pipeline Support for CmdPal Module (#40871)
<!-- 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
This pull request introduces enhancements to UI test automation,
improvements to pipeline configuration, and project structure updates.
The goal is to improve flexibility, maintainability, and efficiency in
PowerToys’ CI/CD processes.
### UI Test Enhancements:
Delayed Text Input Support
- UI tests now support character-by-character text input with
configurable delays.
- This serves as a workaround for a known CmdPal bug where input is
swallowed too quickly. The delay mitigates the issue until it is fixed
in CmdPal.
Centralized Environment Management
- Introduced a new class to centralize environment variable access for
UI test configuration.
CmdPal Launch Handling in Pipelines
- Adjusted test logic to handle CmdPal module startup specifically in CI
pipelines
### Pipeline Configuration Updates:
Build Artifact Customization
- Included test-related folders in pipeline build outputs for better
traceability.
Support for Build ID Targeting
- Added support for specifying PowerToys build IDs in test pipelines,
with conditional logic for specific or latest build selection.
<img width="264" height="44" alt="image"
src="https://github.com/user-attachments/assets/0d68a51e-e41a-4868-a1c3-f4233c56b0ee"
/>
### Project Structure Updates:
Added Peek.UITests back to the solution which removed by
https://github.com/microsoft/PowerToys/pull/40754
<!-- 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
2025-07-31 13:55:23 +08:00
|
|
|
|
// SetSearchBox("PowerShell");
|
|
|
|
|
|
// Assert.IsNotNull(this.Find<NavigationViewItem>("PowerShell"));
|
2025-07-18 16:22:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[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();
|
|
|
|
|
|
|
[UI Tests] Enhance UI Test Automation and Pipeline Support for CmdPal Module (#40871)
<!-- 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
This pull request introduces enhancements to UI test automation,
improvements to pipeline configuration, and project structure updates.
The goal is to improve flexibility, maintainability, and efficiency in
PowerToys’ CI/CD processes.
### UI Test Enhancements:
Delayed Text Input Support
- UI tests now support character-by-character text input with
configurable delays.
- This serves as a workaround for a known CmdPal bug where input is
swallowed too quickly. The delay mitigates the issue until it is fixed
in CmdPal.
Centralized Environment Management
- Introduced a new class to centralize environment variable access for
UI test configuration.
CmdPal Launch Handling in Pipelines
- Adjusted test logic to handle CmdPal module startup specifically in CI
pipelines
### Pipeline Configuration Updates:
Build Artifact Customization
- Included test-related folders in pipeline build outputs for better
traceability.
Support for Build ID Targeting
- Added support for specifying PowerToys build IDs in test pipelines,
with conditional logic for specific or latest build selection.
<img width="264" height="44" alt="image"
src="https://github.com/user-attachments/assets/0d68a51e-e41a-4868-a1c3-f4233c56b0ee"
/>
### Project Structure Updates:
Added Peek.UITests back to the solution which removed by
https://github.com/microsoft/PowerToys/pull/40754
<!-- 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
2025-07-31 13:55:23 +08:00
|
|
|
|
// 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"));
|
2025-07-18 16:22:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[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"));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|