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
34 changes: 25 additions & 9 deletions src/org/labkey/test/components/react/QueryChartPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.labkey.test.Locator;
import org.labkey.test.components.Component;
import org.labkey.test.components.WebDriverComponent;
import org.labkey.test.components.html.BootstrapMenu;
import org.labkey.test.components.ui.grids.QueryGrid;
import org.labkey.test.components.ui.grids.ResponsiveGrid;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
Expand Down Expand Up @@ -38,11 +38,7 @@ public QueryChartDialog clickEdit()

public File clickExport(String subMenuText)
{
elementCache().exportMenu.expand();
return getWrapper().doAndWaitForDownload(() ->
Locator.tagWithClass("li", "lk-menu-item")
.descendant(Locator.tagContainingText("a", subMenuText))
.findElement(elementCache().headingEl).click());
return getWrapper().doAndWaitForDownload(() -> elementCache().exportMenu.doMenuAction(subMenuText));
}

public String getTitle()
Expand All @@ -55,13 +51,27 @@ public WebElement getSvgChart()
return Locator.byClass("svg-chart__chart").childTag("svg").waitForElement(this, WAIT_FOR_JAVASCRIPT);
}

public QueryGrid clickClose()
public ResponsiveGrid<?> getCurveStatsGrid()
{
return new ResponsiveGrid.ResponsiveGridFinder(getDriver()).waitFor(elementCache().curveStatsPanel);
}

public boolean isCurveStatsPanelPresent()
{
return ElementCache.curveStatsPanelLoc.findOptionalElement(this).isPresent();
}

public File exportCurveStats(String type)
{
return getWrapper().doAndWaitForDownload(() -> elementCache().exportStatsMenu.doMenuAction(type));
}

public void clickClose()
{
var btn = elementCache().closeButton;
getWrapper().shortWait().until(ExpectedConditions.elementToBeClickable(btn));
btn.click();
getWrapper().shortWait().until(ExpectedConditions.stalenessOf(btn));
return _queryGrid;
}

@Override
Expand All @@ -88,11 +98,17 @@ protected class ElementCache extends Component<?>.ElementCache
.findWhenNeeded(this).withTimeout(2000);
public final WebElement editButton = Locator.tagWithAttribute("button", "title", "Edit chart")
.findWhenNeeded(headingEl);
public final BootstrapMenu exportMenu = new MultiMenu.MultiMenuFinder(getDriver()).withButtonClass("chart-panel-export-btn").findWhenNeeded(headingEl);
public final MultiMenu exportMenu = new MultiMenu.MultiMenuFinder(getDriver())
.withButtonClass("chart-panel-export-btn")
.findWhenNeeded(headingEl);
public final WebElement closeButton = Locator.tagWithAttribute("button", "title", "Hide chart")
.findWhenNeeded(headingEl);
public final WebElement titleElement= Locator.tagWithClass("div", "chart-panel__heading-title")
.findWhenNeeded(headingEl);
public static final Locator curveStatsPanelLoc = Locator.byClass("curve-fit-statistics");
public final WebElement curveStatsPanel = curveStatsPanelLoc.findWhenNeeded(this).withTimeout(WAIT_FOR_JAVASCRIPT);
public final WebElement curveStatsHeader = Locator.byClass("curve-fit-statistics__header").findWhenNeeded(curveStatsPanel);
public final MultiMenu exportStatsMenu = new MultiMenu.MultiMenuFinder(getDriver()).findWhenNeeded(curveStatsHeader);
}


Expand Down
6 changes: 6 additions & 0 deletions src/org/labkey/test/components/ui/grids/ResponsiveGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,12 @@ public ResponsiveGridFinder inParentWithId(String id)
return this;
}

public ResponsiveGridFinder inParentWithClass(String className)
{
_locator = Locator.byClass(className).child(Locators.responsiveGrid());
return this;
}

public ResponsiveGridFinder withGridId(String id)
{
_locator = Locators.responsiveGrid(id);
Expand Down