mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Added initial Selenium E2E test setup
This commit is contained in:
37
tests/Berufsschule_HAM.E2ETests/HomePageTests.cs
Normal file
37
tests/Berufsschule_HAM.E2ETests/HomePageTests.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Berufsschule_HAM.E2ETests;
|
||||
|
||||
public class HomePageTests : IDisposable
|
||||
{
|
||||
private readonly ChromeDriver _driver;
|
||||
public string serverUrl;
|
||||
public Process serverProcess;
|
||||
|
||||
public HomePageTests()
|
||||
{
|
||||
serverUrl = "http://localhost:5275";
|
||||
Task<Process> app = Helper.AppHelper.StartApp(serverUrl);
|
||||
|
||||
var options = new ChromeOptions();
|
||||
//options.AddArgument("--headless");
|
||||
_driver = new ChromeDriver(options);
|
||||
serverProcess = app.Result;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HomePage_ShouldShowLoginPage()
|
||||
{
|
||||
_driver.Navigate().GoToUrl(serverUrl);
|
||||
IWebElement loginForm = _driver.FindElement(By.CssSelector("form[action=\"/Home/Login\"]"));
|
||||
Assert.True(loginForm.Displayed);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_driver.Quit();
|
||||
serverProcess.Close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user