Refactored HomePageTests

This commit is contained in:
2025-11-06 19:28:16 +01:00
parent d22f69b000
commit beec75416e
2 changed files with 38 additions and 18 deletions

View File

@@ -7,6 +7,8 @@ namespace Berufsschule_HAM.E2ETests.Helper;
public static class AppHelper
{
public const string ServerUrl = "http://localhost:5275";
public static Uri ServerUri = new(ServerUrl);
public static async Task<Process> StartApp(string appUrl)
{
var startInfo = new ProcessStartInfo
@@ -44,9 +46,17 @@ public static class AppHelper
throw new Exception("Server did not start within 60 seconds");
}
public static void Login(ChromeDriver driver, string serverUrl)
public static ChromeDriver GetChromeDriver()
{
driver.Navigate().GoToUrl(serverUrl);
var options = new ChromeOptions();
//options.AddArgument("--headless");
return new ChromeDriver(options);
}
public static void Login(ChromeDriver driver)
{
driver.Navigate().GoToUrl(ServerUrl);
IWebElement username = driver.FindElement(By.Id("username"));
username.SendKeys("admin");
IWebElement password = driver.FindElement(By.Id("password"));