Skip to content

Commit 4bcf845

Browse files
committed
QueryGrid.showChart to wait for previous chart to be stale
1 parent 5cbea42 commit 4bcf845

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/org/labkey/test/components/react/QueryChartDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ public String grayTextPreviewInstruction()
527527
}
528528

529529
private final Locator previewBodyLoc = Locator.tagWithClass("div", "chart-builder-preview-body");
530-
private final Locator svgLoc = Locator.tagWithClass("div", "svg-chart__chart");
530+
private final Locator svgLoc = Locator.tagWithClass("div", "svg-chart__chart").childTag("svg");
531531

532532
public WebElement svg()
533533
{

src/org/labkey/test/components/ui/grids/QueryGrid.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,14 @@ public QueryGrid resetToDefaultState(boolean revertDefaultView)
719719

720720
public QueryChartPanel showChart(String chartName)
721721
{
722+
// if there was a different chart already shown, wait for it to close first
723+
// NOTE: this will need to be updated soon with the changes for the "multiple chart rendering" feature
724+
WebElement prevChart = hasChartPanel() ? getChartPanel().getSvgChart() : null;
725+
722726
elementCache().chartsMenu.clickSubMenu(false, chartName);
727+
728+
if (prevChart != null)
729+
getWrapper().shortWait().until(ExpectedConditions.stalenessOf(prevChart));
723730
return getChartPanel();
724731
}
725732

@@ -737,6 +744,12 @@ public QueryChartPanel getChartPanel()
737744
return new QueryChartPanel.QueryChartPanelFinder(getDriver(), this).waitFor(this);
738745
}
739746

747+
public boolean hasChartPanel()
748+
{
749+
QueryChartPanel chartPanel = new QueryChartPanel.QueryChartPanelFinder(getDriver(), this).findOrNull(this);
750+
return chartPanel != null;
751+
}
752+
740753
public WebElement showRReport(String reportName)
741754
{
742755
elementCache().chartsMenu.clickSubMenu(false, reportName);

0 commit comments

Comments
 (0)