-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Hosts] Converting manual release-check-list tests to UI-Test Automat…
…ion and Adding more UI-Test-cases (#37657) * Add more UI-Test, refactor UITestAutomation * Convert manual test-case to automation UI-Tests: Validating Empty-view is shown if no entries in the list. Validating Empty-view is NOT shown if 1 or more entries in the list. Validating Add-an-entry HyperlinkButton in Empty-view works correctly. Validating Adding-entry Button works correctly. Validating the Add button should be Disabled if more than 9 hosts in one entry. Validating the Add button should be Enabled if less or equal 9 hosts in one entry. Validating error message should be shown if not run as admin. Validating Warning-Dialog will be shown if 'Show a warning at startup' toggle is On. Validating Warning-Dialog will NOT be shown if 'Show a warning at startup' toggle is Off. Validating click 'Quit' button in Warning-Dialog, the Hosts File Editor window would be closed. Validating click 'Accept' button in Warning-Dialog, the Hosts File Editor window would NOT be closed. --------- Co-authored-by: Jerry Xu <[email protected]> Co-authored-by: Copilot <[email protected]>
- Loading branch information
1 parent
8a2d474
commit 22e29d1
Showing
14 changed files
with
838 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 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. | ||
|
||
namespace Microsoft.PowerToys.UITest | ||
{ | ||
/// <summary> | ||
/// Represents a HyperLinkButton in the UI test environment. | ||
/// HyperLinkButton represents a button control that functions as a hyperlink. | ||
/// </summary> | ||
public class HyperlinkButton : Button | ||
{ | ||
private static readonly string ExpectedControlType = "ControlType.HyperLink"; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="HyperlinkButton"/> class. | ||
/// </summary> | ||
public HyperlinkButton() | ||
{ | ||
this.TargetControlType = HyperlinkButton.ExpectedControlType; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// 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. | ||
|
||
namespace Microsoft.PowerToys.UITest | ||
{ | ||
/// <summary> | ||
/// Represents a NavigationViewItem in the UI test environment. | ||
/// NavigationViewItem represents the container for an item in a NavigationView control. | ||
/// </summary> | ||
public class NavigationViewItem : Element | ||
{ | ||
private static readonly string ExpectedControlType = "ControlType.ListItem"; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="NavigationViewItem"/> class. | ||
/// </summary> | ||
public NavigationViewItem() | ||
{ | ||
this.TargetControlType = NavigationViewItem.ExpectedControlType; | ||
} | ||
|
||
/// <summary> | ||
/// Click the ListItem element. | ||
/// </summary> | ||
/// <param name="rightClick">If true, performs a right-click; otherwise, performs a left-click. Default value is false</param> | ||
public override void Click(bool rightClick = false) | ||
{ | ||
PerformAction((actions, windowElement) => | ||
{ | ||
actions.MoveToElement(windowElement, 10, 10); | ||
|
||
if (rightClick) | ||
{ | ||
actions.ContextClick(); | ||
} | ||
else | ||
{ | ||
actions.Click(); | ||
} | ||
|
||
actions.Build().Perform(); | ||
}); | ||
} | ||
|
||
/// <summary> | ||
/// Double Click the ListItem element. | ||
/// </summary> | ||
public override void DoubleClick() | ||
{ | ||
PerformAction((actions, windowElement) => | ||
{ | ||
actions.MoveToElement(windowElement, 10, 10); | ||
actions.DoubleClick(); | ||
actions.Build().Perform(); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 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. | ||
|
||
namespace Microsoft.PowerToys.UITest | ||
{ | ||
/// <summary> | ||
/// Represents a TextBlock in the UI test environment. | ||
/// TextBlock provides a lightweight control for displaying small amounts of flow content. | ||
/// </summary> | ||
public class TextBlock : Element | ||
{ | ||
private static readonly string ExpectedControlType = "ControlType.Text"; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TextBlock"/> class. | ||
/// </summary> | ||
public TextBlock() | ||
{ | ||
this.TargetControlType = TextBlock.ExpectedControlType; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.