Added Locations E2E tests

This commit is contained in:
2025-11-09 22:39:12 +01:00
parent 7f6a14a999
commit d27b4e19b0
3 changed files with 141 additions and 1 deletions

View File

@@ -0,0 +1,58 @@
using Berufsschule_HAM.E2ETests.Helper;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.Diagnostics;
namespace Berufsschule_HAM.E2ETests;
public class LocationsPageTests : IDisposable
{
private readonly ChromeDriver _driver;
public Uri serverUri;
public string serverUrl;
public Process serverProcess;
public LocationsPageTests()
{
serverUrl = AppHelper.ServerUrl;
serverUri = AppHelper.ServerUri;
Task<Process> app = AppHelper.StartApp(serverUrl);
_driver = AppHelper.GetChromeDriver();
serverProcess = app.Result;
}
[Fact]
public void LocationsPage_ShouldShowButton()
{
AppHelper.Login(_driver);
LocationsHelper.NavigateToLocationsPage(_driver);
_driver.FindElement(By.CssSelector("button[data-bs-target=\"#createModal\"]"));
}
[Fact]
public void LocationsPage_ShouldShowCreateViewModal()
{
AppHelper.Login(_driver);
LocationsHelper.NavigateToLocationsPage(_driver);
List<string> ids = ["createLocationName", "createRoomNumber", "createSeat"];
List<string> css = ["#createModal .btn-primary", "#createModal .btn-secondary"];
ids.ForEach(id => _driver.FindElement(By.Id(id)));
css.ForEach(selector => _driver.FindElement(By.CssSelector(selector)));
}
[Fact]
public void LocationsPage_ShouldCreateAndUpdateAndDeleteGroup()
{
AppHelper.Login(_driver);
LocationsHelper.NavigateToLocationsPage(_driver);
LocationsHelper.CreateLocation(_driver, "RESERVED_LOCATION", "RESERVED_ROOM", "RESERVED_ROOMNUMBER");
LocationsHelper.UpdateLocation(_driver, "RESERVED_LOCATION", "RESERVED_ROOM", "RESERVED_ROOMNUMBER", "RESERVED_LOCATION2", "RESERVED_ROOM2", "RESERVED_ROOMNUMBER2");
LocationsHelper.UpdateLocation(_driver, "RESERVED_LOCATION2", "RESERVED_ROOM2", "RESERVED_ROOMNUMBER2", "RESERVED_LOCATION", "RESERVED_ROOM", "RESERVED_ROOMNUMBER");
LocationsHelper.DeleteLocation(_driver, "reservedlocation-reservedroom-reservedroomnumber");
}
public void Dispose()
{
_driver.Quit();
serverProcess.Kill();
}
}