diff --git a/src/tests/win-app-driver/FancyZonesTests/EditorTemplatesEditTests.cs b/src/tests/win-app-driver/FancyZonesTests/EditorTemplatesEditTests.cs index 116bf34455..48f944cee0 100644 --- a/src/tests/win-app-driver/FancyZonesTests/EditorTemplatesEditTests.cs +++ b/src/tests/win-app-driver/FancyZonesTests/EditorTemplatesEditTests.cs @@ -60,11 +60,21 @@ namespace PowerToysTests Assert.AreEqual(settings["custom-zone-sets"][0]["uuid"], settings["devices"][0]["active-zoneset"]["uuid"]); } + private void ZoneCountTest(int canvasZonesCount, int gridZonesCount) + { + Assert.AreEqual(canvasZonesCount, session.FindElementsByClassName("CanvasZone").Count); + Assert.AreEqual(gridZonesCount, session.FindElementsByClassName("GridZone").Count); + } + [TestMethod] public void EditFocusCancel() { OpenCreatorWindow("Focus", "Custom layout creator"); + ZoneCountTest(3, 0); + session.FindElementByAccessibilityId("newZoneButton").Click(); + ZoneCountTest(4, 0); + CancelTest(); } @@ -72,7 +82,11 @@ namespace PowerToysTests public void EditColumnsCancel() { OpenCreatorWindow("Columns", "Custom table layout creator"); + ZoneCountTest(0, 3); + ChangeLayout(); + ZoneCountTest(0, 4); + CancelTest(); } @@ -80,7 +94,11 @@ namespace PowerToysTests public void EditRowsCancel() { OpenCreatorWindow("Rows", "Custom table layout creator"); + ZoneCountTest(0, 3); + ChangeLayout(); + ZoneCountTest(0, 4); + CancelTest(); } @@ -88,7 +106,11 @@ namespace PowerToysTests public void EditGridCancel() { OpenCreatorWindow("Grid", "Custom table layout creator"); + ZoneCountTest(0, 3); + ChangeLayout(); + ZoneCountTest(0, 4); + CancelTest(); } @@ -96,7 +118,11 @@ namespace PowerToysTests public void EditPriorityGridCancel() { OpenCreatorWindow("Priority Grid", "Custom table layout creator"); + ZoneCountTest(0, 3); + ChangeLayout(); + ZoneCountTest(0, 4); + CancelTest(); } @@ -104,7 +130,11 @@ namespace PowerToysTests public void EditFocusSave() { OpenCreatorWindow("Focus", "Custom layout creator"); + ZoneCountTest(3, 0); + session.FindElementByAccessibilityId("newZoneButton").Click(); + ZoneCountTest(4, 0); + SaveTest(); } @@ -112,7 +142,11 @@ namespace PowerToysTests public void EditColumnsSave() { OpenCreatorWindow("Columns", "Custom table layout creator"); + ZoneCountTest(0, 3); + ChangeLayout(); + ZoneCountTest(0, 4); + SaveTest(); } @@ -120,7 +154,11 @@ namespace PowerToysTests public void EditRowsSave() { OpenCreatorWindow("Rows", "Custom table layout creator"); + ZoneCountTest(0, 3); + ChangeLayout(); + ZoneCountTest(0, 4); + SaveTest(); } @@ -128,7 +166,11 @@ namespace PowerToysTests public void EditGridSave() { OpenCreatorWindow("Grid", "Custom table layout creator"); + ZoneCountTest(0, 3); + ChangeLayout(); + ZoneCountTest(0, 4); + SaveTest(); } @@ -136,7 +178,11 @@ namespace PowerToysTests public void EditPriorityGridSave() { OpenCreatorWindow("Priority Grid", "Custom table layout creator"); + ZoneCountTest(0, 3); + ChangeLayout(); + ZoneCountTest(0, 4); + SaveTest(); } diff --git a/src/tests/win-app-driver/PowerToysSession.cs b/src/tests/win-app-driver/PowerToysSession.cs index 896697b012..d12e2857d7 100644 --- a/src/tests/win-app-driver/PowerToysSession.cs +++ b/src/tests/win-app-driver/PowerToysSession.cs @@ -206,12 +206,14 @@ namespace PowerToysTests WindowsDriver driver = new WindowsDriver(new Uri(WindowsApplicationDriverUrl), opts); Assert.IsNotNull(driver); driver.LaunchApp(); - isPowerToysLaunched = true; } - catch (OpenQA.Selenium.WebDriverException) + catch (OpenQA.Selenium.WebDriverException ex) { + Console.WriteLine("Exception on PowerToys launch:" + ex.Message); //exception could be thrown even if app launched successfully - } + } + + isPowerToysLaunched = true; } public static void ExitPowerToys()