diff --git a/src/modules/fancyzones/UITests-FancyZones/Init.cs b/src/modules/fancyzones/UITests-FancyZones/Init.cs deleted file mode 100644 index 7890a75f0cd0..000000000000 --- a/src/modules/fancyzones/UITests-FancyZones/Init.cs +++ /dev/null @@ -1,36 +0,0 @@ -// 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.Diagnostics; - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.FancyZonesEditor.UITests -{ - [TestClass] - public class Init - { - private static Process? appDriver; - - [AssemblyInitialize] - public static void SetupAll(TestContext context) - { - string winAppDriverPath = "C:\\Program Files (x86)\\Windows Application Driver\\WinAppDriver.exe"; - context.WriteLine($"Attempting to launch WinAppDriver at: {winAppDriverPath}"); - appDriver = Process.Start(winAppDriverPath); - } - - [AssemblyCleanup] - public static void CleanupAll() - { - try - { - appDriver?.Kill(); - } - catch - { - } - } - } -} diff --git a/src/modules/fancyzones/UITests-FancyZones/RunFancyZonesTest.cs b/src/modules/fancyzones/UITests-FancyZones/RunFancyZonesTest.cs index c67d9c04c008..230f7339331d 100644 --- a/src/modules/fancyzones/UITests-FancyZones/RunFancyZonesTest.cs +++ b/src/modules/fancyzones/UITests-FancyZones/RunFancyZonesTest.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.FancyZones.UnitTests.Utils; +using Microsoft.UITests.API; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace UITests_FancyZones @@ -10,24 +11,43 @@ namespace UITests_FancyZones [TestClass] public class RunFancyZonesTest { - private static FancyZonesSession? _session; + private const string PowerToysPath = @"\..\..\..\WinUI3Apps\PowerToys.Settings.exe"; + private static UITestAPI? _uITestAPI; + + private static TestContext? _context; [ClassInitialize] public static void ClassInitialize(TestContext testContext) { - _session = new FancyZonesSession(testContext); } [ClassCleanup] public static void ClassCleanup() { - _session?.Close(); + } + + [TestInitialize] + public void TestInitialize() + { + _uITestAPI = new UITestAPI(); + _uITestAPI.Init(PowerToysPath); + } + + [TestCleanup] + public void TestCleanup() + { + if (_uITestAPI != null && _context != null) + { + _uITestAPI.Close(_context); + } + + _context = null; } [TestMethod] public void RunFancyZones() { - Assert.IsNotNull(_session?.FancyZonesProcess); + Assert.IsNotNull(_uITestAPI); } } } diff --git a/src/modules/fancyzones/UITests-FancyZones/UITests-FancyZones.csproj b/src/modules/fancyzones/UITests-FancyZones/UITests-FancyZones.csproj index 1ded556e9527..33f706126e80 100644 --- a/src/modules/fancyzones/UITests-FancyZones/UITests-FancyZones.csproj +++ b/src/modules/fancyzones/UITests-FancyZones/UITests-FancyZones.csproj @@ -23,6 +23,7 @@ + \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml index 0e26afcaace6..6d73e71c7301 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml @@ -12,7 +12,8 @@ xmlns:viewmodels="using:Microsoft.PowerToys.Settings.UI.ViewModels" AutomationProperties.LandmarkType="Main" DataContext="DashboardViewModel" - mc:Ignorable="d"> + mc:Ignorable="d" + x:Name="MainWindow1">