mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Added Locations E2E tests
This commit is contained in:
58
tests/Berufsschule_HAM.E2ETests/LocationsPageTests.cs
Normal file
58
tests/Berufsschule_HAM.E2ETests/LocationsPageTests.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user