# UI tests framework A specialized UI test framework for PowerToys that makes it easy to write UI tests for PowerToys modules or settings. Let's start writing UI tests! ## Before running tests - Install Windows Application Driver v1.2.1 from https://github.com/microsoft/WinAppDriver/releases/tag/v1.2.1 to the default directory (`C:\Program Files (x86)\Windows Application Driver`) - Enable Developer Mode in Windows settings ## Running tests - Exit PowerToys if it's running. - Open `PowerToys.sln` in Visual Studio and build the solution. - Run tests in the Test Explorer (`Test > Test Explorer` or `Ctrl+E, T`). ## How to add the first UI tests for your modules - Create a new project and add the following references to the project file. Change the OutputPath to your own module's path. ``` Library false ..\..\..\..\$(Platform)\$(Configuration)\tests\KeyboardManagerUITests\ ``` - Inherit your test class from UITestBase. >Set Scope: The default scope starts from the PowerToys settings UI. If you want to start from your own module, set the constructor as shown below: >Specify Scope: ``` [TestClass] public class RunFancyZonesTest : UITestBase { public RunFancyZonesTest() : base(PowerToysModule.FancyZone) { } } ``` - Then you can start using session to perform the UI operations. **Example** ``` using Microsoft.PowerToys.UITest; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace UITests_KeyboardManager { [TestClass] public class RunKeyboardManagerUITests : UITestBase { [TestMethod] public void OpenKeyboardManagerEditor() { // Open KeyboardManagerEditor this.Session.Find