Skip to content
Snippets Groups Projects
Commit 2985783d authored by Robert Goldmann's avatar Robert Goldmann
Browse files

stabilize selenium tests

parent a70d5fb4
Branches
Tags
No related merge requests found
Pipeline #9810 failed
...@@ -235,9 +235,11 @@ class ChartTest extends SeleniumTestBase ...@@ -235,9 +235,11 @@ class ChartTest extends SeleniumTestBase
assertThat(driver.findElement(By.id("filterActiveBadge")).isDisplayed()).isFalse(); assertThat(driver.findElement(By.id("filterActiveBadge")).isDisplayed()).isFalse();
driver.findElement(By.id("chart-filter-container")).click(); driver.findElement(By.id("chart-filter-container")).click();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#chart-filter-container .collapsible-header")));
driver.findElement(By.id("section-type")).click(); driver.findElement(By.id("section-type")).click();
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"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default")));
final WebElement checkBox = driver.findElement(By.cssSelector("#section-type .text-default")); final WebElement checkBox = driver.findElement(By.cssSelector("#section-type .text-default"));
...@@ -256,8 +258,10 @@ class ChartTest extends SeleniumTestBase ...@@ -256,8 +258,10 @@ class ChartTest extends SeleniumTestBase
driver.get(helper.getUrl() + "/charts"); driver.get(helper.getUrl() + "/charts");
driver.findElement(By.id("chart-filter-container")).click(); driver.findElement(By.id("chart-filter-container")).click();
driver.findElement(By.id("section-type")).click();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#chart-filter-container .collapsible-header")));
driver.findElement(By.id("section-type")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default")));
final WebElement checkBox = driver.findElement(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); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", checkBox);
...@@ -285,6 +289,8 @@ class ChartTest extends SeleniumTestBase ...@@ -285,6 +289,8 @@ class ChartTest extends SeleniumTestBase
wait.until(ExpectedConditions.attributeContains(By.cssSelector(chartPreviewSelector + " .chart-preview"), "class", "active")); wait.until(ExpectedConditions.attributeContains(By.cssSelector(chartPreviewSelector + " .chart-preview"), "class", "active"));
driver.findElement(By.id("chart-filter-container")).click(); driver.findElement(By.id("chart-filter-container")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#chart-filter-container .collapsible-header")));
driver.findElement(By.id("section-type")).click(); driver.findElement(By.id("section-type")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default")));
......
...@@ -45,8 +45,8 @@ class FilterTest extends SeleniumTestBase ...@@ -45,8 +45,8 @@ class FilterTest extends SeleniumTestBase
driver.findElement(By.id("section-type")).click(); driver.findElement(By.id("section-type")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#section-type .text-default"))); wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#section-type .text-default")));
final WebElement checkBox = driver.findElements(By.cssSelector("#section-type .text-default")).get(0); final WebElement checkBox = driver.findElements(By.cssSelector("#section-type .text-default")).getFirst();
checkBox.click(); checkBox.click();
driver.findElement(By.id("buttonApplyFilter")).click(); driver.findElement(By.id("buttonApplyFilter")).click();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment