Skip to content

Commit

Permalink
Wait for combo box options to be filtered (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-tchad authored Oct 2, 2024
1 parent 9fdaf25 commit 57d8b6c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/src/org/labkey/test/tests/reagent/ReagentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.labkey.test.tests.reagent;

import org.awaitility.Awaitility;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand All @@ -32,6 +33,7 @@
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -111,8 +113,10 @@ public void testInsert()

click(Locator.xpath("//input[@name='LabelId']/../img"));
setFormElement(Locator.xpath("//input[@name='LabelId']/../input[contains(@class, 'x-form-field')]"), "Alexa");
int alexaLabels = getElementCount(Locator.tag("div").withClass("x-combo-list-item").notHidden().containing("Alexa"));
assertEquals("Expected to find 5 Alexa labels", 5, alexaLabels);
Locator locator = Locator.tag("div").withClass("x-combo-list-item").notHidden().containing("Alexa");
// Wait for combo box to be filtered
Awaitility.await().atMost(Duration.ofSeconds(2)).untilAsserted(() ->
assertEquals("Expected to find 5 Alexa labels", 5, locator.findElements(getDriver()).size()));

Actions builder = new Actions(getDriver());
builder.sendKeys(Keys.ARROW_DOWN, Keys.ARROW_DOWN).build().perform();
Expand Down

0 comments on commit 57d8b6c

Please sign in to comment.