Editor templates tests update (#1667)

* added zone count tests
* fixed launch flag
This commit is contained in:
Seraphima Zykova 2020-03-24 17:27:22 +03:00 committed by GitHub
parent e32d619677
commit 7c0c75ca42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 3 deletions

View File

@ -60,11 +60,21 @@ namespace PowerToysTests
Assert.AreEqual(settings["custom-zone-sets"][0]["uuid"], settings["devices"][0]["active-zoneset"]["uuid"]); 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] [TestMethod]
public void EditFocusCancel() public void EditFocusCancel()
{ {
OpenCreatorWindow("Focus", "Custom layout creator"); OpenCreatorWindow("Focus", "Custom layout creator");
ZoneCountTest(3, 0);
session.FindElementByAccessibilityId("newZoneButton").Click(); session.FindElementByAccessibilityId("newZoneButton").Click();
ZoneCountTest(4, 0);
CancelTest(); CancelTest();
} }
@ -72,7 +82,11 @@ namespace PowerToysTests
public void EditColumnsCancel() public void EditColumnsCancel()
{ {
OpenCreatorWindow("Columns", "Custom table layout creator"); OpenCreatorWindow("Columns", "Custom table layout creator");
ZoneCountTest(0, 3);
ChangeLayout(); ChangeLayout();
ZoneCountTest(0, 4);
CancelTest(); CancelTest();
} }
@ -80,7 +94,11 @@ namespace PowerToysTests
public void EditRowsCancel() public void EditRowsCancel()
{ {
OpenCreatorWindow("Rows", "Custom table layout creator"); OpenCreatorWindow("Rows", "Custom table layout creator");
ZoneCountTest(0, 3);
ChangeLayout(); ChangeLayout();
ZoneCountTest(0, 4);
CancelTest(); CancelTest();
} }
@ -88,7 +106,11 @@ namespace PowerToysTests
public void EditGridCancel() public void EditGridCancel()
{ {
OpenCreatorWindow("Grid", "Custom table layout creator"); OpenCreatorWindow("Grid", "Custom table layout creator");
ZoneCountTest(0, 3);
ChangeLayout(); ChangeLayout();
ZoneCountTest(0, 4);
CancelTest(); CancelTest();
} }
@ -96,7 +118,11 @@ namespace PowerToysTests
public void EditPriorityGridCancel() public void EditPriorityGridCancel()
{ {
OpenCreatorWindow("Priority Grid", "Custom table layout creator"); OpenCreatorWindow("Priority Grid", "Custom table layout creator");
ZoneCountTest(0, 3);
ChangeLayout(); ChangeLayout();
ZoneCountTest(0, 4);
CancelTest(); CancelTest();
} }
@ -104,7 +130,11 @@ namespace PowerToysTests
public void EditFocusSave() public void EditFocusSave()
{ {
OpenCreatorWindow("Focus", "Custom layout creator"); OpenCreatorWindow("Focus", "Custom layout creator");
ZoneCountTest(3, 0);
session.FindElementByAccessibilityId("newZoneButton").Click(); session.FindElementByAccessibilityId("newZoneButton").Click();
ZoneCountTest(4, 0);
SaveTest(); SaveTest();
} }
@ -112,7 +142,11 @@ namespace PowerToysTests
public void EditColumnsSave() public void EditColumnsSave()
{ {
OpenCreatorWindow("Columns", "Custom table layout creator"); OpenCreatorWindow("Columns", "Custom table layout creator");
ZoneCountTest(0, 3);
ChangeLayout(); ChangeLayout();
ZoneCountTest(0, 4);
SaveTest(); SaveTest();
} }
@ -120,7 +154,11 @@ namespace PowerToysTests
public void EditRowsSave() public void EditRowsSave()
{ {
OpenCreatorWindow("Rows", "Custom table layout creator"); OpenCreatorWindow("Rows", "Custom table layout creator");
ZoneCountTest(0, 3);
ChangeLayout(); ChangeLayout();
ZoneCountTest(0, 4);
SaveTest(); SaveTest();
} }
@ -128,7 +166,11 @@ namespace PowerToysTests
public void EditGridSave() public void EditGridSave()
{ {
OpenCreatorWindow("Grid", "Custom table layout creator"); OpenCreatorWindow("Grid", "Custom table layout creator");
ZoneCountTest(0, 3);
ChangeLayout(); ChangeLayout();
ZoneCountTest(0, 4);
SaveTest(); SaveTest();
} }
@ -136,7 +178,11 @@ namespace PowerToysTests
public void EditPriorityGridSave() public void EditPriorityGridSave()
{ {
OpenCreatorWindow("Priority Grid", "Custom table layout creator"); OpenCreatorWindow("Priority Grid", "Custom table layout creator");
ZoneCountTest(0, 3);
ChangeLayout(); ChangeLayout();
ZoneCountTest(0, 4);
SaveTest(); SaveTest();
} }

View File

@ -206,12 +206,14 @@ namespace PowerToysTests
WindowsDriver<WindowsElement> driver = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), opts); WindowsDriver<WindowsElement> driver = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), opts);
Assert.IsNotNull(driver); Assert.IsNotNull(driver);
driver.LaunchApp(); 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 //exception could be thrown even if app launched successfully
} }
isPowerToysLaunched = true;
} }
public static void ExitPowerToys() public static void ExitPowerToys()