Added HomePage_ShouldContainButtons E2E test, added login helper

This commit is contained in:
2025-11-06 18:11:43 +01:00
parent c02c18617c
commit d22f69b000
2 changed files with 33 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
using System.Diagnostics;
using System.Net;
using Microsoft.AspNetCore.Mvc.Routing;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace Berufsschule_HAM.E2ETests.Helper;
@@ -42,4 +43,16 @@ public static class AppHelper
}
throw new Exception("Server did not start within 60 seconds");
}
public static void Login(ChromeDriver driver, string serverUrl)
{
driver.Navigate().GoToUrl(serverUrl);
IWebElement username = driver.FindElement(By.Id("username"));
username.SendKeys("admin");
IWebElement password = driver.FindElement(By.Id("password"));
password.SendKeys("Test1234.");
IWebElement submit = driver.FindElement(By.CssSelector("button[type=\"submit\"]"));
submit.Click();
Thread.Sleep(250);
}
}