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"]);
}
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();
}

View File

@ -206,12 +206,14 @@ namespace PowerToysTests
WindowsDriver<WindowsElement> driver = new WindowsDriver<WindowsElement>(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()