Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test method for Fancy Zones count #2

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
05e1854
added test project
SeraphimaZykova Feb 26, 2020
280c6f4
launch power toys for tests automatically
SeraphimaZykova Feb 27, 2020
7cf26ab
open and close settings methods added
SeraphimaZykova Feb 27, 2020
4ce22fe
tests for settings opening and app exit
SeraphimaZykova Feb 27, 2020
41a9e9b
added FancyZones tests
SeraphimaZykova Mar 2, 2020
e9db2c8
toggles double click tests
SeraphimaZykova Mar 2, 2020
09ceaf3
moved common function
SeraphimaZykova Mar 3, 2020
7c14ab2
keep settings file unchanged after tests
SeraphimaZykova Mar 3, 2020
199b60c
toggles click tests
SeraphimaZykova Mar 3, 2020
576702b
opacity highlight input tests
SeraphimaZykova Mar 3, 2020
5d4514f
clear button test
SeraphimaZykova Mar 3, 2020
c7bc6b3
refactoring
SeraphimaZykova Mar 4, 2020
413052b
test color sliders
SeraphimaZykova Mar 4, 2020
6d01de5
test color inputs
SeraphimaZykova Mar 4, 2020
b66840a
refactoring
SeraphimaZykova Mar 5, 2020
afaa528
added test for excluded apps input
SeraphimaZykova Mar 5, 2020
c9c4d70
exit without saving tests
SeraphimaZykova Mar 5, 2020
1000d33
added test for hotkeys
SeraphimaZykova Mar 9, 2020
76b1ec5
added test case for excluded apps
SeraphimaZykova Mar 9, 2020
ebfa312
fixed elements search
SeraphimaZykova Mar 10, 2020
cc3293e
refactoring
SeraphimaZykova Mar 11, 2020
c1751e5
updated toggles tests
SeraphimaZykova Mar 11, 2020
6b432a9
README update
SeraphimaZykova Mar 11, 2020
b124ce0
fix settings reading
SeraphimaZykova Mar 13, 2020
d4978e3
readme update
SeraphimaZykova Mar 13, 2020
3e3b4f0
updated link in readme
SeraphimaZykova Mar 13, 2020
38bbcc3
added test plan for editor
SeraphimaZykova Mar 13, 2020
4f73ba1
resolved conflicts after rebase
SeraphimaZykova Mar 16, 2020
9cf991c
fixed warnings
SeraphimaZykova Mar 16, 2020
f2d54ba
added editor tests file
SeraphimaZykova Mar 16, 2020
ce3f1fb
moved fancy zones opening method
SeraphimaZykova Mar 16, 2020
ded6440
moved settings restore to base class
SeraphimaZykova Mar 17, 2020
6e2e89c
Added test method for Fancy Zones count
yevhenii44 Mar 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 100 additions & 17 deletions PowerToys.sln

Large diffs are not rendered by default.

102 changes: 102 additions & 0 deletions src/tests/win-app-driver/FancyZonesTests/EditorTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium.Windows;

namespace PowerToysTests
{
[TestClass]
public class FancyZonesEditorTests : PowerToysSession
{
[TestMethod]
public void OpenEditorBySettingsButton()
{
OpenFancyZonesSettings();

WindowsElement editorButton = session.FindElementByXPath("//Button[@Name=\"Edit zones\"]");
Assert.IsNotNull(editorButton);

editorButton.Click();
ShortWait();

WindowsElement editorWindow = session.FindElementByXPath("//Window[@Name=\"FancyZones Editor\"]");
Assert.IsNotNull(editorWindow);

//Close editor
session.FindElementByAccessibilityId("PART_Close").Click();
}

[TestMethod]
public void ZoneCount()
{

WaitSeconds(1);

OpenFancyZonesSettings();

WaitSeconds(1);

WindowsElement editorButton = session.FindElementByXPath("//Button[@Name=\"Edit zones\"]");
Assert.IsNotNull(editorButton);
editorButton.Click();

WaitSeconds(1);

WindowsElement minusButton = session.FindElementByAccessibilityId("decrementZones");
Assert.IsNotNull(minusButton);

WindowsElement plusButton = session.FindElementByAccessibilityId("incrementZones");
Assert.IsNotNull(plusButton);

WindowsElement zoneCount = session.FindElementByAccessibilityId("zoneCount");
Assert.IsNotNull(zoneCount);

int zoneCountQty;
Assert.IsTrue(Int32.TryParse(zoneCount.Text, out zoneCountQty));

for (int i = zoneCountQty; i > -5; --i)
{
Assert.IsTrue(Int32.TryParse(zoneCount.Text, out zoneCountQty));
Assert.AreEqual(Math.Max(i, 1), zoneCountQty);
minusButton.Click();
}

for (int i = 1; i < 45; ++i)
{
Assert.IsTrue(Int32.TryParse(zoneCount.Text, out zoneCountQty));
Assert.AreEqual(Math.Min(i, 40), zoneCountQty);
plusButton.Click();
}

WindowsElement mainWindow = session.FindElementByAccessibilityId("MainWindow1");
Assert.IsNotNull(mainWindow);
mainWindow.SendKeys(Keys.Alt + Keys.F4);
}

[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
Setup(context);
OpenSettings();
}

[ClassCleanup]
public static void ClassCleanup()
{
CloseSettings();
TearDown();
}

[TestInitialize]
public void TestInitialize()
{

}

[TestCleanup]
public void TestCleanup()
{

}
}
}
Loading