mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
WinAppDriver tests update (#5882)
* tray button fix * settings closing changed * ignore old settings tests * changed test init * changed launch * separated app history file * select enabled modules on launch
This commit is contained in:
@@ -17,7 +17,7 @@ namespace PowerToysTests
|
||||
OpenSettings();
|
||||
|
||||
//check settings window opened
|
||||
WindowsElement settingsWindow = WaitElementByName("PowerToys Settings");
|
||||
WindowsElement settingsWindow = session.FindElementByName("PowerToys Settings");
|
||||
Assert.IsNotNull(settingsWindow);
|
||||
|
||||
isSettingsOpened = true;
|
||||
@@ -28,19 +28,20 @@ namespace PowerToysTests
|
||||
{
|
||||
//open tray
|
||||
trayButton.Click();
|
||||
WaitSeconds(1);
|
||||
isTrayOpened = true;
|
||||
|
||||
//open PowerToys context menu
|
||||
WindowsElement pt = session.FindElementByName("PowerToys");
|
||||
AppiumWebElement pt = PowerToysTrayButton();
|
||||
Assert.IsNotNull(pt);
|
||||
|
||||
new Actions(session).MoveToElement(pt).ContextClick().Perform();
|
||||
|
||||
//open settings
|
||||
WaitElementByXPath("//MenuItem[@Name=\"Settings\"]").Click();
|
||||
session.FindElementByXPath("//MenuItem[@Name=\"Settings\"]").Click();
|
||||
|
||||
//check settings window opened
|
||||
WindowsElement settingsWindow = WaitElementByName("PowerToys Settings");
|
||||
WindowsElement settingsWindow = session.FindElementByName("PowerToys Settings");
|
||||
Assert.IsNotNull(settingsWindow);
|
||||
|
||||
isSettingsOpened = true;
|
||||
@@ -52,24 +53,21 @@ namespace PowerToysTests
|
||||
//open PowerToys context menu
|
||||
trayButton.Click();
|
||||
isTrayOpened = true;
|
||||
WaitSeconds(1);
|
||||
|
||||
WindowsElement notificationOverflow = session.FindElementByName("Notification Overflow");
|
||||
AppiumWebElement overflowArea = notificationOverflow.FindElementByName("Overflow Notification Area");
|
||||
AppiumWebElement powerToys = overflowArea.FindElementByName("PowerToys");
|
||||
AppiumWebElement powerToys = PowerToysTrayButton();
|
||||
Assert.IsNotNull(powerToys);
|
||||
|
||||
new Actions(session).MoveToElement(powerToys).ContextClick().Perform();
|
||||
|
||||
//exit
|
||||
WaitElementByXPath("//MenuItem[@Name=\"Exit\"]").Click();
|
||||
session.FindElementByAccessibilityId("40001").Click();
|
||||
|
||||
//check PowerToys exited
|
||||
powerToys = null;
|
||||
try
|
||||
{
|
||||
notificationOverflow = session.FindElementByName("Notification Overflow");
|
||||
overflowArea = notificationOverflow.FindElementByName("Overflow Notification Area");
|
||||
powerToys = overflowArea.FindElementByName("PowerToys");
|
||||
powerToys = PowerToysTrayButton();
|
||||
}
|
||||
catch (OpenQA.Selenium.WebDriverException)
|
||||
{
|
||||
@@ -84,20 +82,24 @@ namespace PowerToysTests
|
||||
public static void ClassInitialize(TestContext context)
|
||||
{
|
||||
Setup(context);
|
||||
Assert.IsNotNull(session);
|
||||
|
||||
if (!isPowerToysLaunched)
|
||||
{
|
||||
LaunchPowerToys();
|
||||
}
|
||||
}
|
||||
|
||||
[ClassCleanup]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
ExitPowerToys();
|
||||
TearDown();
|
||||
}
|
||||
|
||||
[TestInitialize]
|
||||
public void TestInitialize()
|
||||
{
|
||||
if (session == null)
|
||||
return;
|
||||
|
||||
isSettingsOpened = false;
|
||||
isTrayOpened = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user