Skip to content
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
33 changes: 33 additions & 0 deletions src/org/labkey/test/components/react/QueryChartDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getTrendlineProvidedParametersOptions()
{
clickFieldOptions("Trendline"); // open the popover
List<String> 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();
Expand Down Expand Up @@ -399,6 +425,12 @@ public boolean isPreviewPresent()
elementCache().svgLoc.existsIn(elementCache().previewContainer());
}

public List<String> getPreviewErrors()
{
return elementCache().svgErrorLoc.findElements(elementCache().previewContainer()).stream()
.map(WebElement::getText).toList();
}

public WebElement getSvgChart()
{
WebDriverWrapper.waitFor(()-> isPreviewPresent(),
Expand Down Expand Up @@ -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()
{
Expand Down
8 changes: 8 additions & 0 deletions src/org/labkey/test/components/react/QueryChartPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -51,6 +52,13 @@ public WebElement getSvgChart()
return Locator.byClass("svg-chart__chart").childTag("svg").waitForElement(this, WAIT_FOR_JAVASCRIPT);
}

public List<String> 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);
Expand Down
Loading