Skip to content

Commit

Permalink
Editor templates tests update (#1667)
Browse files Browse the repository at this point in the history
* added zone count tests
* fixed launch flag
  • Loading branch information
SeraphimaZykova authored Mar 24, 2020
1 parent e32d619 commit 7c0c75c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,83 +60,129 @@ private void SaveTest()
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();
}

[TestMethod]
public void EditColumnsCancel()
{
OpenCreatorWindow("Columns", "Custom table layout creator");
ZoneCountTest(0, 3);

ChangeLayout();
ZoneCountTest(0, 4);

CancelTest();
}

[TestMethod]
public void EditRowsCancel()
{
OpenCreatorWindow("Rows", "Custom table layout creator");
ZoneCountTest(0, 3);

ChangeLayout();
ZoneCountTest(0, 4);

CancelTest();
}

[TestMethod]
public void EditGridCancel()
{
OpenCreatorWindow("Grid", "Custom table layout creator");
ZoneCountTest(0, 3);

ChangeLayout();
ZoneCountTest(0, 4);

CancelTest();
}

[TestMethod]
public void EditPriorityGridCancel()
{
OpenCreatorWindow("Priority Grid", "Custom table layout creator");
ZoneCountTest(0, 3);

ChangeLayout();
ZoneCountTest(0, 4);

CancelTest();
}

[TestMethod]
public void EditFocusSave()
{
OpenCreatorWindow("Focus", "Custom layout creator");
ZoneCountTest(3, 0);

session.FindElementByAccessibilityId("newZoneButton").Click();
ZoneCountTest(4, 0);

SaveTest();
}

[TestMethod]
public void EditColumnsSave()
{
OpenCreatorWindow("Columns", "Custom table layout creator");
ZoneCountTest(0, 3);

ChangeLayout();
ZoneCountTest(0, 4);

SaveTest();
}

[TestMethod]
public void EditRowsSave()
{
OpenCreatorWindow("Rows", "Custom table layout creator");
ZoneCountTest(0, 3);

ChangeLayout();
ZoneCountTest(0, 4);

SaveTest();
}

[TestMethod]
public void EditGridSave()
{
OpenCreatorWindow("Grid", "Custom table layout creator");
ZoneCountTest(0, 3);

ChangeLayout();
ZoneCountTest(0, 4);

SaveTest();
}

[TestMethod]
public void EditPriorityGridSave()
{
OpenCreatorWindow("Priority Grid", "Custom table layout creator");
ZoneCountTest(0, 3);

ChangeLayout();
ZoneCountTest(0, 4);

SaveTest();
}

Expand Down
8 changes: 5 additions & 3 deletions src/tests/win-app-driver/PowerToysSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@ public static void LaunchPowerToys()
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()
Expand Down

0 comments on commit 7c0c75c

Please sign in to comment.