From a70d5fb4dd8b3ddfc8ab63eaa94cb4bd229b7d5e Mon Sep 17 00:00:00 2001 From: Robert Goldmann <deadlocker@gmx.de> Date: Thu, 10 Apr 2025 23:57:22 +0200 Subject: [PATCH] fix selenium tests --- .../integration/selenium/ChartTest.java | 13 +++++++++++-- .../selenium/settings/MiscSettingsTest.java | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/ChartTest.java b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/ChartTest.java index b333dda23..8d36b734a 100644 --- a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/ChartTest.java +++ b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/ChartTest.java @@ -236,11 +236,15 @@ class ChartTest extends SeleniumTestBase driver.findElement(By.id("chart-filter-container")).click(); driver.findElement(By.id("section-type")).click(); + + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default"))); + final WebElement checkBox = driver.findElement(By.cssSelector("#section-type .text-default")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", checkBox); checkBox.click(); - final WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); + wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("filter-button-reset"))); assertThat(driver.findElement(By.id("filterActiveBadge")).isDisplayed()).isTrue(); @@ -253,10 +257,12 @@ class ChartTest extends SeleniumTestBase driver.findElement(By.id("chart-filter-container")).click(); driver.findElement(By.id("section-type")).click(); + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default"))); final WebElement checkBox = driver.findElement(By.cssSelector("#section-type .text-default")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", checkBox); - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); + wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default"))); checkBox.click(); @@ -280,6 +286,9 @@ class ChartTest extends SeleniumTestBase driver.findElement(By.id("chart-filter-container")).click(); driver.findElement(By.id("section-type")).click(); + wait = new WebDriverWait(driver, Duration.ofSeconds(5)); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default"))); + final WebElement checkBox = driver.findElement(By.cssSelector("#section-type .text-default")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", checkBox); checkBox.click(); diff --git a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/settings/MiscSettingsTest.java b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/settings/MiscSettingsTest.java index c07b8e9eb..38a8981b2 100644 --- a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/settings/MiscSettingsTest.java +++ b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/settings/MiscSettingsTest.java @@ -37,6 +37,7 @@ class MiscSettingsTest extends SeleniumTestBase WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("miscSettingsContainer"))); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#miscSettingsContainer button"))); driver.findElement(By.cssSelector("#miscSettingsContainer button")).click(); -- GitLab