-
Notifications
You must be signed in to change notification settings - Fork 7.8k
UI Test Automation for FindMyMouse Enable/Disable and MouseHighlighter Enable/Disable #38891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yaqingmi
merged 17 commits into
feature/UITestAutomation
from
dev/yaqingmi/ui-automation
Apr 21, 2025
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fe53a9c
empowering users to maximize OOBE to their heart desire (#37823)
crutkas 6174b76
Add More Elements support for UITestAutomation
8c4d360
Merge branch 'main' into dev/yaqingmi/ui-automation
764507c
Merge branch 'feature/UITestAutomation' into dev/yaqingmi/ui-automation
99cdc5e
Add Mouse Click and Base Components Test
9a21d0f
Merge branch 'feature/UITestAutomation' into dev/yaqingmi/ui-automation
fbdb3a6
Add FindMyMouse Tests for Enable and Disable
21d52bb
Add Mouse Highlighter Enable/Disable Test Case
1063d73
Add Mouse Actions Support for UITest Framework
23a361f
Merge branch 'feature/UITestAutomation' into dev/yaqingmi/ui-automation
6d9a30d
Delete src/modules/MouseUtils/FindMyMouse.UITests/FindMyMouseSettingT…
a1c649b
Update NameSpace and remove redundant code
fa8db5b
Update the SessionHelper and Sleep Time for Actions
ca04077
Merge branch 'feature/UITestAutomation' into dev/yaqingmi/ui-automation
56fc936
Add SendKey for Session and Fix Spelling Errors
d4f6208
Add Tests for Mouse Pointer Crosshairs Enable/Disable
4e582c7
Add Sleep Time to Action Parameters
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,28 @@ | ||
| // 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 | ||
| { | ||
| public class ComboBox : Element | ||
| { | ||
| private static readonly string ExpectedControlType = "ControlType.ComboBox"; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ComboBox"/> class. | ||
| /// </summary> | ||
| public ComboBox() | ||
| { | ||
| this.TargetControlType = ComboBox.ExpectedControlType; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Select the item of the ComboBox. | ||
| /// </summary> | ||
| /// <param name="value">The text to select from the list view.</param> | ||
| public void Select(string value) | ||
| { | ||
| this.Find<NavigationViewItem>(value).Click(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,25 @@ | ||
| // 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.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Microsoft.PowerToys.UITest | ||
| { | ||
| public class Custom : Element | ||
| { | ||
| private static readonly string ExpectedControlType = "ControlType.Custom"; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="Custom"/> class. | ||
| /// </summary> | ||
| public Custom() | ||
| { | ||
| this.TargetControlType = Custom.ExpectedControlType; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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,25 @@ | ||
| // 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.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Microsoft.PowerToys.UITest | ||
| { | ||
| public class Group : Element | ||
| { | ||
| private static readonly string ExpectedControlType = "ControlType.Group"; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="Group"/> class. | ||
| /// </summary> | ||
| public Group() | ||
| { | ||
| this.TargetControlType = Group.ExpectedControlType; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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,119 @@ | ||
| // 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 Microsoft.VisualStudio.TestTools.UnitTesting; | ||
| using OpenQA.Selenium.Appium.Windows; | ||
|
|
||
| namespace Microsoft.PowerToys.UITest | ||
| { | ||
| public class Slider : Element | ||
| { | ||
| private static readonly string ExpectedControlType = "ControlType.Slider"; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="Slider"/> class. | ||
| /// </summary> | ||
| public Slider() | ||
| { | ||
| this.TargetControlType = Slider.ExpectedControlType; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the value of a Slider (WindowsElement) | ||
| /// </summary> | ||
| /// <returns>The integer value of the slider</returns> | ||
| public int GetValue() | ||
| { | ||
| return this.Text == string.Empty ? 0 : int.Parse(this.Text); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the value of a Slider (WindowsElement) to the specified integer value. | ||
| /// Throws an exception if the value is out of the slider's valid range. | ||
| /// </summary> | ||
| /// <param name="targetValue">The target integer value to set</param> | ||
| public void SetValue(int targetValue) | ||
| { | ||
| // Read range and current value | ||
| int min = int.Parse(this.GetAttribute("RangeValue.Minimum")); | ||
| int max = int.Parse(this.GetAttribute("RangeValue.Maximum")); | ||
| int current = int.Parse(this.Text); | ||
|
|
||
| // Use Assert to check if the target value is within the valid range | ||
| Assert.IsTrue( | ||
| targetValue >= min && targetValue <= max, | ||
| $"Target value {targetValue} is out of range (min: {min}, max: {max})."); | ||
|
|
||
| // Compute difference | ||
| int diff = targetValue - current; | ||
| if (diff == 0) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| string key = diff > 0 ? OpenQA.Selenium.Keys.Right : OpenQA.Selenium.Keys.Left; | ||
| int steps = Math.Abs(diff); | ||
|
|
||
| for (int i = 0; i < steps; i++) | ||
| { | ||
| this.SendKeys(key); | ||
|
|
||
| // Thread.Sleep(2); | ||
| } | ||
|
|
||
| // Final check | ||
| int finalValue = int.Parse(this.Text); | ||
| Assert.AreEqual( | ||
| targetValue, finalValue, $"Slider value mismatch: expected {targetValue}, but got {finalValue}."); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the value of a Slider (WindowsElement) to the specified integer value. | ||
| /// Throws an exception if the value is out of the slider's valid range. | ||
| /// </summary> | ||
| /// <param name="targetValue">The target integer value to set</param> | ||
| public void QuickSetValue(int targetValue) | ||
yaqingmi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| // Read range and current value | ||
| int min = int.Parse(this.GetAttribute("RangeValue.Minimum")); | ||
| int max = int.Parse(this.GetAttribute("RangeValue.Maximum")); | ||
| int current = int.Parse(this.Text); | ||
|
|
||
| // Use Assert to check if the target value is within the valid range | ||
| Assert.IsTrue( | ||
| targetValue >= min && targetValue <= max, | ||
| $"Target value {targetValue} is out of range (min: {min}, max: {max})."); | ||
|
|
||
| // Compute difference | ||
| int diff = targetValue - current; | ||
| if (diff == 0) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| string key = diff > 0 ? OpenQA.Selenium.Keys.Right : OpenQA.Selenium.Keys.Left; | ||
| int steps = Math.Abs(diff); | ||
|
|
||
| int maxKeysPerSend = 50; | ||
| int fullChunks = steps / maxKeysPerSend; | ||
| int remainder = steps % maxKeysPerSend; | ||
| for (int i = 0; i < fullChunks; i++) | ||
| { | ||
| SendKeys(new string(key[0], maxKeysPerSend)); | ||
| Thread.Sleep(2); | ||
| } | ||
|
|
||
| if (remainder > 0) | ||
| { | ||
| SendKeys(new string(key[0], remainder)); | ||
| Thread.Sleep(2); | ||
| } | ||
|
|
||
| // Final check | ||
| int finalValue = int.Parse(this.Text); | ||
| Assert.AreEqual( | ||
| targetValue, finalValue, $"Slider value mismatch: expected {targetValue}, but got {finalValue}."); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.