diff --git a/src/org/labkey/test/components/ui/FilterStatusValue.java b/src/org/labkey/test/components/ui/FilterStatusValue.java index 4b4c0557c3..34422a9060 100644 --- a/src/org/labkey/test/components/ui/FilterStatusValue.java +++ b/src/org/labkey/test/components/ui/FilterStatusValue.java @@ -33,7 +33,7 @@ public WebDriver getDriver() public String getText() { - return elementCache().textSpan().getText(); + return elementCache().textSpan.getText(); } private boolean isActive() @@ -52,16 +52,16 @@ public void remove() getWrapper().mouseOver(getComponentElement()); getWrapper().mouseOver(elementCache().icon); WebDriverWrapper.waitFor(()-> isActive() && isClose(), - "the filter status item with text ["+getText()+"] did not become active", 500); + "The filter status item with text ["+getText()+"] did not become active.", 500); elementCache().icon.click(); - // if the item you're dismissing is not the rightmost, it won't become stale; instead, its text will + // If the item you're dismissing is not the rightmost, it won't become stale; instead, its text will // be swapped out with the one to its right. So, we check to see that either the text has changed or - // the item became stale. - WebDriverWrapper.waitFor(()-> { - return ExpectedConditions.stalenessOf(getComponentElement()).apply(getDriver()) - || !getText().equals(originalText); - }, "the value item ["+originalText+"] did not disappear", 1000); + // the item became stale. ExpectedConditions.textToBePresentInElement returns false if element is stale. + WebDriverWrapper.waitFor(()-> ExpectedConditions.not( + ExpectedConditions.textToBePresentInElement(elementCache().textSpan, originalText)) + .apply(getDriver()) + , "The value item ["+originalText+"] did not disappear.", 1000); } /** @@ -82,10 +82,7 @@ protected ElementCache newElementCache() protected class ElementCache extends Component.ElementCache { - public WebElement textSpan() - { - return Locator.tag("span").findElement(getComponentElement()); - } + public final WebElement textSpan = Locator.tag("span").refindWhenNeeded(getComponentElement()); public final WebElement icon = Locator.tag("i").findWhenNeeded(getComponentElement()); }