Replaced unreliable sleeps with WebDriverWait

This commit is contained in:
2025-11-10 00:29:36 +01:00
parent 53645a4b7e
commit fb15d825d0
6 changed files with 35 additions and 16 deletions

View File

@@ -13,7 +13,7 @@ public static class LocationsHelper
NavigateToLocationsPage(driver);
IWebElement createLocationButton = driver.FindElement(By.CssSelector("button[data-bs-target=\"#createModal\"]"));
createLocationButton.Click();
Thread.Sleep(500);
AppHelper.AwaitVisible(driver, By.Id("createLocationName"));
driver.FindElement(By.Id("createLocationName")).SendKeys(name);
driver.FindElement(By.Id("createRoomNumber")).SendKeys(room);
driver.FindElement(By.Id("createSeat")).SendKeys(seat);
@@ -28,7 +28,7 @@ public static class LocationsHelper
string selector = $"button.btn-warning[data-location-name=\"{name}\"][data-room-number=\"{room}\"][data-seat=\"{seat}\"]";
IWebElement updateLocationButton = driver.FindElement(By.CssSelector(selector));
AppHelper.ScrollIntoViewAndClick(driver, updateLocationButton);
Thread.Sleep(500);
AppHelper.AwaitVisible(driver, By.Id("editLocationName"));
List<string[]> ids = [["editLocationName", newName], ["editRoomNumber", newRoom], ["editSeat", newSeat]];
ids.ForEach(id =>
{
@@ -48,7 +48,7 @@ public static class LocationsHelper
NavigateToLocationsPage(driver);
IWebElement deleteButton = driver.FindElement(By.CssSelector($"button.btn-danger[data-location-id=\"{cn}\"]"));
AppHelper.ScrollIntoViewAndClick(driver, deleteButton);
Thread.Sleep(1000);
AppHelper.AwaitVisible(driver, By.Id("deleteModal"));
driver.FindElement(By.Id("deleteModal"));
IWebElement deleteConfirmButton = driver.FindElement(By.Id("deleteForm"));
deleteConfirmButton.Click();