Files
elwig/Tests/E2ETests/Utils.cs
Lorenz Stechauner 6b48a1090c
All checks were successful
Test / Run tests (push) Successful in 2m35s
E2ETests: Refactor initial class structure
2024-07-07 14:35:54 +02:00

28 lines
1.1 KiB
C#

using OpenQA.Selenium;
using OpenQA.Selenium.Appium.Windows;
namespace Tests.E2ETests {
public static class Utils {
public const string ApplicationPath = @"..\..\..\..\Elwig\bin\Debug\net8.0-windows\Elwig.exe";
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);
}
}
}