Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Check for Removed Grid Filter #1830

Merged
merged 3 commits into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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