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

Customize load timeout for SummaryStatisticsDialog #1775

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 11 additions & 4 deletions src/org/labkey/test/components/SummaryStatisticsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.labkey.test.BaseWebDriverTest;
import org.labkey.test.Locator;
import org.labkey.test.components.ext4.Window;
import org.labkey.test.util.DataRegionTable;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand All @@ -29,11 +30,12 @@
public class SummaryStatisticsDialog extends Window<SummaryStatisticsDialog.ElementCache>
{
private static final String DIALOG_TITLE = "Summary Statistics";
private final int timeoutMs;

public SummaryStatisticsDialog(WebDriver driver)
public SummaryStatisticsDialog(DataRegionTable drt)
{
super(DIALOG_TITLE, driver);
elementCache().statTableLoc.waitForElement(this, BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
super(DIALOG_TITLE, drt.getDriver());
this.timeoutMs = drt.getUpdateTimeout();
}

public void apply()
Expand Down Expand Up @@ -108,8 +110,13 @@ protected ElementCache newElementCache()
return new ElementCache();
}

protected class ElementCache extends Window.ElementCache
protected class ElementCache extends Window<?>.ElementCache
{
public ElementCache()
{
statTableLoc.waitForElement(this, timeoutMs);
}

Locator.XPathLocator statTableLoc = Locator.tagWithClass("table", "stat-table");
Locator.XPathLocator statRowLoc = statTableLoc.append(Locator.tagWithClassContaining("tr", "lk-stats-row"));
Locator.XPathLocator statCellLoc = statRowLoc.append(Locator.tagWithClass("td", "lk-stats-label"));
Expand Down
4 changes: 2 additions & 2 deletions src/org/labkey/test/util/DataRegionTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ private void clickSummaryStatistic(String columnName, String stat, boolean isExp
TestLogger.log(clearOrSet + " the " + stat + " summary statistic in " + getDataRegionName() + " for " + columnName);
clickColumnMenu(columnName, false, "Summary Statistics...");

SummaryStatisticsDialog statsWindow = new SummaryStatisticsDialog(getDriver());
SummaryStatisticsDialog statsWindow = new SummaryStatisticsDialog(this);

if (expectedValue != null)
assertEquals("Stat value not as expected for: " + stat, expectedValue, statsWindow.getValue(stat));
Expand All @@ -991,7 +991,7 @@ private void clickSummaryStatistic(String columnName, String stat, boolean isExp
public void verifySummaryStatisticValue(String columnName, String stat, String expectedValue, String filterDescription)
{
clickColumnMenu(columnName, false, "Summary Statistics...");
SummaryStatisticsDialog statsWindow = new SummaryStatisticsDialog(getDriver());
SummaryStatisticsDialog statsWindow = new SummaryStatisticsDialog(this);
assertEquals("Stat value not as expected for " + stat + " with filter " + filterDescription, expectedValue, statsWindow.getValue(stat));
statsWindow.cancel();
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/test/util/SummaryStatisticsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void verifySummaryStatisticsDialog(String columnName, String colType, boo
DataRegionTable drt = new DataRegionTable("query", _wrapper);
drt.clickColumnMenu(columnName, false, "Summary Statistics...");

SummaryStatisticsDialog statsWindow = new SummaryStatisticsDialog(_wrapper.getDriver());
SummaryStatisticsDialog statsWindow = new SummaryStatisticsDialog(drt);

for (String stat : getExpectedColumnStats(colType, isLookup, isPK))
assertTrue("Expected summary stat is not present: " + stat, statsWindow.isPresent(stat));
Expand Down