diff --git a/src/org/labkey/test/components/react/QueryChartDialog.java b/src/org/labkey/test/components/react/QueryChartDialog.java index 29edbd878a..d068ecb59f 100644 --- a/src/org/labkey/test/components/react/QueryChartDialog.java +++ b/src/org/labkey/test/components/react/QueryChartDialog.java @@ -340,6 +340,32 @@ public QueryChartDialog selectTrendline(String field) return this; } + public QueryChartDialog setTrendlineProvidedParameters(String field) + { + clickFieldOptions("Trendline"); // open the popover + if (field != null) + getTrendlineProvidedParametersSelect().select(field); + else + getTrendlineProvidedParametersSelect().clearSelection(); + elementCache().title.click(); // close the popover + return this; + } + + public List getTrendlineProvidedParametersOptions() + { + clickFieldOptions("Trendline"); // open the popover + List options = getTrendlineProvidedParametersSelect().getOptions(); + elementCache().title.click(); // close the popover + return options; + } + + private ReactSelect getTrendlineProvidedParametersSelect() + { + // can't use elementCache() because the popover is outside the dialog + Locator loc = Locator.tag("div").withChild(Locator.tagContainingText("label", "Provided Parameters")); + return ReactSelect.finder(getDriver()).find(loc.waitForElement(getDriver(), 1500)); + } + public String getSelectedSeries() { return elementCache().reactSelectByLabel("Series").getValue(); @@ -399,6 +425,12 @@ public boolean isPreviewPresent() elementCache().svgLoc.existsIn(elementCache().previewContainer()); } + public List getPreviewErrors() + { + return elementCache().svgErrorLoc.findElements(elementCache().previewContainer()).stream() + .map(WebElement::getText).toList(); + } + public WebElement getSvgChart() { WebDriverWrapper.waitFor(()-> isPreviewPresent(), @@ -534,6 +566,7 @@ public String grayTextPreviewInstruction() private final Locator previewBodyLoc = Locator.tagWithClass("div", "chart-builder-preview-body"); private final Locator svgLoc = Locator.tagWithClass("div", "svg-chart__chart").childTag("svg"); + private final Locator svgErrorLoc = Locator.tagWithClass("div", "svg-chart__chart").childTag("div"); public WebElement svg() { diff --git a/src/org/labkey/test/components/react/QueryChartPanel.java b/src/org/labkey/test/components/react/QueryChartPanel.java index 4aa22782cf..ea760792a9 100644 --- a/src/org/labkey/test/components/react/QueryChartPanel.java +++ b/src/org/labkey/test/components/react/QueryChartPanel.java @@ -9,6 +9,7 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import java.io.File; +import java.util.List; import static org.labkey.test.WebDriverWrapper.WAIT_FOR_JAVASCRIPT; @@ -51,6 +52,13 @@ public WebElement getSvgChart() return Locator.byClass("svg-chart__chart").childTag("svg").waitForElement(this, WAIT_FOR_JAVASCRIPT); } + public List getChartErrors() + { + getWrapper().shortWait().until(ExpectedConditions.visibilityOfAllElements(getSvgChart())); + return Locator.byClass("svg-chart__chart").childTag("div").findElements(this).stream() + .map(WebElement::getText).toList(); + } + public ResponsiveGrid getCurveStatsGrid() { return new ResponsiveGrid.ResponsiveGridFinder(getDriver()).waitFor(elementCache().curveStatsPanel);