Skip to content

Commit 57d8b6c

Browse files
authored
Wait for combo box options to be filtered (#31)
1 parent 9fdaf25 commit 57d8b6c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/src/org/labkey/test/tests/reagent/ReagentTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.labkey.test.tests.reagent;
1717

18+
import org.awaitility.Awaitility;
1819
import org.junit.BeforeClass;
1920
import org.junit.Test;
2021
import org.junit.experimental.categories.Category;
@@ -32,6 +33,7 @@
3233
import org.openqa.selenium.WebElement;
3334
import org.openqa.selenium.interactions.Actions;
3435

36+
import java.time.Duration;
3537
import java.util.Arrays;
3638
import java.util.List;
3739
import java.util.Map;
@@ -111,8 +113,10 @@ public void testInsert()
111113

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

117121
Actions builder = new Actions(getDriver());
118122
builder.sendKeys(Keys.ARROW_DOWN, Keys.ARROW_DOWN).build().perform();

0 commit comments

Comments
 (0)