diff --git a/src/common/UITestAutomation/Element/Element.cs b/src/common/UITestAutomation/Element/Element.cs
index ade8ff2488..865ec86c63 100644
--- a/src/common/UITestAutomation/Element/Element.cs
+++ b/src/common/UITestAutomation/Element/Element.cs
@@ -200,6 +200,12 @@ namespace Microsoft.PowerToys.UITest
});
}
+ ///
+ /// Simulates holding a key, clicking and dragging a UI element to the specified screen coordinates.
+ ///
+ /// The keyboard key to press and hold during the drag operation.
+ /// The target X-coordinate to drag the element to.
+ /// The target Y-coordinate to drag the element to.
public void KeyDownAndDrag(Key key, int targetX, int targetY)
{
PerformAction((actions, windowElement) =>
diff --git a/src/common/UITestAutomation/Session.cs b/src/common/UITestAutomation/Session.cs
index 08fde7160a..715cd2cc08 100644
--- a/src/common/UITestAutomation/Session.cs
+++ b/src/common/UITestAutomation/Session.cs
@@ -427,6 +427,24 @@ namespace Microsoft.PowerToys.UITest
});
}
+ ///
+ /// release the key (after the hold key and drag is completed.)
+ ///
+ /// The key release.
+ public void PressKey(Key key)
+ {
+ KeyboardHelper.PressKey(key);
+ }
+
+ ///
+ /// press and hold the specified key.
+ ///
+ /// The key to press and hold .
+ public void ReleaseKey(Key key)
+ {
+ KeyboardHelper.ReleaseKey(key);
+ }
+
///
/// Sends a sequence of keys.
///