Skip to content

Commit

Permalink
Update Check for Removed Grid Filter (#1830)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-danield authored Feb 19, 2024
1 parent c38db5f commit 41c2b04
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/org/labkey/test/components/ui/FilterStatusValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public WebDriver getDriver()

public String getText()
{
return elementCache().textSpan().getText();
return elementCache().textSpan.getText();
}

private boolean isActive()
Expand All @@ -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);
}

/**
Expand All @@ -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());
}
Expand Down

0 comments on commit 41c2b04

Please sign in to comment.