32 lines
1.4 KiB
C#
32 lines
1.4 KiB
C#
using OpenQA.Selenium;
|
|
using OpenQA.Selenium.Appium.Windows;
|
|
|
|
namespace Tests.E2ETests {
|
|
public static class Utils {
|
|
|
|
public const int WINDOW_OPEN_SLEEP = 2000;
|
|
|
|
public static readonly string ApplicationPath = Path.GetFullPath(@"..\..\..\..\Elwig\bin\Debug\net8.0-windows\Elwig.exe");
|
|
public static readonly string ConfigPath = Path.GetFullPath(@"..\..\..\..\Tests\config.test.ini");
|
|
public static readonly string TestDatabasePath = Path.GetFullPath(@"..\..\..\..\Tests\ElwigTestDB.sqlite3");
|
|
|
|
public static WindowsElement FindById(this WindowsDriver<WindowsElement> session, string accessibilityId) {
|
|
return session.FindElementByAccessibilityId(accessibilityId);
|
|
}
|
|
|
|
public static void SelectComboBoxItemByCount(this WindowsDriver<WindowsElement> session, string accessibilityId, int count) {
|
|
var element = session.FindElementByAccessibilityId(accessibilityId);
|
|
element.Click();
|
|
element.SendKeys(string.Concat(Enumerable.Repeat(Keys.Down, count)));
|
|
element.SendKeys(Keys.Enter);
|
|
}
|
|
|
|
public static void SelectComboBoxItemByText(this WindowsDriver<WindowsElement> session, string accessibilityId, string text) {
|
|
var element = session.FindElementByAccessibilityId(accessibilityId);
|
|
element.Click();
|
|
element.SendKeys(text);
|
|
element.SendKeys(Keys.Enter);
|
|
}
|
|
}
|
|
}
|